+
+func (s *serverSuite) TestLoadLegacyConfig(c *check.C) {
+ content := []byte(`
+Client:
+ APIHost: example.com
+ AuthToken: abcdefg
+Postgres:
+ "dbname": "arvados_production"
+ "user": "arvados"
+ "password": "xyzzy"
+ "host": "localhost"
+ "connect_timeout": "30"
+ "sslmode": "require"
+ "fallback_application_name": "arvados-ws"
+PostgresPool: 63
+Listen: ":8765"
+LogLevel: "debug"
+LogFormat: "text"
+PingTimeout: 61s
+ClientEventQueue: 62
+ServerEventQueue: 5
+ManagementToken: qqqqq
+`)
+ tmpfile, err := ioutil.TempFile("", "example")
+ if err != nil {
+ c.Error(err)
+ }
+
+ defer os.Remove(tmpfile.Name()) // clean up
+
+ if _, err := tmpfile.Write(content); err != nil {
+ c.Error(err)
+ }
+ if err := tmpfile.Close(); err != nil {
+ c.Error(err)
+
+ }
+ cluster := configure(logger(nil), []string{"arvados-ws", "-config", tmpfile.Name()})
+ c.Check(cluster, check.NotNil)
+
+ c.Check(cluster.Services.Controller.ExternalURL, check.Equals, arvados.URL{Scheme: "https", Host: "example.com"})
+ c.Check(cluster.SystemRootToken, check.Equals, "abcdefg")
+
+ c.Check(cluster.PostgreSQL.Connection, check.DeepEquals, arvados.PostgreSQLConnection{
+ "connect_timeout": "30",
+ "dbname": "arvados_production",
+ "fallback_application_name": "arvados-ws",
+ "host": "localhost",
+ "password": "xyzzy",
+ "sslmode": "require",
+ "user": "arvados"})
+ c.Check(cluster.PostgreSQL.ConnectionPool, check.Equals, 63)
+ c.Check(cluster.Services.Websocket.InternalURLs[arvados.URL{Host: ":8765"}], check.NotNil)
+ c.Check(cluster.SystemLogs.LogLevel, check.Equals, "debug")
+ c.Check(cluster.SystemLogs.Format, check.Equals, "text")
+ c.Check(cluster.API.SendTimeout, check.Equals, arvados.Duration(61*time.Second))
+ c.Check(cluster.API.WebsocketClientEventQueue, check.Equals, 62)
+ c.Check(cluster.API.WebsocketServerEventQueue, check.Equals, 5)
+ c.Check(cluster.ManagementToken, check.Equals, "qqqqq")
+}