shamrickus commented on a change in pull request #4700:
URL: https://github.com/apache/trafficcontrol/pull/4700#discussion_r428742309
##########
File path: traffic_ops/client/server.go
##########
@@ -33,157 +33,139 @@ const (
)
// CreateServer creates a Server.
-func (to *Session) CreateServer(server tc.Server) (tc.Alerts, ReqInf, error) {
+func (to *Session) CreateServer(server tc.ServerNullable) (tc.Alerts, ReqInf,
error) {
+ var alerts tc.Alerts
var remoteAddr net.Addr
reqInf := ReqInf{CacheHitStatus: CacheHitStatusMiss, RemoteAddr:
remoteAddr}
- if server.CachegroupID == 0 && server.Cachegroup != "" {
- cg, _, err := to.GetCacheGroupNullableByName(server.Cachegroup)
+ if (server.CachegroupID == nil || *server.CachegroupID == 0) &&
server.Cachegroup != nil && *server.Cachegroup != "" {
Review comment:
IMO you can extract out this condition that's essentially copy and
pasted to take in an *int and *string and return a bool.
##########
File path: traffic_ops/testing/api/v1/atsconfig_test.go
##########
@@ -108,3 +105,83 @@ func GetTestATSConfigs(t *testing.T) {
}
}
}
+
+
+
+func CreateTestDeliveryServiceServers(t *testing.T) {
+ dses, _, err := TOSession.GetDeliveryServices()
+ if err != nil {
+ t.Errorf("cannot GET DeliveryServices: %v", err)
+ }
+ if len(dses) < 1 {
+ t.Error("GET DeliveryServices returned no dses, must have at
least 1 to test ds-servers")
+ }
+
+ servers, _, err := TOSession.GetServers()
+ if err != nil {
+ t.Errorf("cannot GET Servers: %v", err)
+ }
+ if len(servers) < 1 {
+ t.Error("GET Servers returned no servers, must have at least 1
to test ds-servers")
+ }
+
+ for _, ds := range dses {
+ serverIDs := make([]int, 0, len(servers))
+ for _, server := range servers {
+ if server.Type == "EDGE" && server.CDNName ==
ds.CDNName {
Review comment:
`tc.EdgeTypePrefix` instead of "EDGE"
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]