X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/11127c5b67a10a46f60c1c1c53a2c2639b7914e1..b8f92203bfa5766f9aa8bfb728bb4a1580e7d6d1:/services/keep-web/cadaver_test.go?ds=sidebyside diff --git a/services/keep-web/cadaver_test.go b/services/keep-web/cadaver_test.go index 991e92368f..d4a89c844b 100644 --- a/services/keep-web/cadaver_test.go +++ b/services/keep-web/cadaver_test.go @@ -11,6 +11,8 @@ import ( "net/url" "os" "os/exec" + "strings" + "time" "git.curoverse.com/arvados.git/sdk/go/arvados" "git.curoverse.com/arvados.git/sdk/go/arvadostest" @@ -40,6 +42,10 @@ func (s *IntegrationSuite) TestWebdavWithCadaver(c *check.C) { c.Assert(err, check.IsNil) writePath := "/c=" + newCollection.UUID + "/t=" + arv.AuthToken + "/" + pdhPath := "/c=" + strings.Replace(arvadostest.FooAndBarFilesInDirPDH, "+", "-", -1) + "/t=" + arv.AuthToken + "/" + + matchToday := time.Now().Format("Jan +2") + readPath := "/c=" + arvadostest.FooAndBarFilesInDirUUID + "/t=" + arvadostest.ActiveToken + "/" type testcase struct { path string @@ -66,7 +72,7 @@ func (s *IntegrationSuite) TestWebdavWithCadaver(c *check.C) { { path: readPath + "dir1/", cmd: "ls\n", - match: `(?ms).*bar *3.*foo *3 .*`, + match: `(?ms).*bar *3.*foo +3 +Feb +\d+ +2014.*`, }, { path: writePath, @@ -97,22 +103,18 @@ func (s *IntegrationSuite) TestWebdavWithCadaver(c *check.C) { }, { path: writePath, - cmd: "move testfile newdir0\n", + cmd: "move testfile newdir0/\n", match: `(?ms).*Moving .* succeeded.*`, }, { - // Strangely, webdav deletes dst if you do - // "move nonexistent dst" -- otherwise we - // would repeat the above "move testfile - // newdir0" here. path: writePath, - cmd: "move testfile nonexistentdir\n", + cmd: "move testfile newdir0/\n", match: `(?ms).*Moving .* failed.*`, }, { path: writePath, cmd: "ls\n", - match: `(?ms).*newdir0.* 0 .*`, + match: `(?ms).*newdir0.* 0 +` + matchToday + ` \d+:\d+\n.*`, }, { path: writePath, @@ -126,7 +128,7 @@ func (s *IntegrationSuite) TestWebdavWithCadaver(c *check.C) { }, { path: writePath, - cmd: "move newdir0/testfile newdir1\n", + cmd: "move newdir0/testfile newdir1/\n", match: `(?ms).*Moving .* succeeded.*`, }, { @@ -144,6 +146,17 @@ func (s *IntegrationSuite) TestWebdavWithCadaver(c *check.C) { cmd: "put '" + localfile.Name() + "' newdir2/testfile2\n", match: `(?ms).*Uploading .* succeeded.*`, }, + { + path: writePath, + cmd: "copy newdir2/testfile2 testfile3\n", + match: `(?ms).*succeeded.*`, + }, + { + path: writePath, + cmd: "get testfile3 '" + checkfile.Name() + "'\n", + match: `(?ms).*succeeded.*`, + data: testdata, + }, { path: writePath, cmd: "get newdir2/testfile2 '" + checkfile.Name() + "'\n", @@ -160,6 +173,31 @@ func (s *IntegrationSuite) TestWebdavWithCadaver(c *check.C) { cmd: "get newdir2/testfile2 '" + checkfile.Name() + "'\n", match: `(?ms).*Downloading .* failed.*`, }, + { + path: "/c=" + arvadostest.UserAgreementCollection + "/t=" + arv.AuthToken + "/", + cmd: "put '" + localfile.Name() + "' foo\n", + match: `(?ms).*Uploading .* failed:.*403 Forbidden.*`, + }, + { + path: pdhPath, + cmd: "put '" + localfile.Name() + "' foo\n", + match: `(?ms).*Uploading .* failed:.*405 Method Not Allowed.*`, + }, + { + path: pdhPath, + cmd: "move foo bar\n", + match: `(?ms).*Moving .* failed:.*405 Method Not Allowed.*`, + }, + { + path: pdhPath, + cmd: "copy foo bar\n", + match: `(?ms).*Copying .* failed:.*405 Method Not Allowed.*`, + }, + { + path: pdhPath, + cmd: "delete foo\n", + match: `(?ms).*Deleting .* failed:.*405 Method Not Allowed.*`, + }, } { c.Logf("%s %+v", "http://"+s.testServer.Addr, trial)