rimashah25 commented on code in PR #7023:
URL: https://github.com/apache/trafficcontrol/pull/7023#discussion_r950527891
##########
traffic_ops/traffic_ops_golang/routing/routes.go:
##########
@@ -131,6 +131,8 @@ func Routes(d ServerData) ([]Route, http.Handler, error) {
* 4.x API
*/
+ // 4.1 GET servers
Review Comment:
nit: To maintain consistency, remove 4.1. When routes were defined in 3.1,
there wasn't a specific mention of 4.1
##########
traffic_ops/testing/api/v4/tc-fixtures.json:
##########
@@ -2,11 +2,11 @@
"asns": [
{
"asn": 8888,
- "cachegroupName": "originCachegroup"
+ "cachegroup": "originCachegroup"
Review Comment:
Why is this change not reflected in v3? Is it because the tests haven't been
updated for v3?
##########
traffic_ops/traffic_ops_golang/server/servers_test.go:
##########
@@ -191,6 +195,8 @@ func TestGetServersByCachegroup(t *testing.T) {
// or by CSV if types get in the way
for _, srv := range testServers {
ts := srv.Server
+ asns := &pq.Int64Array{}
Review Comment:
Change this to []int?
##########
lib/go-tc/servers.go:
##########
@@ -1019,6 +1019,12 @@ func UpdateServerPropertiesV40(profileNames []string,
properties CommonServerPro
}
}
+// ServerV41 is the representation of a Server in version 4.1 of the Traffic
Ops API.
+type ServerV41 struct {
+ ServerV40
+ ASNs []int64 `json:"asns"`
Review Comment:
Does it have to be `int64`? why not `int` type
##########
traffic_ops/traffic_ops_golang/server/servers_test.go:
##########
@@ -81,7 +82,10 @@ func getTestServers() []ServerAndInterfaces {
RevalUpdateTime: &(time.Time{}),
RevalApplyTime: &(time.Time{}),
}
-
+ testServer := tc.ServerV41{
+ ServerV40: testServerV40,
+ ASNs: pq.Int64Array{1, 2},
Review Comment:
Change this to []int?
##########
lib/go-tc/servers.go:
##########
@@ -1019,6 +1021,12 @@ func UpdateServerPropertiesV40(profileNames []string,
properties CommonServerPro
}
}
+// ServerV41 is the representation of a Server in version 4.1 of the Traffic
Ops API.
+type ServerV41 struct {
+ ServerV40
+ ASNs pq.Int32Array `json:"asns"`
Review Comment:
Agreed with @ocket8888. Using pq package is a bit more cumbersome than just
declaring a slice of int.
##########
traffic_ops/traffic_ops_golang/server/servers_test.go:
##########
@@ -310,6 +317,8 @@ func TestGetMidServers(t *testing.T) {
for _, srv := range testServers {
ts := srv.Server
+ asns := &pq.Int64Array{}
Review Comment:
Change this to []int?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]