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/08/06 15:48:32 UTC
[trafficcontrol] 03/08: Add API integration tests for cachegroup
localizationMethods
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 b84138971bc8f0f3691f25ea457c7b87ad9700b8
Author: Rawlin Peters <ra...@comcast.com>
AuthorDate: Mon Jul 16 14:41:09 2018 -0600
Add API integration tests for cachegroup localizationMethods
---
traffic_ops/testing/api/v13/cachegroups_test.go | 21 +++++++++++++++++++++
traffic_ops/testing/api/v13/tc-fixtures.json | 5 +++++
2 files changed, 26 insertions(+)
diff --git a/traffic_ops/testing/api/v13/cachegroups_test.go b/traffic_ops/testing/api/v13/cachegroups_test.go
index 9b6a0c1..9eccb1a 100644
--- a/traffic_ops/testing/api/v13/cachegroups_test.go
+++ b/traffic_ops/testing/api/v13/cachegroups_test.go
@@ -17,6 +17,7 @@ package v13
import (
"fmt"
+ "reflect"
"testing"
"github.com/apache/trafficcontrol/lib/go-log"
@@ -157,6 +158,26 @@ func UpdateTestCacheGroups(t *testing.T) {
failed = true
}
+ // test localizationMethods
+ expectedMethods := []tc.LocalizationMethod{tc.LocalizationMethodGeo}
+ cg.LocalizationMethods = expectedMethods
+ 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 !reflect.DeepEqual(expectedMethods, cg.LocalizationMethods) {
+ t.Errorf("failed to update localizationMethods (expected = %v, actual = %v\n", expectedMethods, cg.LocalizationMethods)
+ failed = true
+ }
+
if !failed {
log.Debugln("UpdateTestCacheGroups() PASSED: ")
}
diff --git a/traffic_ops/testing/api/v13/tc-fixtures.json b/traffic_ops/testing/api/v13/tc-fixtures.json
index e1b2212..e9cdfd9 100644
--- a/traffic_ops/testing/api/v13/tc-fixtures.json
+++ b/traffic_ops/testing/api/v13/tc-fixtures.json
@@ -38,6 +38,11 @@
"parentCachegroupName": "parentCachegroup",
"secondaryParentCachegroupName": "secondaryCachegroup",
"shortName": "cg1",
+ "localizationMethods": [
+ "CZ",
+ "DEEP_CZ",
+ "GEO"
+ ],
"typeName": "EDGE_LOC"
},
{