You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by de...@apache.org on 2018/07/09 20:28:47 UTC

[trafficcontrol] 02/02: Test cachegroup coordinate update in API tests

This is an automated email from the ASF dual-hosted git repository.

dewrich pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git

commit 39ef6d77878647aa4f51aac0cd8675c2484668fa
Author: Rawlin Peters <ra...@comcast.com>
AuthorDate: Mon Jul 9 07:59:54 2018 -0600

    Test cachegroup coordinate update in API tests
---
 traffic_ops/testing/api/v13/cachegroups_test.go | 28 +++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/traffic_ops/testing/api/v13/cachegroups_test.go b/traffic_ops/testing/api/v13/cachegroups_test.go
index 5dbef21..6e92d81 100644
--- a/traffic_ops/testing/api/v13/cachegroups_test.go
+++ b/traffic_ops/testing/api/v13/cachegroups_test.go
@@ -108,7 +108,35 @@ func UpdateTestCacheGroups(t *testing.T) {
 	cg = resp[0]
 	if cg.ShortName != expectedShortName {
 		t.Errorf("results do not match actual: %s, expected: %s\n", cg.ShortName, expectedShortName)
+		failed = true
+	}
+
+	// test coordinate updates
+	expectedLat := 7.0
+	expectedLong := 8.0
+	cg.Latitude = expectedLat
+	cg.Longitude = expectedLong
+	alert, _, err = TOSession.UpdateCacheGroupByID(cg.ID, cg)
+	if err != nil {
+		t.Errorf("cannot UPDATE CacheGroup by id: %v - %v\n", err, alert)
+		failed = true
+	}
+
+	resp, _, err = TOSession.GetCacheGroupByID(cg.ID)
+	if err != nil {
+		t.Errorf("cannot GET CacheGroup by id: '%d', %v\n", cg.ID, err)
+		failed = true
 	}
+	cg = resp[0]
+	if cg.Latitude != expectedLat {
+		t.Errorf("failed to update latitude (expected = %f, actual = %f)\n", expectedLat, cg.Latitude)
+		failed = true
+	}
+	if cg.Longitude != expectedLong {
+		t.Errorf("failed to update longitude (expected = %f, actual = %f)\n", expectedLong, cg.Longitude)
+		failed = true
+	}
+
 	if !failed {
 		log.Debugln("UpdateTestCacheGroups() PASSED: ")
 	}