X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/e723b02bc8e5382575f27b0ce803f775adf6d479..82054f095dad0fb9d21842eac1cd9ade50ffc940:/lib/config/export_test.go?ds=sidebyside diff --git a/lib/config/export_test.go b/lib/config/export_test.go index e12fbdc7f6..f11b65f452 100644 --- a/lib/config/export_test.go +++ b/lib/config/export_test.go @@ -17,14 +17,15 @@ var _ = check.Suite(&ExportSuite{}) type ExportSuite struct{} func (s *ExportSuite) TestExport(c *check.C) { - confdata := strings.Replace(string(DefaultYAML), "SAMPLE", "testkey", -1) + confdata := strings.Replace(string(DefaultYAML), "SAMPLE", "12345", -1) cfg, err := testLoader(c, confdata, nil).Load() c.Assert(err, check.IsNil) - cluster := cfg.Clusters["xxxxx"] + cluster, err := cfg.GetCluster("xxxxx") + c.Assert(err, check.IsNil) cluster.ManagementToken = "abcdefg" var exported bytes.Buffer - err = ExportJSON(&exported, &cluster) + err = ExportJSON(&exported, cluster) c.Check(err, check.IsNil) if err != nil { c.Logf("If all the new keys are safe, add these to whitelist in export.go:") @@ -32,5 +33,7 @@ func (s *ExportSuite) TestExport(c *check.C) { c.Logf("\t%q: true,", strings.Replace(k, `"`, "", -1)) } } - c.Check(exported.String(), check.Not(check.Matches), `(?ms).*abcdefg.*`) + var exportedStr = exported.String() + c.Check(exportedStr, check.Matches, `(?ms).*ClusterID":"xxxxx.*`) + c.Check(exportedStr, check.Not(check.Matches), `(?ms).*abcdefg.*`) }