dangogh closed pull request #2414: Fix go CRConfig edgelocations test
URL: https://github.com/apache/trafficcontrol/pull/2414
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/traffic_ops/traffic_ops_golang/crconfig/edgelocations_test.go
b/traffic_ops/traffic_ops_golang/crconfig/edgelocations_test.go
index a8b4918fe..aa78141af 100644
--- a/traffic_ops/traffic_ops_golang/crconfig/edgelocations_test.go
+++ b/traffic_ops/traffic_ops_golang/crconfig/edgelocations_test.go
@@ -40,14 +40,19 @@ func ExpectedMakeLocations()
(map[string]tc.CRConfigLatitudeLongitude, map[strin
}
func MockMakeLocations(mock sqlmock.Sqlmock, expectedEdgeLocs
map[string]tc.CRConfigLatitudeLongitude, expectedRouterLocs
map[string]tc.CRConfigLatitudeLongitude, cdn string) {
- rows := sqlmock.NewRows([]string{"name", "type", "latitude",
"longitude"})
+ rows := sqlmock.NewRows([]string{"name", "id", "type", "latitude",
"longitude", "fallback_to_closest"})
for s, l := range expectedEdgeLocs {
- rows = rows.AddRow(s, EdgeTypePrefix, l.Lat, l.Lon)
+ rows = rows.AddRow(s, 1, EdgeTypePrefix, l.Lat, l.Lon, false)
}
for s, l := range expectedRouterLocs {
- rows = rows.AddRow(s, RouterTypeName, l.Lat, l.Lon)
+ rows = rows.AddRow(s, 1, RouterTypeName, l.Lat, l.Lon, false)
}
mock.ExpectQuery("select").WithArgs(cdn).WillReturnRows(rows)
+
+ fallbackRows := sqlmock.NewRows([]string{"name"})
+ for range expectedEdgeLocs {
+
mock.ExpectQuery("select").WithArgs(1).WillReturnRows(fallbackRows)
+ }
}
func TestMakeLocations(t *testing.T) {
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services