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