You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by "shamrickus (via GitHub)" <gi...@apache.org> on 2023/08/28 16:07:40 UTC

[GitHub] [trafficcontrol] shamrickus opened a new pull request, #7750: TO: Add fields to servers v5 endpoints to indicate update failures

shamrickus opened a new pull request, #7750:
URL: https://github.com/apache/trafficcontrol/pull/7750

   <!--
   Thank you for contributing! Please be sure to read our contribution guidelines: https://github.com/apache/trafficcontrol/blob/master/CONTRIBUTING.md
   If this closes or relates to an existing issue, please reference it using one of the following:
   
   Closes: #ISSUE
   Related: #ISSUE
   
   If this PR fixes a security vulnerability, DO NOT submit! Instead, contact
   the Apache Traffic Control Security Team at security@trafficcontrol.apache.org and follow the
   guidelines at https://apache.org/security regarding vulnerability disclosure.
   -->
   
   This fixes #7674
   <!-- **^ Add meaningful description above** --><hr/>
   
   ## Which Traffic Control components are affected by this PR?
   <!-- Please delete all components from this list that are NOT affected by this PR.
   Feel free to add the name of a tool or script that is affected but not on the list.
   -->
   - Documentation
   - Traffic Ops
   
   ## What is the best way to verify this PR?
   Ensure the migrations work both ways.
   Verify that the documentation looks good and that the new fields are added to the `servers` `servers/{{hostname}}/update_status` and `servers/{{hostname}}/update` . The new fields should also be cdn lock permissible.
   <!-- Please include here ALL the steps necessary to test your PR.
   If your PR has tests (and most should), provide the steps needed to run the tests.
   If not, please provide step-by-step instructions to test the PR manually and explain why your PR does not need tests. -->
   
   <!-- Delete this section if the PR is not a bugfix, or if the bug is only in the master branch.
   Examples:
   - 5.1.2
   - 5.1.3 (RC1)
    -->
   
   
   ## PR submission checklist
   - [x] This PR has tests <!-- If not, please delete this text and explain why this PR does not need tests. -->
   - [x] This PR has documentation <!-- If not, please delete this text and explain why this PR does not need documentation. -->
   - [x] This PR has a CHANGELOG.md entry <!-- A fix for a bug from an ATC release, an improvement, or a new feature should have a changelog entry. -->
   - [x] This PR **DOES NOT FIX A SERIOUS SECURITY VULNERABILITY** (see [the Apache Software Foundation's security guidelines](https://apache.org/security) for details)
   
   <!--
   Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements.  See the NOTICE file
   distributed with this work for additional information
   regarding copyright ownership.  The ASF licenses this file
   to you under the Apache License, Version 2.0 (the
   "License"); you may not use this file except in compliance
   with the License.  You may obtain a copy of the License at
   
       http://www.apache.org/licenses/LICENSE-2.0
   
   Unless required by applicable law or agreed to in writing,
   software distributed under the License is distributed on an
   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   KIND, either express or implied.  See the License for the
   specific language governing permissions and limitations
   under the License.
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficcontrol] ocket8888 merged pull request #7750: TO: Add fields to servers v5 endpoints to indicate update failures

Posted by "ocket8888 (via GitHub)" <gi...@apache.org>.
ocket8888 merged PR #7750:
URL: https://github.com/apache/trafficcontrol/pull/7750


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficcontrol] shamrickus commented on a diff in pull request #7750: TO: Add fields to servers v5 endpoints to indicate update failures

Posted by "shamrickus (via GitHub)" <gi...@apache.org>.
shamrickus commented on code in PR #7750:
URL: https://github.com/apache/trafficcontrol/pull/7750#discussion_r1307913878


##########
lib/go-tc/servers.go:
##########
@@ -1356,7 +1358,9 @@ type ServerV50 struct {
 	// The time at which revalidations for this server were last updated by t3c.
 	RevalApplyTime *time.Time `json:"revalApplyTime" db:"revalidate_apply_time"`
 	// The time at which revalidations were last queued for this server.
-	RevalUpdateTime   *time.Time `json:"revalUpdateTime" db:"revalidate_update_time"`
+	RevalUpdateTime *time.Time `json:"revalUpdateTime" db:"revalidate_update_time"`
+	// If the last reval apply failed for this server
+	RevalUpdateFailed *bool      `json:"revalUpdateFailed" db:"revalidate_update_failed"`

Review Comment:
   No reason



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficcontrol] codecov[bot] commented on pull request #7750: TO: Add fields to servers v5 endpoints to indicate update failures

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #7750:
URL: https://github.com/apache/trafficcontrol/pull/7750#issuecomment-1695963335

   ## [Codecov](https://app.codecov.io/gh/apache/trafficcontrol/pull/7750?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   > Merging [#7750](https://app.codecov.io/gh/apache/trafficcontrol/pull/7750?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (efa3fb1) into [master](https://app.codecov.io/gh/apache/trafficcontrol/commit/5c71ca6f92eb81fe220ac0a3ec3859c18f3f0d09?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (5c71ca6) will **decrease** coverage by `3.04%`.
   > The diff coverage is `21.77%`.
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #7750      +/-   ##
   ============================================
   - Coverage     32.14%   29.10%   -3.04%     
     Complexity       98       98              
   ============================================
     Files           712      595     -117     
     Lines         81252    75974    -5278     
     Branches        965       90     -875     
   ============================================
   - Hits          26115    22110    -4005     
   + Misses        52992    51782    -1210     
   + Partials       2145     2082      -63     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/trafficcontrol/pull/7750/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [golib_unit](https://app.codecov.io/gh/apache/trafficcontrol/pull/7750/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `53.63% <0.00%> (-0.07%)` | :arrow_down: |
   | [grove_unit](https://app.codecov.io/gh/apache/trafficcontrol/pull/7750/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `12.02% <ø> (ø)` | |
   | [t3c_unit](https://app.codecov.io/gh/apache/trafficcontrol/pull/7750/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `5.99% <ø> (ø)` | |
   | [traffic_monitor_unit](https://app.codecov.io/gh/apache/trafficcontrol/pull/7750/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `26.33% <ø> (ø)` | |
   | [traffic_ops_unit](https://app.codecov.io/gh/apache/trafficcontrol/pull/7750/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `21.87% <24.77%> (-0.07%)` | :arrow_down: |
   | [traffic_portal_v2](https://app.codecov.io/gh/apache/trafficcontrol/pull/7750/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [traffic_stats_unit](https://app.codecov.io/gh/apache/trafficcontrol/pull/7750/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `10.76% <ø> (ø)` | |
   | [unit_tests](https://app.codecov.io/gh/apache/trafficcontrol/pull/7750/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `25.89% <21.77%> (-3.55%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Files Changed](https://app.codecov.io/gh/apache/trafficcontrol/pull/7750?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [lib/go-tc/servers.go](https://app.codecov.io/gh/apache/trafficcontrol/pull/7750?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-bGliL2dvLXRjL3NlcnZlcnMuZ28=) | `40.07% <0.00%> (-0.80%)` | :arrow_down: |
   | [...fic\_ops/traffic\_ops\_golang/dbhelpers/db\_helpers.go](https://app.codecov.io/gh/apache/trafficcontrol/pull/7750?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-dHJhZmZpY19vcHMvdHJhZmZpY19vcHNfZ29sYW5nL2RiaGVscGVycy9kYl9oZWxwZXJzLmdv) | `20.49% <0.00%> (-0.22%)` | :arrow_down: |
   | [traffic\_ops/traffic\_ops\_golang/server/update.go](https://app.codecov.io/gh/apache/trafficcontrol/pull/7750?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-dHJhZmZpY19vcHMvdHJhZmZpY19vcHNfZ29sYW5nL3NlcnZlci91cGRhdGUuZ28=) | `0.00% <0.00%> (ø)` | |
   | [traffic\_ops/v5-client/server.go](https://app.codecov.io/gh/apache/trafficcontrol/pull/7750?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-dHJhZmZpY19vcHMvdjUtY2xpZW50L3NlcnZlci5nbw==) | `66.66% <ø> (-0.67%)` | :arrow_down: |
   | [traffic\_ops/v5-client/server\_update\_status.go](https://app.codecov.io/gh/apache/trafficcontrol/pull/7750?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-dHJhZmZpY19vcHMvdjUtY2xpZW50L3NlcnZlcl91cGRhdGVfc3RhdHVzLmdv) | `83.33% <ø> (+2.08%)` | :arrow_up: |
   | [traffic\_ops/traffic\_ops\_golang/server/servers.go](https://app.codecov.io/gh/apache/trafficcontrol/pull/7750?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-dHJhZmZpY19vcHMvdHJhZmZpY19vcHNfZ29sYW5nL3NlcnZlci9zZXJ2ZXJzLmdv) | `27.31% <33.33%> (+0.04%)` | :arrow_up: |
   | [...traffic\_ops\_golang/server/servers\_update\_status.go](https://app.codecov.io/gh/apache/trafficcontrol/pull/7750?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-dHJhZmZpY19vcHMvdHJhZmZpY19vcHNfZ29sYW5nL3NlcnZlci9zZXJ2ZXJzX3VwZGF0ZV9zdGF0dXMuZ28=) | `62.33% <58.97%> (-1.21%)` | :arrow_down: |
   
   ... and [118 files with indirect coverage changes](https://app.codecov.io/gh/apache/trafficcontrol/pull/7750/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficcontrol] ocket8888 commented on a diff in pull request #7750: TO: Add fields to servers v5 endpoints to indicate update failures

Posted by "ocket8888 (via GitHub)" <gi...@apache.org>.
ocket8888 commented on code in PR #7750:
URL: https://github.com/apache/trafficcontrol/pull/7750#discussion_r1309313847


##########
traffic_ops/testing/api/v5/cdn_locks_test.go:
##########
@@ -123,19 +123,21 @@ func TestCDNLocks(t *testing.T) {
 					ClientSession: opsUserWithLockSession,
 					RequestOpts:   client.RequestOptions{QueryParameters: url.Values{"hostName": {"cdn2-test-edge"}}},
 					RequestBody: map[string]interface{}{
-						"config_apply_time": util.TimePtr(now),
+						"config_apply_time":    util.Ptr(now),
+						"config_update_failed": util.Ptr(true),

Review Comment:
   need not use `util.Ptr` on non-reference field. I actually don't think it's necessary for either of these, since a non-`nil` value marshals identical to a non-reference value.



##########
traffic_ops/v5-client/server_update_status.go:
##########
@@ -52,11 +53,11 @@ func (to *Session) SetServerQueueUpdate(serverID int, queueUpdate bool, opts Req
 
 // SetUpdateServerStatusTimes updates a server's config queue status and/or reval status.
 // Each argument individually is optional, however at least one argument must not be nil.
-func (to *Session) SetUpdateServerStatusTimes(serverName string, configApplyTime, revalApplyTime *time.Time, opts RequestOptions) (tc.Alerts, toclientlib.ReqInf, error) {
+func (to *Session) SetUpdateServerStatusTimes(serverName string, configApplyTime, revalApplyTime *time.Time, configUpdateFailed, revalUpdateFailed *bool, opts RequestOptions) (tc.Alerts, toclientlib.ReqInf, error) {
 	reqInf := toclientlib.ReqInf{CacheHitStatus: toclientlib.CacheHitStatusMiss}
 	var alerts tc.Alerts
 
-	if configApplyTime == nil && revalApplyTime == nil {
+	if configApplyTime == nil && revalApplyTime == nil && configUpdateFailed == nil && revalUpdateFailed == nil {
 		return alerts, reqInf, errors.New("one must be non-nil (configApplyTime, revalApplyTime); nothing to do")

Review Comment:
   error message no longer fully describes erroneous calls



##########
traffic_ops/traffic_ops_golang/dbhelpers/db_helpers.go:
##########
@@ -1975,6 +1975,28 @@ WHERE server.id = $2;`
 	return nil
 }
 
+func SetUpdateFailedForServer(tx *sql.Tx, serverID int64, failed bool) error {
+	query := `
+UPDATE public.server
+SET config_update_failed = $1
+WHERE server.id = $2`
+	if _, err := tx.Exec(query, failed, serverID); err != nil {
+		return fmt.Errorf("setting config update failed for ServerID %d with value %v: %v", serverID, failed, err)
+	}
+	return nil
+}
+
+func SetRevalFailedForServer(tx *sql.Tx, serverID int64, failed bool) error {
+	query := `
+UPDATE public.server
+SET revalidate_update_failed = $1
+WHERE server.id = $2`
+	if _, err := tx.Exec(query, failed, serverID); err != nil {
+		return fmt.Errorf("setting reval update failed for ServerID %d with value %v: %v", serverID, failed, err)

Review Comment:
   should use wrapping error construction



##########
traffic_ops/app/db/migrations/2023082308560644_server_update_status.up.sql:
##########
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership.  The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+ALTER TABLE public.server
+  ADD COLUMN IF NOT EXISTS config_update_failed boolean DEFAULT false,
+  ADD COLUMN IF NOT EXISTS revalidate_update_failed boolean DEFAULT false;

Review Comment:
   Since these have default values, `NULL` values have no valid use or meaning, and scanning into a non-reference struct field would fail for `NULL` values, do you want to make these columns `NOT NULL`?



##########
traffic_ops/traffic_ops_golang/dbhelpers/db_helpers.go:
##########
@@ -1975,6 +1975,28 @@ WHERE server.id = $2;`
 	return nil
 }
 
+func SetUpdateFailedForServer(tx *sql.Tx, serverID int64, failed bool) error {
+	query := `
+UPDATE public.server
+SET config_update_failed = $1
+WHERE server.id = $2`
+	if _, err := tx.Exec(query, failed, serverID); err != nil {
+		return fmt.Errorf("setting config update failed for ServerID %d with value %v: %v", serverID, failed, err)
+	}
+	return nil
+}
+
+func SetRevalFailedForServer(tx *sql.Tx, serverID int64, failed bool) error {

Review Comment:
   exported symbol should have a GoDoc comment



##########
traffic_ops/testing/api/v5/servers_hostname_update_test.go:
##########
@@ -125,9 +137,15 @@ func validateServerApplyTimes(hostName string, expectedResp map[string]interface
 				case "ConfigApplyTime":
 					assert.RequireNotNil(t, resp.Response[0].ConfigApplyTime, "Expected ConfigApplyTime to not be nil.")
 					assert.Equal(t, true, server.ConfigApplyTime.Equal(expected.(time.Time)), "Expected ConfigApplyTime to be %v, but got %v", expected, server.ConfigApplyTime)
+				case "ConfigUpdateFailed":
+					assert.RequireNotNil(t, resp.Response[0].ConfigUpdateFailed, "Expected ConfigUpdateFailed to not be nil.")
+					assert.Equal(t, expected.(bool), resp.Response[0].ConfigUpdateFailed, "Expected ConfigUpdateFailed to be %v, but got %v", expected, server.ConfigUpdateFailed)
 				case "RevalApplyTime":
 					assert.RequireNotNil(t, resp.Response[0].RevalApplyTime, "Expected RevalApplyTime to not be nil.")
 					assert.Equal(t, true, server.RevalApplyTime.Equal(expected.(time.Time)), "Expected RevalApplyTime to be %v, but got %v", expected, server.RevalApplyTime)
+				case "RevalUpdateFailed":
+					assert.RequireNotNil(t, resp.Response[0].RevalUpdateFailed, "Expected RevalUpdateFailed to not be nil.")

Review Comment:
   this check cannot possibly fail because non-reference fields can never be `nil`



##########
traffic_ops/traffic_ops_golang/dbhelpers/db_helpers.go:
##########
@@ -1975,6 +1975,28 @@ WHERE server.id = $2;`
 	return nil
 }
 
+func SetUpdateFailedForServer(tx *sql.Tx, serverID int64, failed bool) error {

Review Comment:
   exported symbol should have a GoDoc comment



##########
traffic_ops/traffic_ops_golang/dbhelpers/db_helpers.go:
##########
@@ -1975,6 +1975,28 @@ WHERE server.id = $2;`
 	return nil
 }
 
+func SetUpdateFailedForServer(tx *sql.Tx, serverID int64, failed bool) error {
+	query := `
+UPDATE public.server
+SET config_update_failed = $1
+WHERE server.id = $2`
+	if _, err := tx.Exec(query, failed, serverID); err != nil {
+		return fmt.Errorf("setting config update failed for ServerID %d with value %v: %v", serverID, failed, err)

Review Comment:
   should use wrapping error construction



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficcontrol] shamrickus commented on a diff in pull request #7750: TO: Add fields to servers v5 endpoints to indicate update failures

Posted by "shamrickus (via GitHub)" <gi...@apache.org>.
shamrickus commented on code in PR #7750:
URL: https://github.com/apache/trafficcontrol/pull/7750#discussion_r1310324287


##########
traffic_ops/testing/api/v5/cdn_locks_test.go:
##########
@@ -123,19 +123,21 @@ func TestCDNLocks(t *testing.T) {
 					ClientSession: opsUserWithLockSession,
 					RequestOpts:   client.RequestOptions{QueryParameters: url.Values{"hostName": {"cdn2-test-edge"}}},
 					RequestBody: map[string]interface{}{
-						"config_apply_time": util.TimePtr(now),
+						"config_apply_time":    util.Ptr(now),
+						"config_update_failed": util.Ptr(true),

Review Comment:
   `ServerUpdateStatusV5` still has this as a pointer since it's an optional field.



##########
traffic_ops/testing/api/v5/servers_hostname_update_test.go:
##########
@@ -125,9 +137,15 @@ func validateServerApplyTimes(hostName string, expectedResp map[string]interface
 				case "ConfigApplyTime":
 					assert.RequireNotNil(t, resp.Response[0].ConfigApplyTime, "Expected ConfigApplyTime to not be nil.")
 					assert.Equal(t, true, server.ConfigApplyTime.Equal(expected.(time.Time)), "Expected ConfigApplyTime to be %v, but got %v", expected, server.ConfigApplyTime)
+				case "ConfigUpdateFailed":
+					assert.RequireNotNil(t, resp.Response[0].ConfigUpdateFailed, "Expected ConfigUpdateFailed to not be nil.")

Review Comment:
   `ServerUpdateStatusV5` still has this as a pointer since it's an optional field.



##########
traffic_ops/testing/api/v5/servers_hostname_update_test.go:
##########
@@ -125,9 +137,15 @@ func validateServerApplyTimes(hostName string, expectedResp map[string]interface
 				case "ConfigApplyTime":
 					assert.RequireNotNil(t, resp.Response[0].ConfigApplyTime, "Expected ConfigApplyTime to not be nil.")
 					assert.Equal(t, true, server.ConfigApplyTime.Equal(expected.(time.Time)), "Expected ConfigApplyTime to be %v, but got %v", expected, server.ConfigApplyTime)
+				case "ConfigUpdateFailed":
+					assert.RequireNotNil(t, resp.Response[0].ConfigUpdateFailed, "Expected ConfigUpdateFailed to not be nil.")
+					assert.Equal(t, expected.(bool), resp.Response[0].ConfigUpdateFailed, "Expected ConfigUpdateFailed to be %v, but got %v", expected, server.ConfigUpdateFailed)
 				case "RevalApplyTime":
 					assert.RequireNotNil(t, resp.Response[0].RevalApplyTime, "Expected RevalApplyTime to not be nil.")
 					assert.Equal(t, true, server.RevalApplyTime.Equal(expected.(time.Time)), "Expected RevalApplyTime to be %v, but got %v", expected, server.RevalApplyTime)
+				case "RevalUpdateFailed":
+					assert.RequireNotNil(t, resp.Response[0].RevalUpdateFailed, "Expected RevalUpdateFailed to not be nil.")

Review Comment:
   `ServerUpdateStatusV5` still has this as a pointer since it's an optional field.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficcontrol] ocket8888 commented on a diff in pull request #7750: TO: Add fields to servers v5 endpoints to indicate update failures

Posted by "ocket8888 (via GitHub)" <gi...@apache.org>.
ocket8888 commented on code in PR #7750:
URL: https://github.com/apache/trafficcontrol/pull/7750#discussion_r1307696075


##########
lib/go-tc/servers.go:
##########
@@ -1356,7 +1358,9 @@ type ServerV50 struct {
 	// The time at which revalidations for this server were last updated by t3c.
 	RevalApplyTime *time.Time `json:"revalApplyTime" db:"revalidate_apply_time"`
 	// The time at which revalidations were last queued for this server.
-	RevalUpdateTime   *time.Time `json:"revalUpdateTime" db:"revalidate_update_time"`
+	RevalUpdateTime *time.Time `json:"revalUpdateTime" db:"revalidate_update_time"`
+	// If the last reval apply failed for this server
+	RevalUpdateFailed *bool      `json:"revalUpdateFailed" db:"revalidate_update_failed"`

Review Comment:
   These have a default value; do they need to be reference types? When would this be `nil`, and what does that mean?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficcontrol] ocket8888 commented on a diff in pull request #7750: TO: Add fields to servers v5 endpoints to indicate update failures

Posted by "ocket8888 (via GitHub)" <gi...@apache.org>.
ocket8888 commented on code in PR #7750:
URL: https://github.com/apache/trafficcontrol/pull/7750#discussion_r1309314597


##########
traffic_ops/testing/api/v5/servers_hostname_update_test.go:
##########
@@ -125,9 +137,15 @@ func validateServerApplyTimes(hostName string, expectedResp map[string]interface
 				case "ConfigApplyTime":
 					assert.RequireNotNil(t, resp.Response[0].ConfigApplyTime, "Expected ConfigApplyTime to not be nil.")
 					assert.Equal(t, true, server.ConfigApplyTime.Equal(expected.(time.Time)), "Expected ConfigApplyTime to be %v, but got %v", expected, server.ConfigApplyTime)
+				case "ConfigUpdateFailed":
+					assert.RequireNotNil(t, resp.Response[0].ConfigUpdateFailed, "Expected ConfigUpdateFailed to not be nil.")

Review Comment:
   this check cannot possibly fail because non-reference fields can never be `nil`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficcontrol] ocket8888 commented on a diff in pull request #7750: TO: Add fields to servers v5 endpoints to indicate update failures

Posted by "ocket8888 (via GitHub)" <gi...@apache.org>.
ocket8888 commented on code in PR #7750:
URL: https://github.com/apache/trafficcontrol/pull/7750#discussion_r1309310745


##########
lib/go-tc/servers.go:
##########
@@ -1437,6 +1441,45 @@ func (s ServerV50) RevalidationPending() bool {
 // version 5 of the Traffic Ops API.
 type ServerV5 = ServerV50
 
+type ServerUpdateStatusV5 ServerUpdateStatusV50
+
+type ServerUpdateStatusV50 struct {
+	HostName      string `json:"host_name"`
+	UpdatePending bool   `json:"upd_pending"`
+	// Deprecated: In APIv5 and later, this extraneous field is not calculated
+	// by Traffic Ops; the information is available by comparing RevalUpdateTime
+	// to RevalApplyTime.

Review Comment:
   a similar deprecation could be applied to `UpdatePending`



##########
lib/go-tc/servers.go:
##########
@@ -1437,6 +1441,45 @@ func (s ServerV50) RevalidationPending() bool {
 // version 5 of the Traffic Ops API.
 type ServerV5 = ServerV50
 
+type ServerUpdateStatusV5 ServerUpdateStatusV50
+
+type ServerUpdateStatusV50 struct {

Review Comment:
   These should have GoDoc comments



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org