8936: update go tests to use a blob-signature-ttl different than 1s.
authorradhika <radhika@curoverse.com>
Thu, 21 Apr 2016 17:04:59 +0000 (13:04 -0400)
committerradhika <radhika@curoverse.com>
Thu, 21 Apr 2016 17:04:59 +0000 (13:04 -0400)
sdk/go/keepclient/perms_test.go
services/api/test/unit/blob_test.rb
services/keepstore/keepstore.go
services/keepstore/perms_test.go
tools/keep-block-check/keep-block-check.go
tools/keep-rsync/keep-rsync.go

index 8670f2b01a3ce3491f2709231eb1ed0e8c2553a4..242b15c0a6e4d33f6b1977a22fb0555737773884 100644 (file)
@@ -16,11 +16,11 @@ const (
                "gokee3eamvjy8qq1fvy238838enjmy5wzy2md7yvsitp5vztft6j4q866efym7e6" +
                "vu5wm9fpnwjyxfldw3vbo01mgjs75rgo7qioh8z8ij7jpyp8508okhgbbex3ceei" +
                "786u5rw2a9gx743dj3fgq2irk"
                "gokee3eamvjy8qq1fvy238838enjmy5wzy2md7yvsitp5vztft6j4q866efym7e6" +
                "vu5wm9fpnwjyxfldw3vbo01mgjs75rgo7qioh8z8ij7jpyp8508okhgbbex3ceei" +
                "786u5rw2a9gx743dj3fgq2irk"
-       knownSignature     = "44362129a92a48d02b2e0789c597f970f3b1faf3"
+       knownSignature     = "89118b78732c33104a4d6231e8b5a5fa1e4301e3"
        knownTimestamp     = "7fffffff"
        knownSigHint       = "+A" + knownSignature + "@" + knownTimestamp
        knownSignedLocator = knownLocator + knownSigHint
        knownTimestamp     = "7fffffff"
        knownSigHint       = "+A" + knownSignature + "@" + knownTimestamp
        knownSignedLocator = knownLocator + knownSigHint
-       blobSignatureTTL   = time.Second
+       blobSignatureTTL   = 1209600 * time.Second
 )
 
 func TestSignLocator(t *testing.T) {
 )
 
 func TestSignLocator(t *testing.T) {
index 29635e240c16d3a50cd280a3e1402349b088e397..8692a739b93616e63178f79c06e56abdb62349fe 100644 (file)
@@ -18,10 +18,11 @@ class BlobTest < ActiveSupport::TestCase
     '786u5rw2a9gx743dj3fgq2irk'
   @@known_signed_locator = 'acbd18db4cc2f85cedef654fccc4a4d8+3' +
     '+A89118b78732c33104a4d6231e8b5a5fa1e4301e3@7fffffff'
     '786u5rw2a9gx743dj3fgq2irk'
   @@known_signed_locator = 'acbd18db4cc2f85cedef654fccc4a4d8+3' +
     '+A89118b78732c33104a4d6231e8b5a5fa1e4301e3@7fffffff'
+  @@known_signature_ttl = 1209600
 
   test 'generate predictable invincible signature' do
     original_ttl = Rails.configuration.blob_signature_ttl
 
   test 'generate predictable invincible signature' do
     original_ttl = Rails.configuration.blob_signature_ttl
-    Rails.configuration.blob_signature_ttl = 1209600
+    Rails.configuration.blob_signature_ttl = @@known_signature_ttl
     signed = Blob.sign_locator @@known_locator, {
       api_token: @@known_token,
       key: @@known_key,
     signed = Blob.sign_locator @@known_locator, {
       api_token: @@known_token,
       key: @@known_key,
@@ -33,7 +34,7 @@ class BlobTest < ActiveSupport::TestCase
 
   test 'verify predictable invincible signature' do
     original_ttl = Rails.configuration.blob_signature_ttl
 
   test 'verify predictable invincible signature' do
     original_ttl = Rails.configuration.blob_signature_ttl
-    Rails.configuration.blob_signature_ttl = 1209600
+    Rails.configuration.blob_signature_ttl = @@known_signature_ttl
     assert_equal true, Blob.verify_signature!(@@known_signed_locator,
                                               api_token: @@known_token,
                                               key: @@known_key)
     assert_equal true, Blob.verify_signature!(@@known_signed_locator,
                                               api_token: @@known_token,
                                               key: @@known_key)
@@ -133,7 +134,7 @@ class BlobTest < ActiveSupport::TestCase
     }
 
     original_ttl = Rails.configuration.blob_signature_ttl
     }
 
     original_ttl = Rails.configuration.blob_signature_ttl
-    Rails.configuration.blob_signature_ttl = original_ttl*2
+    Rails.configuration.blob_signature_ttl = @@known_signature_ttl*2
     signed2 = Blob.sign_locator @@known_locator, {
       api_token: @@known_token,
       key: @@known_key,
     signed2 = Blob.sign_locator @@known_locator, {
       api_token: @@known_token,
       key: @@known_key,
index b3cc234539e44ce4461233dca8cbce0e4ed3a528..b17cc79e17d5bf540894801b648f5d60d4d5bdc9 100644 (file)
@@ -189,7 +189,7 @@ func main() {
                &permissionTTLSec,
                "blob-signature-ttl",
                int(time.Duration(2*7*24*time.Hour).Seconds()),
                &permissionTTLSec,
                "blob-signature-ttl",
                int(time.Duration(2*7*24*time.Hour).Seconds()),
-               "Lifetime of blob permission signatures. Modifying the ttl will invalidate all existing signatures"+
+               "Lifetime of blob permission signatures. Modifying the ttl will invalidate all existing signatures"+
                        "See services/api/config/application.default.yml.")
        flag.BoolVar(
                &flagSerializeIO,
                        "See services/api/config/application.default.yml.")
        flag.BoolVar(
                &flagSerializeIO,
index c8289c2565e8a1edc5fdaf93e025816c2c4a613b..43717b23720d8c71b32c126810f8e39dd41a0429 100644 (file)
@@ -17,7 +17,8 @@ const (
                "gokee3eamvjy8qq1fvy238838enjmy5wzy2md7yvsitp5vztft6j4q866efym7e6" +
                "vu5wm9fpnwjyxfldw3vbo01mgjs75rgo7qioh8z8ij7jpyp8508okhgbbex3ceei" +
                "786u5rw2a9gx743dj3fgq2irk"
                "gokee3eamvjy8qq1fvy238838enjmy5wzy2md7yvsitp5vztft6j4q866efym7e6" +
                "vu5wm9fpnwjyxfldw3vbo01mgjs75rgo7qioh8z8ij7jpyp8508okhgbbex3ceei" +
                "786u5rw2a9gx743dj3fgq2irk"
-       knownSignature     = "44362129a92a48d02b2e0789c597f970f3b1faf3"
+       knownSignatureTTL  = 1209600 * time.Second
+       knownSignature     = "89118b78732c33104a4d6231e8b5a5fa1e4301e3"
        knownTimestamp     = "7fffffff"
        knownSigHint       = "+A" + knownSignature + "@" + knownTimestamp
        knownSignedLocator = knownLocator + knownSigHint
        knownTimestamp     = "7fffffff"
        knownSigHint       = "+A" + knownSignature + "@" + knownTimestamp
        knownSignedLocator = knownLocator + knownSigHint
@@ -34,7 +35,7 @@ func TestSignLocator(t *testing.T) {
        }
        t0 := time.Unix(tsInt, 0)
 
        }
        t0 := time.Unix(tsInt, 0)
 
-       blobSignatureTTL = time.Second
+       blobSignatureTTL = knownSignatureTTL
 
        PermissionSecret = []byte(knownKey)
        if x := SignLocator(knownLocator, knownToken, t0); x != knownSignedLocator {
 
        PermissionSecret = []byte(knownKey)
        if x := SignLocator(knownLocator, knownToken, t0); x != knownSignedLocator {
@@ -52,7 +53,7 @@ func TestVerifyLocator(t *testing.T) {
                PermissionSecret = b
        }(PermissionSecret)
 
                PermissionSecret = b
        }(PermissionSecret)
 
-       blobSignatureTTL = time.Second
+       blobSignatureTTL = knownSignatureTTL
 
        PermissionSecret = []byte(knownKey)
        if err := VerifySignature(knownSignedLocator, knownToken); err != nil {
 
        PermissionSecret = []byte(knownKey)
        if err := VerifySignature(knownSignedLocator, knownToken); err != nil {
index f27a4bc4c1af221b455b6ca4066ff4a85960839a..569046b70f4c3969dbabde049ffcbed2044dd454 100644 (file)
@@ -49,7 +49,7 @@ func doMain(args []string) error {
                "Block hash prefix. When a prefix is specified, only hashes listed in the file with this prefix will be checked.")
 
        blobSignatureTTL := flags.Duration(
                "Block hash prefix. When a prefix is specified, only hashes listed in the file with this prefix will be checked.")
 
        blobSignatureTTL := flags.Duration(
-               "blob-signing-ttl",
+               "blob-signature-ttl",
                0,
                "Lifetime of blob permission signatures on the keepservers. If not provided, this will be retrieved from the API server's discovery document.")
 
                0,
                "Lifetime of blob permission signatures on the keepservers. If not provided, this will be retrieved from the API server's discovery document.")
 
index 912238c3fb50359469a3406059c3b9502d758a49..36f73204359736286f40aa9a753aa104428df7e0 100644 (file)
@@ -61,7 +61,7 @@ func doMain() error {
                "Index prefix")
 
        srcBlobSignatureTTL := flags.Duration(
                "Index prefix")
 
        srcBlobSignatureTTL := flags.Duration(
-               "blob-signing-ttl",
+               "src-blob-signature-ttl",
                0,
                "Lifetime of blob permission signatures on source keepservers. If not provided, this will be retrieved from the API server's discovery document.")
 
                0,
                "Lifetime of blob permission signatures on source keepservers. If not provided, this will be retrieved from the API server's discovery document.")