Merge branch '14715-keepprox-config'
[arvados.git] / services / keepproxy / keepproxy_test.go
index 609da4f7058dcc9b7a2aa5da98e1a3127dd990a8..d2758cc25f7ea3f92b35ec461f0d41c87958c72e 100644 (file)
@@ -13,7 +13,6 @@ import (
        "math/rand"
        "net/http"
        "net/http/httptest"
-       "os"
        "strings"
        "sync"
        "testing"
@@ -640,74 +639,3 @@ func (s *ServerRequiredSuite) TestPing(c *C) {
        c.Check(resp.Code, Equals, 200)
        c.Assert(resp.Body.String(), Matches, `{"health":"OK"}\n?`)
 }
-
-func (s *NoKeepServerSuite) TestLegacyConfig(c *C) {
-       content := []byte(fmtConfig("", true))
-       cluster, err := loadLegacyConfig(content, c)
-
-       c.Check(err, IsNil)
-       c.Check(cluster, NotNil)
-       c.Check(cluster.Services.Controller.ExternalURL, Equals, arvados.URL{Scheme: "https", Host: "example.com"})
-       c.Check(cluster.SystemRootToken, Equals, "abcdefg")
-       c.Check(cluster.ManagementToken, Equals, "xyzzy")
-       c.Check(cluster.Services.Keepproxy.InternalURLs[arvados.URL{Host: ":80"}], Equals, arvados.ServiceInstance{})
-       c.Check(cluster.Collections.DefaultReplication, Equals, 0)
-       c.Check(cluster.API.KeepServiceRequestTimeout.String(), Equals, "15s")
-       c.Check(cluster.SystemLogs.LogLevel, Equals, "debug")
-
-       content = []byte(fmtConfig("", false))
-       cluster, err = loadLegacyConfig(content, c)
-       c.Check(cluster.SystemLogs.LogLevel, Equals, "info")
-
-       content = []byte(fmtConfig(`"DisableGet": true,`, true))
-       _, err = loadLegacyConfig(content, c)
-       c.Check(err, NotNil)
-
-       content = []byte(fmtConfig(`"DisablePut": true,`, true))
-       _, err = loadLegacyConfig(content, c)
-       c.Check(err, NotNil)
-
-       content = []byte(fmtConfig(`"PIDFile": "test",`, true))
-       _, err = loadLegacyConfig(content, c)
-       c.Check(err, NotNil)
-
-       content = []byte(fmtConfig(`"DisableGet": false, "DisablePut": false, "PIDFile": "",`, true))
-       _, err = loadLegacyConfig(content, c)
-       c.Check(err, IsNil)
-
-}
-
-func loadLegacyConfig(content []byte, c *C) (*arvados.Cluster, error) {
-       tmpfile, err := ioutil.TempFile("", "example")
-       if err != nil {
-               c.Error(err)
-       }
-       defer os.Remove(tmpfile.Name())
-
-       if _, err := tmpfile.Write(content); err != nil {
-               c.Error(err)
-       }
-       if err := tmpfile.Close(); err != nil {
-               c.Error(err)
-       }
-       return configure(log.New(), []string{"keepproxy", "-config", tmpfile.Name()})
-}
-
-func fmtConfig(param string, debugLog bool) string {
-       return fmt.Sprintf(`
-{
-       "Client": {
-               "Scheme": "",
-               "APIHost": "example.com",
-               "AuthToken": "abcdefg",
-               "Insecure": false
-       },
-       "Listen": ":80",
-       "DefaultReplicas": 0,
-       "Timeout": "15s",
-       "Debug": %t,
-       %s
-       "ManagementToken": "xyzzy"
-}
-`, debugLog, param)
-}