Skip to content
Merged
Changes from 9 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
41 changes: 41 additions & 0 deletions TestVectors/dafny/DDBEncryption/src/TestVectors.dfy
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ module {:options "-functionSyntax:4"} DdbEncryptionTestVectors {
BasicIoTestBatchWriteItem(c1, c2, globalRecords);
BasicIoTestPutItem(c1, c2, globalRecords);
BasicIoTestTransactWriteItems(c1, c2, globalRecords);
BasicIoTestExecuteStatement(c1, c2);
}
}

Expand Down Expand Up @@ -834,6 +835,46 @@ module {:options "-functionSyntax:4"} DdbEncryptionTestVectors {
BasicIoTestTransactGetItems(rClient, records);
}

method BasicIoTestExecuteStatement(writeConfig : TableConfig, readConfig : TableConfig)
{
var wClient :- expect newGazelle(writeConfig);
var rClient :- expect newGazelle(readConfig);
DeleteTable(wClient);
var _ :- expect wClient.CreateTable(schemaOnEncrypt);

// Create a PartiQL INSERT statement
// The dynamodb attributes are random and non-existent because ExecuteStatement is supposed to be failed before going into dynamodb.
var insertStatement := "INSERT INTO \"" + TableName + "\" VALUE {'partition_key': 'a', 'sort_key': 'b', 'attribute1': 'a'";
var inputForInsertStatement := DDB.ExecuteStatementInput(
Statement := insertStatement,
Parameters := None,
ConsistentRead := None,
NextToken := None,
ReturnConsumedCapacity := None,
Limit := None
);
var resultForInsertStatement := wClient.ExecuteStatement(inputForInsertStatement);
expect resultForInsertStatement.Failure?;
expect resultForInsertStatement.error.OpaqueWithText?;
expect resultForInsertStatement.error.objMessage == "ExecuteStatement not Supported on encrypted tables.";

// Create a PartiQL SELECT statement
// The dynamodb attributes are random and non-existent because ExecuteStatement is supposed to be failed before going into dynamodb.
var selectStatement := "SELECT * FROM " + TableName + " WHERE partition_key = 'a' AND sort_key = 'b'";
var inputForSelectStatement := DDB.ExecuteStatementInput(
Statement := selectStatement,
Parameters := None,
ConsistentRead := Some(true),
NextToken := None,
ReturnConsumedCapacity := None,
Limit := None
);
var resultForSelectStatement := rClient.ExecuteStatement(inputForSelectStatement);
expect resultForSelectStatement.Failure?;
expect resultForSelectStatement.error.OpaqueWithText?;
expect resultForSelectStatement.error.objMessage == "ExecuteStatement not Supported on encrypted tables.";
}

method FindMatchingRecord(expected : DDB.AttributeMap, actual : DDB.ItemList) returns (output : bool)
{
var exp := NormalizeItem(expected);
Expand Down
Loading