X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/64c74f24fcdfbbef0e08b72c09d85c53390ca3b3..0a9d4fa5043bd7291611c41588bdd3f0b70ede44:/services/keep-web/cadaver_test.go diff --git a/services/keep-web/cadaver_test.go b/services/keep-web/cadaver_test.go index db5d373be7..e965a6e8c2 100644 --- a/services/keep-web/cadaver_test.go +++ b/services/keep-web/cadaver_test.go @@ -9,15 +9,14 @@ import ( "fmt" "io" "io/ioutil" - "net/url" "os" "os/exec" "path/filepath" "strings" "time" - "git.curoverse.com/arvados.git/sdk/go/arvados" - "git.curoverse.com/arvados.git/sdk/go/arvadostest" + "git.arvados.org/arvados.git/sdk/go/arvados" + "git.arvados.org/arvados.git/sdk/go/arvadostest" check "gopkg.in/check.v1" ) @@ -53,6 +52,8 @@ func (s *IntegrationSuite) TestCadaverUserProject(c *check.C) { } func (s *IntegrationSuite) testCadaver(c *check.C, password string, pathFunc func(arvados.Collection) (string, string, string), skip func(string) bool) { + s.testServer.Config.cluster.Users.AnonymousUserToken = arvadostest.AnonymousToken + testdata := []byte("the human tragedy consists in the necessity of living with the consequences of actions performed under the pressure of compulsions we do not understand") tempdir, err := ioutil.TempDir("", "keep-web-test-") @@ -72,7 +73,7 @@ func (s *IntegrationSuite) testCadaver(c *check.C, password string, pathFunc fun var newCollection arvados.Collection arv := arvados.NewClientFromEnv() arv.AuthToken = arvadostest.ActiveToken - err = arv.RequestAndDecode(&newCollection, "POST", "/arvados/v1/collections", bytes.NewBufferString(url.Values{"collection": {"{}"}}.Encode()), nil) + err = arv.RequestAndDecode(&newCollection, "POST", "arvados/v1/collections", nil, map[string]interface{}{"collection": map[string]interface{}{}}) c.Assert(err, check.IsNil) readPath, writePath, pdhPath := pathFunc(newCollection) @@ -133,6 +134,16 @@ func (s *IntegrationSuite) testCadaver(c *check.C, password string, pathFunc fun match: `(?ms).*succeeded.*`, data: testdata, }, + { + path: writePath, + cmd: "move testfile \"test &#!%20 file\"\n", + match: `(?ms).*Moving .* succeeded.*`, + }, + { + path: writePath, + cmd: "move \"test &#!%20 file\" testfile\n", + match: `(?ms).*Moving .* succeeded.*`, + }, { path: writePath, cmd: "move testfile newdir0/\n", @@ -143,6 +154,16 @@ func (s *IntegrationSuite) testCadaver(c *check.C, password string, pathFunc fun cmd: "move testfile newdir0/\n", match: `(?ms).*Moving .* failed.*`, }, + { + path: writePath, + cmd: "lock newdir0/testfile\n", + match: `(?ms).*Locking .* succeeded.*`, + }, + { + path: writePath, + cmd: "unlock newdir0/testfile\nasdf\n", + match: `(?ms).*Unlocking .* succeeded.*`, + }, { path: writePath, cmd: "ls\n", @@ -158,6 +179,16 @@ func (s *IntegrationSuite) testCadaver(c *check.C, password string, pathFunc fun cmd: "mkcol newdir1\n", match: `(?ms).*Creating .* succeeded.*`, }, + { + path: writePath, + cmd: "move newdir1/ newdir1x/\n", + match: `(?ms).*Moving .* succeeded.*`, + }, + { + path: writePath, + cmd: "move newdir1x newdir1\n", + match: `(?ms).*Moving .* succeeded.*`, + }, { path: writePath, cmd: "move newdir0/testfile newdir1/\n", @@ -241,6 +272,11 @@ func (s *IntegrationSuite) testCadaver(c *check.C, password string, pathFunc fun cmd: "delete foo\n", match: `(?ms).*Deleting .* failed:.*405 Method Not Allowed.*`, }, + { + path: pdhPath, + cmd: "lock foo\n", + match: `(?ms).*Locking .* failed:.*405 Method Not Allowed.*`, + }, } { c.Logf("%s %+v", "http://"+s.testServer.Addr, trial) if skip != nil && skip(trial.path) { @@ -271,8 +307,8 @@ func (s *IntegrationSuite) TestCadaverByID(c *check.C) { c.Check(stdout, check.Matches, `(?ms).*collection is empty.*`) } for _, path := range []string{ - "/by_id/" + arvadostest.FooPdh, - "/by_id/" + arvadostest.FooPdh + "/", + "/by_id/" + arvadostest.FooCollectionPDH, + "/by_id/" + arvadostest.FooCollectionPDH + "/", "/by_id/" + arvadostest.FooCollection, "/by_id/" + arvadostest.FooCollection + "/", } { @@ -314,7 +350,7 @@ func (s *IntegrationSuite) runCadaver(c *check.C, password, path, stdin string) // unauthenticated request, which it only does in // AttachmentOnlyHost, TrustAllContent, and // per-collection vhost cases. - s.testServer.Config.AttachmentOnlyHost = s.testServer.Addr + s.testServer.Config.cluster.Services.WebDAVDownload.ExternalURL.Host = s.testServer.Addr cmd.Env = append(os.Environ(), "HOME="+tempdir) f, err := os.OpenFile(filepath.Join(tempdir, ".netrc"), os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0600)