21037: fixed timers in auto-logout spec Arvados-DCO-1.1-Signed-off-by: Lisa Knox...
[arvados.git] / services / keep-web / s3_test.go
index 9f8650b8ede8a831df79ada8588be10e979a966a..79b3712c6b7a766efeb0b0c66ff2c8024e9771b0 100644 (file)
@@ -325,6 +325,11 @@ func (s *IntegrationSuite) TestS3ProjectPutObjectSuccess(c *check.C) {
        s.testS3PutObjectSuccess(c, stage.projbucket, stage.coll.Name+"/", stage.coll.UUID)
 }
 func (s *IntegrationSuite) testS3PutObjectSuccess(c *check.C, bucket *s3.Bucket, prefix string, collUUID string) {
+       // We insert a delay between test cases to ensure we exercise
+       // rollover of expired sessions.
+       sleep := time.Second / 100
+       s.handler.Cluster.Collections.WebDAVCache.TTL = arvados.Duration(sleep * 3)
+
        for _, trial := range []struct {
                path        string
                size        int
@@ -360,6 +365,7 @@ func (s *IntegrationSuite) testS3PutObjectSuccess(c *check.C, bucket *s3.Bucket,
                        contentType: "application/x-directory",
                },
        } {
+               time.Sleep(sleep)
                c.Logf("=== %v", trial)
 
                objname := prefix + trial.path
@@ -1289,7 +1295,11 @@ func (s *IntegrationSuite) TestS3cmd(c *check.C) {
        cmd = exec.Command("s3cmd", "--no-ssl", "--host="+s.testServer.URL[7:], "--host-bucket="+s.testServer.URL[7:], "--access_key="+arvadostest.ActiveTokenUUID, "--secret_key="+arvadostest.ActiveToken, "get", "s3://"+arvadostest.FooCollection+"/foo,;$[|]bar", tmpfile)
        buf, err = cmd.CombinedOutput()
        c.Check(err, check.NotNil)
-       c.Check(string(buf), check.Matches, `(?ms).*NoSuchKey.*\n`)
+       // As of commit b7520e5c25e1bf25c1a8bf5aa2eadb299be8f606
+       // (between debian bullseye and bookworm versions), s3cmd
+       // started catching the NoSuchKey error code and replacing it
+       // with "Source object '%s' does not exist.".
+       c.Check(string(buf), check.Matches, `(?ms).*(NoSuchKey|Source object.*does not exist).*\n`)
 }
 
 func (s *IntegrationSuite) TestS3BucketInHost(c *check.C) {