Skip to content

chore: Examples run serially. Examples wait for GSI. No extra checkout #561

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -298,16 +298,29 @@ public static void PutAndQueryItemWithCompoundBeacon(DynamoDbClient ddb, String
.expressionAttributeValues(expressionAttributeValues)
.build();

QueryResponse queryResponse = ddb.query(queryRequest);
List<Map<String, AttributeValue>> attributeValues = queryResponse.items();
// Validate query was returned successfully
assert 200 == queryResponse.sdkHttpResponse().statusCode();
// Validate only 1 item was returned: the item we just put
assert attributeValues.size() == 1;
Map<String, AttributeValue> returnedItem = attributeValues.get(0);
// Validate the item has the expected attributes
assert returnedItem.get("inspector_id_last4").s().equals("5678");
assert returnedItem.get("unit").s().equals("011899988199");
// GSIs do not update instantly
// so if the results come back empty
// we retry after a short sleep
for (int i=0; i<10; ++i) {
QueryResponse queryResponse = ddb.query(queryRequest);
List<Map<String, AttributeValue>> attributeValues = queryResponse.items();
// Validate query was returned successfully
assert 200 == queryResponse.sdkHttpResponse().statusCode();

// if no results, sleep and try again
if (attributeValues.size() == 0) {
try {Thread.sleep(20);} catch (Exception e) {}
continue;
}

// Validate only 1 item was returned: the item we just put
assert attributeValues.size() == 1;
Map<String, AttributeValue> returnedItem = attributeValues.get(0);
// Validate the item has the expected attributes
assert returnedItem.get("inspector_id_last4").s().equals("5678");
assert returnedItem.get("unit").s().equals("011899988199");
break;
}
}

public static void main(final String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,16 +407,29 @@ public static void PutItemQueryItemWithVirtualBeacon(String ddbTableName, String
.expressionAttributeValues(expressionAttributeValues)
.build();

final QueryResponse queryResponse = ddb.query(queryRequest);
List<Map<String, AttributeValue>> attributeValues = queryResponse.items();
// Validate query was returned successfully
assert 200 == queryResponse.sdkHttpResponse().statusCode();
// Validate only 1 item was returned: the item with the expected attributes
assert attributeValues.size() == 1;
final Map<String, AttributeValue> returnedItem = attributeValues.get(0);
// Validate the item has the expected attributes
assert returnedItem.get("state").s().equals("CA");
assert returnedItem.get("hasTestResult").bool().equals(true);
// GSIs do not update instantly
// so if the results come back empty
// we retry after a short sleep
for (int i=0; i<10; ++i) {
final QueryResponse queryResponse = ddb.query(queryRequest);
List<Map<String, AttributeValue>> attributeValues = queryResponse.items();
// Validate query was returned successfully
assert 200 == queryResponse.sdkHttpResponse().statusCode();

// if no results, sleep and try again
if (attributeValues.size() == 0) {
try {Thread.sleep(20);} catch (Exception e) {}
continue;
}

// Validate only 1 item was returned: the item with the expected attributes
assert attributeValues.size() == 1;
final Map<String, AttributeValue> returnedItem = attributeValues.get(0);
// Validate the item has the expected attributes
assert returnedItem.get("state").s().equals("CA");
assert returnedItem.get("hasTestResult").bool().equals(true);
break;
}
}

public static void main(final String[] args) {
Expand Down
3 changes: 0 additions & 3 deletions codebuild/release/release-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
version: 0.2

env:
variables:
BRANCH: "main"
parameter-store:
ACCOUNT: /CodeBuild/AccountId
secrets-manager:
Expand All @@ -31,7 +29,6 @@ phases:
- cd aws-database-encryption-sdk-dynamodb-java/
pre_build:
commands:
- git checkout $BRANCH
- aws secretsmanager get-secret-value --region us-west-2 --secret-id Maven-GPG-Keys-Release --query SecretBinary --output text | base64 -d > ~/mvn_gpg.tgz
- tar -xvf ~/mvn_gpg.tgz -C ~
# Create default location where GPG looks for creds and keys
Expand Down
8 changes: 4 additions & 4 deletions codebuild/release/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ batch:

- identifier: validate_staging_corretto11
depend-on:
- release_staging
- validate_staging_corretto8
buildspec: codebuild/staging/validate-staging.yml
env:
variables:
Expand All @@ -38,7 +38,7 @@ batch:

- identifier: validate_staging_corretto17
depend-on:
- release_staging
- validate_staging_corretto11
buildspec: codebuild/staging/validate-staging.yml
env:
variables:
Expand Down Expand Up @@ -73,7 +73,7 @@ batch:

- identifier: validate_release_corretto11
depend-on:
- upload_to_sonatype
- validate_release_corretto8
buildspec: codebuild/release/validate-release.yml
env:
variables:
Expand All @@ -83,7 +83,7 @@ batch:

- identifier: validate_release_corretto17
depend-on:
- upload_to_sonatype
- validate_release_corretto11
buildspec: codebuild/release/validate-release.yml
env:
variables:
Expand Down