Merge branch '17529-ec2-rate-limit'
[arvados.git] / lib / controller / handler_test.go
index c7bce97130bfb0e4b327d3d2233a41d9c9c3b73d..935208fc4e621c7c8040e09a1381e39c949e0232 100644 (file)
@@ -26,13 +26,9 @@ import (
        check "gopkg.in/check.v1"
 )
 
-var forceLegacyAPI14 bool
-
 // Gocheck boilerplate
 func Test(t *testing.T) {
-       for _, forceLegacyAPI14 = range []bool{false, true} {
-               check.TestingT(t)
-       }
+       check.TestingT(t)
 }
 
 var _ = check.Suite(&HandlerSuite{})
@@ -48,10 +44,10 @@ func (s *HandlerSuite) SetUpTest(c *check.C) {
        s.ctx, s.cancel = context.WithCancel(context.Background())
        s.ctx = ctxlog.Context(s.ctx, ctxlog.New(os.Stderr, "json", "debug"))
        s.cluster = &arvados.Cluster{
-               ClusterID:        "zzzzz",
-               PostgreSQL:       integrationTestCluster().PostgreSQL,
-               ForceLegacyAPI14: forceLegacyAPI14,
+               ClusterID:  "zzzzz",
+               PostgreSQL: integrationTestCluster().PostgreSQL,
        }
+       s.cluster.API.RequestTimeout = arvados.Duration(5 * time.Minute)
        s.cluster.TLS.Insecure = true
        arvadostest.SetServiceURL(&s.cluster.Services.RailsAPI, "https://"+os.Getenv("ARVADOS_TEST_API_HOST"))
        arvadostest.SetServiceURL(&s.cluster.Services.Controller, "http://localhost:/")
@@ -197,10 +193,6 @@ func (s *HandlerSuite) TestLogoutSSO(c *check.C) {
 }
 
 func (s *HandlerSuite) TestLogoutGoogle(c *check.C) {
-       if s.cluster.ForceLegacyAPI14 {
-               // Google login N/A
-               return
-       }
        s.cluster.Login.Google.Enable = true
        s.cluster.Login.Google.ClientID = "test"
        req := httptest.NewRequest("GET", "https://0.0.0.0:1/logout?return_to=https://example.com/foo", nil)
@@ -293,6 +285,8 @@ func (s *HandlerSuite) CheckObjectType(c *check.C, url string, token string, ski
        }
        resp2, err := client.Get(s.cluster.Services.RailsAPI.ExternalURL.String() + url + "/?api_token=" + token)
        c.Check(err, check.Equals, nil)
+       c.Assert(resp2.StatusCode, check.Equals, http.StatusOK,
+               check.Commentf("Wasn't able to get data from the RailsAPI at %q", url))
        defer resp2.Body.Close()
        db, err := ioutil.ReadAll(resp2.Body)
        c.Check(err, check.Equals, nil)
@@ -333,7 +327,7 @@ func (s *HandlerSuite) TestGetObjects(c *check.C) {
                "api_clients/" + arvadostest.TrustedWorkbenchAPIClientUUID:     nil,
                "api_client_authorizations/" + arvadostest.AdminTokenUUID:      nil,
                "authorized_keys/" + arvadostest.AdminAuthorizedKeysUUID:       nil,
-               "collections/" + arvadostest.CollectionWithUniqueWordsUUID:     map[string]bool{"href": true},
+               "collections/" + arvadostest.CollectionWithUniqueWordsUUID:     {"href": true},
                "containers/" + arvadostest.RunningContainerUUID:               nil,
                "container_requests/" + arvadostest.QueuedContainerRequestUUID: nil,
                "groups/" + arvadostest.AProjectUUID:                           nil,
@@ -342,7 +336,7 @@ func (s *HandlerSuite) TestGetObjects(c *check.C) {
                "logs/" + arvadostest.CrunchstatForRunningJobLogUUID:           nil,
                "nodes/" + arvadostest.IdleNodeUUID:                            nil,
                "repositories/" + arvadostest.ArvadosRepoUUID:                  nil,
-               "users/" + arvadostest.ActiveUserUUID:                          map[string]bool{"href": true},
+               "users/" + arvadostest.ActiveUserUUID:                          {"href": true},
                "virtual_machines/" + arvadostest.TestVMUUID:                   nil,
                "workflows/" + arvadostest.WorkflowWithDefinitionYAMLUUID:      nil,
        }