[ARVADOS] updated: f5348ab8671390e85956a9b78c5810be7c01e81e

Git user git at public.curoverse.com
Thu Apr 7 09:51:25 EDT 2016


Summary of changes:
 tools/keep-block-check/keep-block-check_test.go | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

       via  f5348ab8671390e85956a9b78c5810be7c01e81e (commit)
      from  f1e315aa701757ee8bf497805033b039b21515ba (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit f5348ab8671390e85956a9b78c5810be7c01e81e
Author: radhika <radhika at curoverse.com>
Date:   Thu Apr 7 09:51:06 2016 -0400

    8724: test assertion improvements

diff --git a/tools/keep-block-check/keep-block-check_test.go b/tools/keep-block-check/keep-block-check_test.go
index 0c56e55..8f8b927 100644
--- a/tools/keep-block-check/keep-block-check_test.go
+++ b/tools/keep-block-check/keep-block-check_test.go
@@ -147,16 +147,16 @@ func setupBlockHashFile(c *C, name string, blocks []string) string {
 	return file.Name()
 }
 
-func checkErrorLog(c *C, blocks []string, msg string) {
+func checkErrorLog(c *C, blocks []string, prefix, suffix string) {
 	buf, _ := ioutil.ReadFile(tempLogFileName)
 	if len(blocks) == 0 {
-		expected := `HEAD .*` + msg
+		expected := prefix + `.*` + suffix
 		match, _ := regexp.MatchString(expected, string(buf))
 		c.Assert(match, Equals, false)
 		return
 	}
 	for _, hash := range blocks {
-		expected := hash + `.*` + msg
+		expected := prefix + `.*` + hash + `.*` + suffix
 		match, _ := regexp.MatchString(expected, string(buf))
 		c.Assert(match, Equals, true)
 	}
@@ -166,35 +166,35 @@ func (s *ServerRequiredSuite) TestBlockCheck(c *C) {
 	setupKeepBlockCheck(c, false)
 	setupTestData(c)
 	performKeepBlockCheck(kc, blobSigningKey, "", allLocators)
-	checkErrorLog(c, []string{}, "Block not found") // no errors
+	checkErrorLog(c, []string{}, "head", "Block not found") // no errors
 }
 
 func (s *ServerRequiredSuite) TestBlockCheckWithBlobSigning(c *C) {
 	setupKeepBlockCheck(c, true)
 	setupTestData(c)
 	performKeepBlockCheck(kc, blobSigningKey, "", allLocators)
-	checkErrorLog(c, []string{}, "Block not found") // no errors
+	checkErrorLog(c, []string{}, "head", "Block not found") // no errors
 }
 
 func (s *ServerRequiredSuite) TestBlockCheck_NoSuchBlock(c *C) {
 	setupKeepBlockCheck(c, false)
 	setupTestData(c)
 	performKeepBlockCheck(kc, blobSigningKey, "", []string{TestHash, TestHash2})
-	checkErrorLog(c, []string{TestHash, TestHash2}, "Block not found")
+	checkErrorLog(c, []string{TestHash, TestHash2}, "head", "Block not found")
 }
 
 func (s *ServerRequiredSuite) TestBlockCheck_NoSuchBlock_WithMatchingPrefix(c *C) {
 	setupKeepBlockCheck(c, false)
 	setupTestData(c)
 	performKeepBlockCheck(kc, blobSigningKey, "aaa", []string{TestHash, TestHash2})
-	checkErrorLog(c, []string{TestHash, TestHash2}, "Block not found")
+	checkErrorLog(c, []string{TestHash, TestHash2}, "head", "Block not found")
 }
 
 func (s *ServerRequiredSuite) TestBlockCheck_NoSuchBlock_WithPrefixMismatch(c *C) {
 	setupKeepBlockCheck(c, false)
 	setupTestData(c)
 	performKeepBlockCheck(kc, blobSigningKey, "999", []string{TestHash, TestHash2})
-	checkErrorLog(c, []string{}, "Block not found") // no errors
+	checkErrorLog(c, []string{}, "head", "Block not found") // no errors
 }
 
 // Setup block-check using keepServicesJSON with fake keepservers.
@@ -203,14 +203,14 @@ func (s *ServerRequiredSuite) TestErrorDuringKeepBlockCheck_FakeKeepservers(c *C
 	keepServicesJSON = testKeepServicesJSON
 	setupKeepBlockCheck(c, false)
 	performKeepBlockCheck(kc, blobSigningKey, "", []string{TestHash, TestHash2})
-	checkErrorLog(c, []string{TestHash, TestHash2}, "timeout")
+	checkErrorLog(c, []string{TestHash, TestHash2}, "head", "no such host")
 }
 
 func (s *ServerRequiredSuite) TestBlockCheck_BadSignature(c *C) {
 	setupKeepBlockCheck(c, true)
 	setupTestData(c)
 	performKeepBlockCheck(kc, "badblobsigningkey", "", []string{TestHash, TestHash2})
-	checkErrorLog(c, []string{TestHash, TestHash2}, "HTTP 403")
+	checkErrorLog(c, []string{TestHash, TestHash2}, "head", "HTTP 403")
 }
 
 // Test keep-block-check initialization with keepServicesJSON
@@ -305,5 +305,5 @@ func (s *DoMainTestSuite) Test_doMain(c *C) {
 
 	err := doMain()
 	c.Check(err, IsNil)
-	checkErrorLog(c, []string{TestHash, TestHash2}, "Block not found")
+	checkErrorLog(c, []string{TestHash, TestHash2}, "head", "Block not found")
 }

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list