@@ -128,7 +128,7 @@ def all_in_table():
128128 except :
129129 pass
130130
131- @pytest .fixture (scope = "module " )
131+ @pytest .fixture (scope = "function " )
132132def table_basic ():
133133 resource_name = random_suffix_name ("table-basic" , 32 )
134134 (ref , cr ) = create_table (resource_name , "table_basic" )
@@ -838,4 +838,50 @@ def test_create_gsi_pay_per_request(self, table_basic_pay_per_request):
838838 timeout_seconds = MODIFY_WAIT_AFTER_SECONDS * 40 ,
839839 interval_seconds = 15 ,
840840 )
841+ def test_create_gsi_same_attributes (self , table_basic ):
842+ (ref , res ) = table_basic
843+
844+ table_name = res ["spec" ]["tableName" ]
845+
846+ # Check DynamoDB Table exists
847+ assert self .table_exists (table_name )
848+
849+ # Get CR latest revision
850+ cr = k8s .wait_resource_consumed_by_controller (ref )
851+
852+ # Creating two GSI using the same attributes
853+ gsi = {
854+ "indexName" : "total-bill" ,
855+ "keySchema" : [
856+ {
857+ "attributeName" : "Total" ,
858+ "keyType" : "HASH" ,
859+ },
860+ {
861+ "attributeName" : "Bill" ,
862+ "keyType" : "RANGE" ,
863+ }
864+ ],
865+ "projection" : {
866+ "projectionType" : "ALL" ,
867+ }
868+ }
869+
870+ cr ["spec" ]['globalSecondaryIndexes' ] = [
871+ gsi ,
872+ ]
873+
874+ # Patch k8s resource
875+ k8s .patch_custom_resource (ref , cr )
876+ k8s .wait_resource_consumed_by_controller (ref )
877+ table .wait_until (
878+ table_name ,
879+ table .gsi_matches (
880+ [
881+ gsi
882+ ],
883+ ),
884+ timeout_seconds = MODIFY_WAIT_AFTER_SECONDS * 40 ,
885+ interval_seconds = 15 ,
886+ )
841887
0 commit comments