Fix another wb2 integration test typo, refs #9964
[arvados.git] / lib / config / deprecated_test.go
index 595e4c9cad4e849c21d6f3d6b4c11b6b6d4b51ac..0feeec5e55cf3bb96a8baaac5337c80f9f8d0d82 100644 (file)
@@ -35,7 +35,9 @@ func testLoadLegacyConfig(content []byte, mungeFlag string, c *check.C) (*arvado
        ldr := testLoader(c, "Clusters: {zzzzz: {}}", nil)
        ldr.SetupFlags(flags)
        args := ldr.MungeLegacyConfigArgs(ldr.Logger, []string{"-config", tmpfile.Name()}, mungeFlag)
        ldr := testLoader(c, "Clusters: {zzzzz: {}}", nil)
        ldr.SetupFlags(flags)
        args := ldr.MungeLegacyConfigArgs(ldr.Logger, []string{"-config", tmpfile.Name()}, mungeFlag)
-       flags.Parse(args)
+       err = flags.Parse(args)
+       c.Assert(err, check.IsNil)
+       c.Assert(flags.NArg(), check.Equals, 0)
        cfg, err := ldr.Load()
        if err != nil {
                return nil, err
        cfg, err := ldr.Load()
        if err != nil {
                return nil, err
@@ -47,6 +49,26 @@ func testLoadLegacyConfig(content []byte, mungeFlag string, c *check.C) (*arvado
        return cluster, nil
 }
 
        return cluster, nil
 }
 
+func (s *LoadSuite) TestOldEmailConfiguration(c *check.C) {
+       logs := checkEquivalent(c, `
+Clusters:
+ z1111:
+  Mail:
+    SendUserSetupNotificationEmail: false
+    SupportEmailAddress: "support@example.invalid"
+`, `
+Clusters:
+ z1111:
+  Users:
+    SendUserSetupNotificationEmail: false
+    SupportEmailAddress: "support@example.invalid"
+`)
+       c.Check(logs, check.Matches, `(?ms).*deprecated or unknown config entry: .*Mail\.SendUserSetupNotificationEmail.*`)
+       c.Check(logs, check.Matches, `(?ms).*deprecated or unknown config entry: .*Mail\.SupportEmailAddress.*`)
+       c.Check(logs, check.Matches, `(?ms).*using your old config key Mail\.SendUserSetupNotificationEmail -- but you should rename it to Users\.SendUserSetupNotificationEmail.*`)
+       c.Check(logs, check.Matches, `(?ms).*using your old config key Mail\.SupportEmailAddress -- but you should rename it to Users\.SupportEmailAddress.*`)
+}
+
 func (s *LoadSuite) TestLegacyVolumeDriverParameters(c *check.C) {
        logs := checkEquivalent(c, `
 Clusters:
 func (s *LoadSuite) TestLegacyVolumeDriverParameters(c *check.C) {
        logs := checkEquivalent(c, `
 Clusters:
@@ -197,10 +219,7 @@ func (s *LoadSuite) TestLegacyKeepWebConfig(c *check.C) {
        c.Check(cluster.SystemRootToken, check.Equals, "abcdefg")
 
        c.Check(cluster.Collections.WebDAVCache.TTL, check.Equals, arvados.Duration(60*time.Second))
        c.Check(cluster.SystemRootToken, check.Equals, "abcdefg")
 
        c.Check(cluster.Collections.WebDAVCache.TTL, check.Equals, arvados.Duration(60*time.Second))
-       c.Check(cluster.Collections.WebDAVCache.UUIDTTL, check.Equals, arvados.Duration(time.Second))
-       c.Check(cluster.Collections.WebDAVCache.MaxCollectionEntries, check.Equals, 42)
-       c.Check(cluster.Collections.WebDAVCache.MaxCollectionBytes, check.Equals, int64(1234567890))
-       c.Check(cluster.Collections.WebDAVCache.MaxUUIDEntries, check.Equals, 100)
+       c.Check(cluster.Collections.WebDAVCache.MaxCollectionBytes, check.Equals, arvados.ByteSize(1234567890))
 
        c.Check(cluster.Services.WebDAVDownload.ExternalURL, check.Equals, arvados.URL{Host: "download.example.com", Path: "/"})
        c.Check(cluster.Services.WebDAVDownload.InternalURLs[arvados.URL{Host: ":80"}], check.NotNil)
 
        c.Check(cluster.Services.WebDAVDownload.ExternalURL, check.Equals, arvados.URL{Host: "download.example.com", Path: "/"})
        c.Check(cluster.Services.WebDAVDownload.InternalURLs[arvados.URL{Host: ":80"}], check.NotNil)
@@ -284,52 +303,6 @@ func fmtKeepproxyConfig(param string, debugLog bool) string {
 `, debugLog, param)
 }
 
 `, debugLog, param)
 }
 
-func (s *LoadSuite) TestLegacyArvGitHttpdConfig(c *check.C) {
-       content := []byte(`
-{
-       "Client": {
-               "Scheme": "",
-               "APIHost": "example.com",
-               "AuthToken": "abcdefg",
-       },
-       "Listen": ":9000",
-       "GitCommand": "/test/git",
-       "GitoliteHome": "/test/gitolite",
-       "RepoRoot": "/test/reporoot",
-       "ManagementToken": "xyzzy"
-}
-`)
-       f := "-legacy-git-httpd-config"
-       cluster, err := testLoadLegacyConfig(content, f, c)
-
-       c.Assert(err, check.IsNil)
-       c.Assert(cluster, check.NotNil)
-       c.Check(cluster.Services.Controller.ExternalURL, check.Equals, arvados.URL{Scheme: "https", Host: "example.com", Path: "/"})
-       c.Check(cluster.SystemRootToken, check.Equals, "abcdefg")
-       c.Check(cluster.ManagementToken, check.Equals, "xyzzy")
-       c.Check(cluster.Git.GitCommand, check.Equals, "/test/git")
-       c.Check(cluster.Git.GitoliteHome, check.Equals, "/test/gitolite")
-       c.Check(cluster.Git.Repositories, check.Equals, "/test/reporoot")
-       c.Check(cluster.Services.Keepproxy.InternalURLs[arvados.URL{Host: ":9000"}], check.Equals, arvados.ServiceInstance{})
-}
-
-// Tests fix for https://dev.arvados.org/issues/15642
-func (s *LoadSuite) TestLegacyArvGitHttpdConfigDoesntDisableMissingItems(c *check.C) {
-       content := []byte(`
-{
-       "Client": {
-               "Scheme": "",
-               "APIHost": "example.com",
-               "AuthToken": "abcdefg",
-       }
-}
-`)
-       cluster, err := testLoadLegacyConfig(content, "-legacy-git-httpd-config", c)
-       c.Assert(err, check.IsNil)
-       // The resulting ManagementToken should be the one set up on the test server.
-       c.Check(cluster.ManagementToken, check.Equals, TestServerManagementToken)
-}
-
 func (s *LoadSuite) TestLegacyKeepBalanceConfig(c *check.C) {
        f := "-legacy-keepbalance-config"
        content := []byte(fmtKeepBalanceConfig(""))
 func (s *LoadSuite) TestLegacyKeepBalanceConfig(c *check.C) {
        f := "-legacy-keepbalance-config"
        content := []byte(fmtKeepBalanceConfig(""))