Skip to content

Commit 2670157

Browse files
auto commit
1 parent 7d507eb commit 2670157

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

.github/workflows/ci_test_go.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,14 @@ jobs:
140140
run: |
141141
make test_go
142142
143-
- name: Test Examples
143+
- name: Run Examples (this panics when on error)
144144
if: matrix.library == 'DynamoDbEncryption'
145145
working-directory: ./Examples/runtimes/go
146146
run: |
147147
go run main.go
148+
149+
- name: Test Examples
150+
if: matrix.library == 'DynamoDbEncryption'
151+
working-directory: ./Examples/runtimes/go
152+
run: |
153+
go test ./...
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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 TestMigrationStep1(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 1
18+
MigrationStep1(kmsKeyID, tableName, partitionKey, sortKeys[1])
19+
20+
// Given: Step 0 has succeeded
21+
plaintext.MigrationStep0(tableName, partitionKey, sortKeys[0])
22+
// When: Execute Step 1 with sortReadValue=0, Then: Success (i.e. can read plaintext values)
23+
MigrationStep1(kmsKeyID, tableName, partitionKey, sortKeys[0])
24+
25+
// Given: Step 2 has succeeded
26+
MigrationStep2(kmsKeyID, tableName, partitionKey, sortKeys[2])
27+
// When: Execute Step 1 with sortReadValue=2, Then: Success (i.e. can read encrypted values)
28+
MigrationStep1(kmsKeyID, tableName, partitionKey, sortKeys[2])
29+
30+
// Cleanup
31+
for _, sortKey := range sortKeys {
32+
utils.DeleteItem(tableName, "partition_key", partitionKey, "sort_key", sortKey)
33+
}
34+
35+
}

0 commit comments

Comments
 (0)