@@ -92,24 +92,32 @@ def test_azconfig_snapshot_mgmt(self):
9292 'retention_period' : retention_period
9393 })
9494
95- self .cmd ('appconfig snapshot create --endpoint {endpoint} --auth-mode login --snapshot-name {snapshot_name} --filters {filter} --retention-period {retention_period} --composition-type key_label --tags tag1=value1' ,
95+ snapshot_description = "Snapshot of Test key-values"
96+ self .kwargs .update ({
97+ 'snapshot_description' : snapshot_description
98+ })
99+
100+ self .cmd ('appconfig snapshot create --endpoint {endpoint} --auth-mode login --snapshot-name {snapshot_name} --filters {filter} --retention-period {retention_period} --composition-type key_label --tags tag1=value1 --description "{snapshot_description}"' ,
96101 checks = [self .check ('itemsCount' , 2 ),
97- self .check ('status' , 'ready' )])
102+ self .check ('status' , 'ready' ),
103+ self .check ('description' , snapshot_description )])
98104
99105
100106 # Test showing created snapshot
101- created_snapshot = self .cmd ('appconfig snapshot show --endpoint {endpoint} --auth-mode login --snapshot-name {snapshot_name} --fields name status items_count filters' ).get_output_in_json ()
107+ created_snapshot = self .cmd ('appconfig snapshot show --endpoint {endpoint} --auth-mode login --snapshot-name {snapshot_name} --fields name status items_count filters description ' ).get_output_in_json ()
102108
103109 self .assertEqual (created_snapshot ['items_count' ], 2 )
104110 self .check (created_snapshot ['status' ], 'ready' )
105111 self .assertDictEqual (created_snapshot ['filters' ][0 ], filter_dict )
112+ self .assertEqual (created_snapshot ['description' ], snapshot_description )
106113 self .assertRaises (KeyError , lambda : created_snapshot ['created' ])
107114
108115 # Test listing snapshots
109- created_snapshots = self .cmd ('appconfig snapshot list --snapshot-name {snapshot_name} --endpoint {endpoint} --auth-mode login --fields name status items_count filters' ).get_output_in_json ()
116+ created_snapshots = self .cmd ('appconfig snapshot list --snapshot-name {snapshot_name} --endpoint {endpoint} --auth-mode login --fields name status items_count filters description ' ).get_output_in_json ()
110117 self .assertEqual (created_snapshots [0 ]['items_count' ], 2 )
111118 self .assertEqual (created_snapshots [0 ]['status' ], 'ready' )
112119 self .assertDictEqual (created_snapshots [0 ]['filters' ][0 ], filter_dict )
120+ self .assertEqual (created_snapshots [0 ]['description' ], snapshot_description )
113121
114122 # Test snapshot archive
115123 archived_snapshot = self .cmd ('appconfig snapshot archive --endpoint {endpoint} --auth-mode login --snapshot-name {snapshot_name}' ).get_output_in_json ()
@@ -358,71 +366,3 @@ def test_azconfig_snapshot_filtering(self):
358366 self .check ('status' , 'ready' )])
359367
360368
361- @AllowLargeResponse ()
362- # Uses Entra ID auth (store created with local auth disabled); target a resource group where the
363- # recording principal holds "App Configuration Data Owner". Override via AZURE_CLI_APPCONFIG_TEST_RG.
364- def test_azconfig_snapshot_description (self ):
365- store_name_prefix = get_resource_name_prefix ('snapshotdesc' )
366- config_store_name = self .create_random_name (prefix = store_name_prefix , length = 24 )
367- snapshot_name = "DescriptionSnapshot"
368- snapshot_description = "Snapshot of Test key-values"
369- store_location = 'francecentral'
370- sku = 'standard'
371-
372- self .kwargs .update ({
373- 'config_store_name' : config_store_name ,
374- 'snapshot_name' : snapshot_name ,
375- 'snapshot_description' : snapshot_description ,
376- 'rg_loc' : store_location ,
377- 'rg' : get_test_resource_group (),
378- 'sku' : sku ,
379- 'retention_days' : 1 ,
380- 'enable_purge_protection' : False ,
381- 'endpoint' : 'https://' + config_store_name + '.azconfig.io'
382- })
383-
384- create_config_store (self , self .kwargs , disable_local_auth = True )
385-
386- # Create a couple of key-values to include in the snapshot
387- self .kwargs .update ({
388- 'key' : "TestKey1" ,
389- 'value' : "TestValue1" ,
390- })
391- self .cmd ('appconfig kv set --endpoint {endpoint} --auth-mode login --key {key} --value {value} -y' ,
392- checks = [self .check ('key' , "TestKey1" ),
393- self .check ('value' , "TestValue1" )])
394-
395- self .kwargs .update ({
396- 'key' : "TestKey2" ,
397- 'value' : "TestValue2" ,
398- })
399- self .cmd ('appconfig kv set --endpoint {endpoint} --auth-mode login --key {key} --value {value} -y' ,
400- checks = [self .check ('key' , "TestKey2" ),
401- self .check ('value' , "TestValue2" )])
402-
403- # Create a snapshot with a description
404- filter_dict = {"key" : "Test*" }
405- self .kwargs .update ({
406- 'filter' : '\' {}\' ' .format (json .dumps (filter_dict )),
407- 'retention_period' : 3600
408- })
409-
410- self .cmd ('appconfig snapshot create --endpoint {endpoint} --auth-mode login --snapshot-name {snapshot_name} --filters {filter} --retention-period {retention_period} --description "{snapshot_description}"' ,
411- checks = [self .check ('itemsCount' , 2 ),
412- self .check ('status' , 'ready' ),
413- self .check ('description' , snapshot_description )])
414-
415- # Show the snapshot and verify the description is returned
416- self .cmd ('appconfig snapshot show --endpoint {endpoint} --auth-mode login --snapshot-name {snapshot_name}' ,
417- checks = [self .check ('name' , snapshot_name ),
418- self .check ('description' , snapshot_description )])
419-
420- # Show only the description field
421- partial_snapshot = self .cmd ('appconfig snapshot show --endpoint {endpoint} --auth-mode login --snapshot-name {snapshot_name} --fields description' ).get_output_in_json ()
422- self .assertEqual (partial_snapshot ['description' ], snapshot_description )
423- self .assertRaises (KeyError , lambda : partial_snapshot ['name' ])
424-
425- # List snapshots and verify the description is returned
426- listed_snapshots = self .cmd ('appconfig snapshot list --endpoint {endpoint} --auth-mode login --snapshot-name {snapshot_name}' ).get_output_in_json ()
427- self .assertEqual (listed_snapshots [0 ]['description' ], snapshot_description )
428-
0 commit comments