Merge branch 'master' into 7492-keepproxy-upstream-errors
[arvados.git] / tools / keep-rsync / keep-rsync_test.go
index f1091887d5f50ae71a416a6ffb73ae55fc081b3a..143e1552272ae1e5f09dd2224861e3309d83d743 100644 (file)
@@ -4,6 +4,7 @@ import (
        "crypto/md5"
        "fmt"
        "io/ioutil"
+       "log"
        "os"
        "strings"
        "testing"
@@ -59,7 +60,7 @@ func (s *ServerRequiredSuite) SetUpTest(c *C) {
 }
 
 func (s *ServerRequiredSuite) TearDownTest(c *C) {
-       arvadostest.StopKeepWithParams(3)
+       arvadostest.StopKeep(3)
 }
 
 func (s *DoMainTestSuite) SetUpTest(c *C) {
@@ -94,7 +95,7 @@ func setupRsync(c *C, enforcePermissions bool, replications int) {
        }
 
        // Start Keep servers
-       arvadostest.StartKeepWithParams(3, enforcePermissions)
+       arvadostest.StartKeep(3, enforcePermissions)
 
        // setup keepclients
        var err error
@@ -327,7 +328,8 @@ func (s *ServerRequiredSuite) TestErrorDuringRsync_FakeSrcKeepservers(c *C) {
        setupRsync(c, false, 1)
 
        err := performKeepRsync(kcSrc, kcDst, "", "")
-       c.Check(strings.HasSuffix(err.Error(), "no such host"), Equals, true)
+       log.Printf("Err = %v", err)
+       c.Check(strings.Contains(err.Error(), "no such host"), Equals, true)
 }
 
 // Setup rsync using dstKeepServicesJSON with fake keepservers.
@@ -338,7 +340,8 @@ func (s *ServerRequiredSuite) TestErrorDuringRsync_FakeDstKeepservers(c *C) {
        setupRsync(c, false, 1)
 
        err := performKeepRsync(kcSrc, kcDst, "", "")
-       c.Check(strings.HasSuffix(err.Error(), "no such host"), Equals, true)
+       log.Printf("Err = %v", err)
+       c.Check(strings.Contains(err.Error(), "no such host"), Equals, true)
 }
 
 // Test rsync with signature error during Get from src.
@@ -352,7 +355,7 @@ func (s *ServerRequiredSuite) TestErrorDuringRsync_ErrorGettingBlockFromSrc(c *C
        blobSigningKey = "thisisfakeblobsigningkey"
 
        err := performKeepRsync(kcSrc, kcDst, blobSigningKey, "")
-       c.Check(strings.HasSuffix(err.Error(), "Block not found"), Equals, true)
+       c.Check(strings.Contains(err.Error(), "HTTP 403 \"Forbidden\""), Equals, true)
 }
 
 // Test rsync with error during Put to src.
@@ -421,6 +424,7 @@ func setupConfigFile(c *C, name string) *os.File {
        fileContent := "ARVADOS_API_HOST=" + os.Getenv("ARVADOS_API_HOST") + "\n"
        fileContent += "ARVADOS_API_TOKEN=" + os.Getenv("ARVADOS_API_TOKEN") + "\n"
        fileContent += "ARVADOS_API_HOST_INSECURE=" + os.Getenv("ARVADOS_API_HOST_INSECURE") + "\n"
+       fileContent += "ARVADOS_EXTERNAL_CLIENT=false\n"
        fileContent += "ARVADOS_BLOB_SIGNING_KEY=abcdefg"
 
        _, err = file.Write([]byte(fileContent))
@@ -468,7 +472,7 @@ func (s *DoMainTestSuite) Test_doMainWithSrcAndDstConfig(c *C) {
 
        // Start keepservers. Since we are not doing any tweaking as in setupRsync func,
        // kcSrc and kcDst will be the same and no actual copying to dst will happen, but that's ok.
-       arvadostest.StartKeep()
+       arvadostest.StartKeep(2, false)
 
        err := doMain()
        c.Check(err, IsNil)