Skip to content

Commit d5e36b8

Browse files
auto commit
1 parent 654dceb commit d5e36b8

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

Examples/runtimes/go/migration/PlaintextToAWSDBE/awsdbe/migrationexamplestep2.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ func MigrationStep2(kmsKeyID, ddbTableName, partitionKeyValue, sortKeyValue stri
5050
// you must use the plaintext override `FORBID_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ`.
5151
// This plaintext override means:
5252
// - Write: Items are forbidden to be written as plaintext.
53-
// Items will be written as encrypted items.
53+
// Items will be written as encrypted items.
5454
// - Read: Items are allowed to be read as plaintext.
55-
// Items are allowed to be read as encrypted items.
55+
// Items are allowed to be read as encrypted items.
5656

5757
listOfTableConfigs := configureTable(kmsKeyID, ddbTableName, dbesdkdynamodbencryptiontypes.PlaintextOverrideForbidPlaintextWriteAllowPlaintextRead)
5858

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package awsdbe
2+
3+
import (
4+
"testing"
5+
6+
"github.com/aws/aws-database-encryption-sdk-dynamodb/releases/go/dynamodb-esdk/examples/migration/PlaintextToAWSDBE/plaintext"
7+
"github.com/aws/aws-database-encryption-sdk-dynamodb/releases/go/dynamodb-esdk/examples/utils"
8+
"github.com/google/uuid"
9+
)
10+
11+
func TestMigrationStep2(t *testing.T) {
12+
kmsKeyID := utils.KmsKeyID()
13+
tableName := utils.DdbTableName()
14+
partitionKey := uuid.New().String()
15+
sortKeys := []string{"0", "1", "2"}
16+
17+
// Successfully executes Step 2
18+
MigrationStep2(kmsKeyID, tableName, partitionKey, sortKeys[2])
19+
20+
// Given: Step 0 has succeeded
21+
plaintext.MigrationStep0(tableName, partitionKey, sortKeys[0])
22+
// When: Execute Step 2 with sortReadValue=0, Then: Success (i.e. can read plaintext values)
23+
MigrationStep2(kmsKeyID, tableName, partitionKey, sortKeys[0])
24+
25+
// Given: Step 1 has succeeded
26+
MigrationStep1(kmsKeyID, tableName, partitionKey, sortKeys[1])
27+
// When: Execute Step 2 with sortReadValue=1, Then: Success (i.e. can read encrypted values)
28+
MigrationStep2(kmsKeyID, tableName, partitionKey, sortKeys[1])
29+
30+
// Cleanup
31+
for _, sortKey := range sortKeys {
32+
utils.DeleteItem(tableName, "partition_key", partitionKey, "sort_key", sortKey)
33+
}
34+
}

0 commit comments

Comments
 (0)