Skip to content

Commit 140f3c0

Browse files
auto commit
1 parent addce30 commit 140f3c0

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

DynamoDbEncryption/runtimes/rust/examples/migration/plaintext_to_awsdbe/awsdbe/migration_step_1.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,15 +147,15 @@ async fn test_migration_step_1() -> Result<(), Box<dyn std::error::Error>> {
147147
let table_name = test_utils::TEST_DDB_TABLE_NAME;
148148
let partition_key = Uuid::new_v4().to_string();
149149
let sort_keys = ["0", "1", "2", "3"];
150+
151+
// Successfully executes step 1
152+
let success = migration_step_1_example(kms_key_id, table_name, &partition_key, sort_keys[1], sort_keys[1]).await?;
153+
assert!(success, "MigrationStep1 should complete successfully");
150154

151155
// Given: Step 0 has succeeded
152156
let success = migration_step_0_example(table_name, &partition_key, sort_keys[0], sort_keys[0]).await?;
153157
assert!(success, "MigrationStep0 should complete successfully");
154158

155-
// Successfully executes step 1
156-
let success = migration_step_1_example(kms_key_id, table_name, &partition_key, sort_keys[1], sort_keys[1]).await?;
157-
assert!(success, "MigrationStep1 should complete successfully");
158-
159159
// When: Execute Step 1 with sortReadValue=0, Then: Success (i.e. can read plaintext values from Step 0)
160160
let success = migration_step_1_example(kms_key_id, table_name, &partition_key, sort_keys[1], sort_keys[0]).await?;
161161
assert!(success, "MigrationStep1 should be able to read items written by Step 0");

DynamoDbEncryption/runtimes/rust/examples/migration/plaintext_to_awsdbe/awsdbe/migration_step_2.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,22 +150,22 @@ async fn test_migration_step_2() -> Result<(), Box<dyn std::error::Error>> {
150150
let partition_key = Uuid::new_v4().to_string();
151151
let sort_keys = ["0", "1", "2", "3"];
152152

153-
// Given: Step 0 has succeeded
154-
let success = migration_step_0_example(table_name, &partition_key, sort_keys[0], sort_keys[0]).await?;
155-
assert!(success, "MigrationStep0 should complete successfully");
156-
157-
// Given: Step 1 has succeeded
158-
let success = migration_step_1_example(kms_key_id, table_name, &partition_key, sort_keys[1], sort_keys[1]).await?;
159-
assert!(success, "MigrationStep1 should complete successfully");
160-
161153
// Successfully executes step 2
162154
let success = migration_step_2_example(kms_key_id, table_name, &partition_key, sort_keys[2], sort_keys[2]).await?;
163155
assert!(success, "MigrationStep2 should complete successfully");
164156

157+
// Given: Step 0 has succeeded
158+
let success = migration_step_0_example(table_name, &partition_key, sort_keys[0], sort_keys[0]).await?;
159+
assert!(success, "MigrationStep0 should complete successfully");
160+
165161
// When: Execute Step 2 with sortReadValue=0, Then: Success (i.e. can read plaintext values from Step 0)
166162
let success = migration_step_2_example(kms_key_id, table_name, &partition_key, sort_keys[2], sort_keys[0]).await?;
167163
assert!(success, "MigrationStep2 should be able to read items written by Step 0");
168164

165+
// Given: Step 1 has succeeded
166+
let success = migration_step_1_example(kms_key_id, table_name, &partition_key, sort_keys[1], sort_keys[1]).await?;
167+
assert!(success, "MigrationStep1 should complete successfully");
168+
169169
// When: Execute Step 2 with sortReadValue=1, Then: Success (i.e. can read plaintext values from Step 1)
170170
let success = migration_step_2_example(kms_key_id, table_name, &partition_key, sort_keys[2], sort_keys[1]).await?;
171171
assert!(success, "MigrationStep2 should be able to read items written by Step 1");

DynamoDbEncryption/runtimes/rust/examples/migration/plaintext_to_awsdbe/awsdbe/migration_step_3.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -151,30 +151,30 @@ async fn test_migration_step_3() -> Result<(), Box<dyn std::error::Error>> {
151151
let partition_key = Uuid::new_v4().to_string();
152152
let sort_keys = ["0", "1", "2", "3"];
153153

154+
// Successfully executes step 3
155+
let success = migration_step_3_example(kms_key_id, table_name, &partition_key, sort_keys[3], sort_keys[3]).await?;
156+
assert!(success, "MigrationStep3 should complete successfully");
157+
154158
// Given: Step 0 has succeeded
155159
let success = migration_step_0_example(table_name, &partition_key, sort_keys[0], sort_keys[0]).await?;
156160
assert!(success, "MigrationStep0 should complete successfully");
157161

158-
// Given: Step 1 has succeeded
159-
let success = migration_step_1_example(kms_key_id, table_name, &partition_key, sort_keys[1], sort_keys[1]).await?;
160-
assert!(success, "MigrationStep1 should complete successfully");
161-
162-
// Given: Step 2 has succeeded
163-
let success = migration_step_2_example(kms_key_id, table_name, &partition_key, sort_keys[2], sort_keys[2]).await?;
164-
assert!(success, "MigrationStep2 should complete successfully");
165-
166-
// Successfully executes step 3
167-
let success = migration_step_3_example(kms_key_id, table_name, &partition_key, sort_keys[3], sort_keys[3]).await?;
168-
assert!(success, "MigrationStep3 should complete successfully");
169-
170162
// When: Execute Step 3 with sortReadValue=0, Then: should error out when reading plaintext items from Step 0
171163
let result = migration_step_3_example(kms_key_id, table_name, &partition_key, sort_keys[3], sort_keys[0]).await;
172164
assert!(result.is_err(), "MigrationStep3 should fail when reading plaintext items");
173165

166+
// Given: Step 1 has succeeded
167+
let success = migration_step_1_example(kms_key_id, table_name, &partition_key, sort_keys[1], sort_keys[1]).await?;
168+
assert!(success, "MigrationStep1 should complete successfully");
169+
174170
// When: Execute Step 3 with sortReadValue=1, Then: should error out when reading plaintext items from Step 1
175171
let result = migration_step_3_example(kms_key_id, table_name, &partition_key, sort_keys[3], sort_keys[1]).await;
176172
assert!(result.is_err(), "MigrationStep3 should fail when reading plaintext items");
177173

174+
// Given: Step 2 has succeeded
175+
let success = migration_step_2_example(kms_key_id, table_name, &partition_key, sort_keys[2], sort_keys[2]).await?;
176+
assert!(success, "MigrationStep2 should complete successfully");
177+
178178
// When: Execute Step 3 with sortReadValue=2, Then: Success (i.e. can read encrypted values from Step 2)
179179
let success = migration_step_3_example(kms_key_id, table_name, &partition_key, sort_keys[3], sort_keys[2]).await?;
180180
assert!(success, "MigrationStep3 should be able to read items written by Step 2");

0 commit comments

Comments
 (0)