You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var _ :-expect wClient.CreateTable(schemaOnEncrypt);
939
+
var wClient, rClient :=SetupTestTable(writeConfig, readConfig);
934
940
935
941
// Create a PartiQL INSERT statement
936
942
// The dynamodb attributes are random and non-existent because ExecuteStatement is supposed to be failed before going into dynamodb.
937
-
var insertStatement := "INSERT INTO \"" + TableName + "\" VALUE {'partition_key': 'a', 'sort_key': 'b', 'attribute1': 'a'";
943
+
var insertStatement := "INSERT INTO \"" + TableName + "\" VALUE {'partition_key': 'a', 'sort_key': 'b', 'attribute1': 'a'}";
938
944
var inputForInsertStatement := DDB.ExecuteStatementInput(
939
-
Statement := insertStatement,
940
-
Parameters := None,
941
-
ConsistentRead := None,
942
-
NextToken := None,
943
-
ReturnConsumedCapacity := None,
944
-
Limit := None
945
+
Statement := insertStatement
945
946
);
946
947
var resultForInsertStatement := wClient.ExecuteStatement(inputForInsertStatement);
947
948
expect resultForInsertStatement.Failure?, "ExecuteStatement should have failed";
948
949
// This error is of type DynamoDbEncryptionTransformsException
949
950
// but AWS SDK wraps it into its own type for which customers should be unwrapping.
950
951
// In test vectors, we still have to change the error from AWS SDK to dafny so it turns out to be OpaqueWithText.
951
952
expect resultForInsertStatement.error.OpaqueWithText?, "Error should have been of type OpaqueWithText";
953
+
var hasDynamoDbEncryptionTransformsExceptionForInsertStatement? := String.HasSubString(resultForInsertStatement.error.objMessage, "ExecuteStatement not Supported on encrypted tables.");
// The dynamodb attributes are random and non-existent because ExecuteStatement is supposed to be failed before going into dynamodb.
955
-
var selectStatement := "SELECT * FROM "+ TableName + " WHERE partition_key = 'a' AND sort_key = 'b'";
958
+
var selectStatement := "SELECT * FROM \""+ TableName + "\" WHERE partition_key = 'a' AND sort_key = 'b'}";
956
959
var inputForSelectStatement := DDB.ExecuteStatementInput(
957
-
Statement := selectStatement,
958
-
Parameters := None,
959
-
ConsistentRead := Some(true),
960
-
NextToken := None,
961
-
ReturnConsumedCapacity := None,
962
-
Limit := None
960
+
Statement := selectStatement
963
961
);
964
962
var resultForSelectStatement := rClient.ExecuteStatement(inputForSelectStatement);
965
963
expect resultForSelectStatement.Failure?, "ExecuteStatement should have failed";
966
964
// This error is of type DynamoDbEncryptionTransformsException
967
965
// but AWS SDK wraps it into its own type for which customers should be unwrapping.
968
966
// In test vectors, we still have to change the error from AWS SDK to dafny so it turns out to be OpaqueWithText.
969
967
expect resultForSelectStatement.error.OpaqueWithText?, "Error should have been of type OpaqueWithText";
968
+
var hasDynamoDbEncryptionTransformsExceptionForSelectStatement? := String.HasSubString(resultForSelectStatement.error.objMessage, "ExecuteStatement not Supported on encrypted tables.");
var wClient, rClient :=SetupTestTable(writeConfig, readConfig);
1007
+
1008
+
// Create a PartiQL transaction with INSERT and SELECT statements
1009
+
// The dynamodb attributes are random and non-existent because ExecuteTransaction is supposed to fail before going to dynamodb
1010
+
var statements := [
1011
+
DDB.ParameterizedStatement(
1012
+
Statement := "INSERT INTO \"" + TableName + "\" VALUE {'partition_key': 'a', 'sort_key': 'b', 'attribute1': 'value1'}",
1013
+
Parameters := None
1014
+
),
1015
+
DDB.ParameterizedStatement(
1016
+
Statement := "SELECT * FROM " + TableName + " WHERE partition_key = 'a' AND sort_key = 'b'",
1017
+
Parameters := None
1018
+
)
1019
+
];
1020
+
1021
+
var inputForTransaction := DDB.ExecuteTransactionInput(
1022
+
TransactStatements := statements,
1023
+
ClientRequestToken := None
1024
+
);
1025
+
1026
+
// Test with write client
1027
+
var resultForWriteTransaction := wClient.ExecuteTransaction(inputForTransaction);
1028
+
expect resultForWriteTransaction.Failure?, "ExecuteTransaction should have failed";
1029
+
// This error is of type DynamoDbEncryptionTransformsException
1030
+
// but AWS SDK wraps it into its own type for which customers should be unwrapping.
1031
+
// In test vectors, we still have to change the error from AWS SDK to dafny so it turns out to be OpaqueWithText.
1032
+
expect resultForWriteTransaction.error.OpaqueWithText?, "Error should have been of type OpaqueWithText";
1033
+
var hasDynamoDbEncryptionTransformsExceptionForWriteTransaction? := String.HasSubString(resultForWriteTransaction.error.objMessage, "ExecuteTransaction not Supported on encrypted tables.");
var resultForReadTransaction := rClient.ExecuteTransaction(inputForTransaction);
1038
+
expect resultForReadTransaction.Failure?, "ExecuteTransaction should have failed";
1039
+
// This error is of type DynamoDbEncryptionTransformsException
1040
+
// but AWS SDK wraps it into its own type for which customers should be unwrapping.
1041
+
// In test vectors, we still have to change the error from AWS SDK to dafny so it turns out to be OpaqueWithText.
1042
+
expect resultForReadTransaction.error.OpaqueWithText?, "Error should have been of type OpaqueWithText";
1043
+
var hasDynamoDbEncryptionTransformsExceptionForReadTransaction? := String.HasSubString(resultForReadTransaction.error.objMessage, "ExecuteTransaction not Supported on encrypted tables.");
var wClient, rClient :=SetupTestTable(writeConfig, readConfig);
1050
+
1051
+
// Create a batch of PartiQL statements
1052
+
// The dynamodb attributes are random and non-existent because BatchExecuteStatement is supposed to fail before going into dynamodb
1053
+
var statements := [
1054
+
DDB.BatchStatementRequest(
1055
+
Statement := "INSERT INTO \"" + TableName + "\" VALUE {'partition_key': 'a', 'sort_key': 'b', 'attribute1': 'value1'}",
1056
+
Parameters := None,
1057
+
ConsistentRead := None
1058
+
),
1059
+
DDB.BatchStatementRequest(
1060
+
Statement := "INSERT INTO \"" + TableName + "\" VALUE {'partition_key': 'c', 'sort_key': 'd', 'attribute1': 'value2'}",
1061
+
Parameters := None,
1062
+
ConsistentRead := None
1063
+
),
1064
+
DDB.BatchStatementRequest(
1065
+
Statement := "SELECT * FROM " + TableName + " WHERE partition_key = 'a' AND sort_key = 'b'",
1066
+
Parameters := None,
1067
+
ConsistentRead := Some(true)
1068
+
)
1069
+
];
1070
+
1071
+
// Test with write client for batch insert
1072
+
var inputForBatchInsert := DDB.BatchExecuteStatementInput(
1073
+
Statements := statements[..2], // Just the INSERT statements
1074
+
ReturnConsumedCapacity := None
1075
+
);
1076
+
1077
+
var resultForBatchInsert := wClient.BatchExecuteStatement(inputForBatchInsert);
1078
+
expect resultForBatchInsert.Failure?, "BatchExecuteStatement for inserts should have failed";
1079
+
// This error is of type DynamoDbEncryptionTransformsException
1080
+
// but AWS SDK wraps it into its own type for which customers should be unwrapping.
1081
+
// In test vectors, we still have to change the error from AWS SDK to dafny so it turns out to be OpaqueWithText.
1082
+
expect resultForBatchInsert.error.OpaqueWithText?, "Error should have been of type OpaqueWithText";
1083
+
var hasDynamoDbEncryptionTransformsExceptionForBatchInsert? := String.HasSubString(resultForBatchInsert.error.objMessage, "BatchExecuteStatement not Supported on encrypted tables.");
var inputForBatchSelect := DDB.BatchExecuteStatementInput(
1088
+
Statements := statements[2..], // Just the SELECT statement
1089
+
ReturnConsumedCapacity := None
1090
+
);
1091
+
1092
+
var resultForBatchSelect := rClient.BatchExecuteStatement(inputForBatchSelect);
1093
+
expect resultForBatchSelect.Failure?, "BatchExecuteStatement for selects should have failed";
1094
+
// This error is of type DynamoDbEncryptionTransformsException
1095
+
// but AWS SDK wraps it into its own type for which customers should be unwrapping.
1096
+
// In test vectors, we still have to change the error from AWS SDK to dafny so it turns out to be OpaqueWithText.
1097
+
expect resultForBatchSelect.error.OpaqueWithText?, "Error should have been of type OpaqueWithText";
1098
+
var hasDynamoDbEncryptionTransformsExceptionForBatchSelect? := String.HasSubString(resultForBatchSelect.error.objMessage, "BatchExecuteStatement not Supported on encrypted tables.");
// Test with mixed batch (both inserts and selects)
1102
+
var inputForMixedBatch := DDB.BatchExecuteStatementInput(
1103
+
Statements := statements, // All statements
1104
+
ReturnConsumedCapacity := None
1105
+
);
1106
+
1107
+
var resultForMixedBatch := wClient.BatchExecuteStatement(inputForMixedBatch);
1108
+
expect resultForMixedBatch.Failure?, "BatchExecuteStatement for mixed batch should have failed";
1109
+
// This error is of type DynamoDbEncryptionTransformsException
1110
+
// but AWS SDK wraps it into its own type for which customers should be unwrapping.
1111
+
// In test vectors, we still have to change the error from AWS SDK to dafny so it turns out to be OpaqueWithText.
1112
+
expect resultForMixedBatch.error.OpaqueWithText?, "Error should have been of type OpaqueWithText";
1113
+
var hasDynamoDbEncryptionTransformsExceptionForMixedBatch? := String.HasSubString(resultForMixedBatch.error.objMessage, "BatchExecuteStatement not Supported on encrypted tables.");
0 commit comments