14086: Add tests to prove that keep-web can serve past collection versions.
authorLucas Di Pentima <ldipentima@veritasgenetics.com>
Mon, 15 Oct 2018 17:02:29 +0000 (14:02 -0300)
committerLucas Di Pentima <ldipentima@veritasgenetics.com>
Mon, 15 Oct 2018 17:02:29 +0000 (14:02 -0300)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima@veritasgenetics.com>

sdk/go/arvadostest/fixtures.go
services/api/test/fixtures/collections.yml
services/keep-web/handler_test.go
services/keep-web/server_test.go

index eb79b5b7d208a4d16e7cb8c660efc54c1d2142a7..114faf17b74e245aeaacf72aeaaf5bb6f8e5046a 100644 (file)
@@ -23,6 +23,7 @@ const (
        NonexistentCollection   = "zzzzz-4zz18-totallynotexist"
        HelloWorldCollection    = "zzzzz-4zz18-4en62shvi99lxd4"
        FooBarDirCollection     = "zzzzz-4zz18-foonbarfilesdir"
+       WazVersion1Collection   = "zzzzz-4zz18-25k12570yk1ver1"
        UserAgreementPDH        = "b519d9cb706a29fc7ea24dbea2f05851+93"
        FooPdh                  = "1f4b0bc7583c2a7f9102c395f4ffc5e3+45"
        HelloWorldPdh           = "55713e6a34081eb03609e7ad5fcad129+62"
index 62bb644c0d72da18db8a4566d830f9c91bec925f..29b486c452d4b01a353f364e2672dda2c2f5cee1 100644 (file)
@@ -99,14 +99,14 @@ w_a_z_file:
 w_a_z_file_version_1:
   uuid: zzzzz-4zz18-25k12570yk1ver1
   current_version_uuid: zzzzz-4zz18-25k12570yk134b3
-  portable_data_hash: 8706aadd12a0ebc07d74cae88762ba9e+56
+  portable_data_hash: ba4ba4c7b99a58806b1ed70ea1263afe+45
   owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
   created_at: 2015-02-09T10:53:38Z
   modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr
   modified_by_user_uuid: zzzzz-tpzed-d9tiejq69daie8f
   modified_at: 2015-02-09T10:53:38Z
   updated_at: 2015-02-09T10:53:38Z
-  manifest_text: ". 4c6c2c0ac8aa0696edd7316a3be5ca3c+5 0:5:w\\040\\141\\040z\n"
+  manifest_text: ". 4d20280d5e516a0109768d49ab0f3318+3 0:3:waz\n"
   name: "waz file"
   version: 1
 
index 4ea697bbed6883172bfc459b7df78f4d939f2c90..39fb87fbaa5f6f0de5aee86258114b10b6df8e6e 100644 (file)
@@ -350,6 +350,28 @@ func (s *IntegrationSuite) TestVhostRedirectQueryTokenSiteFS(c *check.C) {
        c.Check(resp.Header().Get("Content-Disposition"), check.Matches, "attachment(;.*)?")
 }
 
+func (s *IntegrationSuite) TestPastCollectionVersionFileAccess(c *check.C) {
+       s.testServer.Config.AttachmentOnlyHost = "download.example.com"
+       resp := s.testVhostRedirectTokenToCookie(c, "GET",
+               "download.example.com/c="+arvadostest.WazVersion1Collection+"/waz",
+               "?api_token="+arvadostest.ActiveToken,
+               "",
+               "",
+               http.StatusOK,
+               "waz",
+       )
+       c.Check(resp.Header().Get("Content-Disposition"), check.Matches, "attachment(;.*)?")
+       resp = s.testVhostRedirectTokenToCookie(c, "GET",
+               "download.example.com/by_id/"+arvadostest.WazVersion1Collection+"/waz",
+               "?api_token="+arvadostest.ActiveToken,
+               "",
+               "",
+               http.StatusOK,
+               "waz",
+       )
+       c.Check(resp.Header().Get("Content-Disposition"), check.Matches, "attachment(;.*)?")
+}
+
 func (s *IntegrationSuite) TestVhostRedirectQueryTokenTrustAllContent(c *check.C) {
        s.testServer.Config.TrustAllContent = true
        s.testVhostRedirectTokenToCookie(c, "GET",
@@ -656,6 +678,18 @@ func (s *IntegrationSuite) TestDirectoryListing(c *check.C) {
                        header: authHeader,
                        expect: nil,
                },
+               {
+                       uri:     "download.example.com/c=" + arvadostest.WazVersion1Collection,
+                       header:  authHeader,
+                       expect:  []string{"waz"},
+                       cutDirs: 1,
+               },
+               {
+                       uri:     "download.example.com/by_id/" + arvadostest.WazVersion1Collection,
+                       header:  authHeader,
+                       expect:  []string{"waz"},
+                       cutDirs: 2,
+               },
        } {
                c.Logf("HTML: %q => %q", trial.uri, trial.expect)
                resp := httptest.NewRecorder()
index 7e738cb9f3467a63c5da91cbac253429f0dc5cad..2a8f8cd79421699b3bfcbef2a704d19bde5e7282 100644 (file)
@@ -403,6 +403,7 @@ func (s *IntegrationSuite) SetUpSuite(c *check.C) {
        kc.PutB([]byte("Hello world\n"))
        kc.PutB([]byte("foo"))
        kc.PutB([]byte("foobar"))
+       kc.PutB([]byte("waz"))
 }
 
 func (s *IntegrationSuite) TearDownSuite(c *check.C) {