@@ -15,23 +15,32 @@ func TestMigrationStep3(t *testing.T) {
1515 sortKeys := []string {"0" , "1" , "2" , "3" }
1616
1717 // 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 )
1920
2021 // 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+
2225 // When: Execute Step 3 with sortReadValue=0, Then: should panic (cannot read plaintext values)
2326 // MigrationStep3(kmsKeyID, tableName, partitionKey, sortKeys[0])
2427 utils .AssertServiceError (MigrationStep3 (kmsKeyID , tableName , partitionKey , sortKeys [0 ]), "DynamoDB" , "GetItem" , "Encrypted item missing expected header and footer attributes" )
2528
2629 // 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" )
3036
3137 // 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+
3341 // 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 )
3544
3645 // Cleanup
3746 for _ , sortKey := range sortKeys {
0 commit comments