@@ -15,23 +15,32 @@ func TestMigrationStep3(t *testing.T) {
15
15
sortKeys := []string {"0" , "1" , "2" , "3" }
16
16
17
17
// Successfully executes Step 3
18
- utils .HandleError (MigrationStep3 (kmsKeyID , tableName , partitionKey , sortKeys [3 ]))
18
+ err := MigrationStep3 (kmsKeyID , tableName , partitionKey , sortKeys [3 ])
19
+ utils .HandleError (err )
19
20
20
21
// Given: Step 0 has succeeded
21
- utils .HandleError (plaintext .MigrationStep0 (tableName , partitionKey , sortKeys [0 ]))
22
+ err = plaintext .MigrationStep0 (tableName , partitionKey , sortKeys [0 ])
23
+ utils .HandleError (err )
24
+
22
25
// When: Execute Step 3 with sortReadValue=0, Then: should panic (cannot read plaintext values)
23
26
// MigrationStep3(kmsKeyID, tableName, partitionKey, sortKeys[0])
24
27
utils .AssertServiceError (MigrationStep3 (kmsKeyID , tableName , partitionKey , sortKeys [0 ]), "DynamoDB" , "GetItem" , "Encrypted item missing expected header and footer attributes" )
25
28
26
29
// Given: Step 1 has succeeded
27
- utils .HandleError (MigrationStep1 (kmsKeyID , tableName , partitionKey , sortKeys [1 ]))
28
- // When: Execute Step 3 with sortReadValue=1, Then: should panic (cannot read plaintext values)
29
- utils .AssertServiceError (MigrationStep3 (kmsKeyID , tableName , partitionKey , sortKeys [1 ]), "DynamoDB" , "GetItem" , "Encrypted item missing expected header and footer attributes" )
30
+ err = MigrationStep1 (kmsKeyID , tableName , partitionKey , sortKeys [1 ])
31
+ utils .HandleError (err )
32
+
33
+ // When: Execute Step 3 with sortReadValue=1, Then: should error out (cannot read plaintext values)
34
+ err = MigrationStep3 (kmsKeyID , tableName , partitionKey , sortKeys [1 ])
35
+ utils .AssertServiceError (err , "DynamoDB" , "GetItem" , "Encrypted item missing expected header and footer attributes" )
30
36
31
37
// Given: Step 2 has succeeded
32
- utils .HandleError (MigrationStep2 (kmsKeyID , tableName , partitionKey , sortKeys [2 ]))
38
+ err = MigrationStep2 (kmsKeyID , tableName , partitionKey , sortKeys [2 ])
39
+ utils .HandleError (err )
40
+
33
41
// When: Execute Step 3 with sortReadValue=2, Then: Success (can read encrypted values)
34
- utils .HandleError (MigrationStep3 (kmsKeyID , tableName , partitionKey , sortKeys [2 ]))
42
+ err = MigrationStep3 (kmsKeyID , tableName , partitionKey , sortKeys [2 ])
43
+ utils .HandleError (err )
35
44
36
45
// Cleanup
37
46
for _ , sortKey := range sortKeys {
0 commit comments