@@ -285,51 +285,54 @@ var _ = Describe("NovaScheduler controller", func() {
285285 )
286286
287287 // Wait for config to be regenerated with region
288+ var configData string
288289 Eventually (func (g Gomega ) {
289290 configDataMap := th .GetSecret (novaNames .SchedulerConfigDataName )
290291 g .Expect (configDataMap ).ShouldNot (BeNil ())
291292 g .Expect (configDataMap .Data ).Should (HaveKey ("01-nova.conf" ))
292- configData := string (configDataMap .Data ["01-nova.conf" ])
293-
294- // Parse the INI file to properly access sections
295- cfg , err := ini .Load ([]byte (configData ))
296- g .Expect (err ).ShouldNot (HaveOccurred (), "Should be able to parse config as INI" )
297-
298- // Verify region_name in [keystone_authtoken]
299- section := cfg .Section ("keystone_authtoken" )
300- g .Expect (section ).ShouldNot (BeNil (), "Should find [keystone_authtoken] section" )
301- g .Expect (section .Key ("region_name" ).String ()).Should (Equal (testRegion ))
302-
303- // Verify region_name in [placement]
304- section = cfg .Section ("placement" )
305- g .Expect (section ).ShouldNot (BeNil (), "Should find [placement] section" )
306- g .Expect (section .Key ("region_name" ).String ()).Should (Equal (testRegion ))
307-
308- // Verify region_name in [glance]
309- section = cfg .Section ("glance" )
310- g .Expect (section ).ShouldNot (BeNil (), "Should find [glance] section" )
311- g .Expect (section .Key ("region_name" ).String ()).Should (Equal (testRegion ))
312-
313- // Verify region_name in [neutron]
314- section = cfg .Section ("neutron" )
315- g .Expect (section ).ShouldNot (BeNil (), "Should find [neutron] section" )
316- g .Expect (section .Key ("region_name" ).String ()).Should (Equal (testRegion ))
317-
318- // Verify os_region_name in [cinder]
319- section = cfg .Section ("cinder" )
320- g .Expect (section ).ShouldNot (BeNil (), "Should find [cinder] section" )
321- g .Expect (section .Key ("os_region_name" ).String ()).Should (Equal (testRegion ))
322-
323- // Verify barbican_region_name in [barbican]
324- section = cfg .Section ("barbican" )
325- g .Expect (section ).ShouldNot (BeNil (), "Should find [barbican] section" )
326- g .Expect (section .Key ("barbican_region_name" ).String ()).Should (Equal (testRegion ))
327-
328- // Verify endpoint_region_name in [oslo_limit]
329- section = cfg .Section ("oslo_limit" )
330- g .Expect (section ).ShouldNot (BeNil (), "Should find [oslo_limit] section" )
331- g .Expect (section .Key ("endpoint_region_name" ).String ()).Should (Equal (testRegion ))
293+ configData = string (configDataMap .Data ["01-nova.conf" ])
294+ // Quick check that config contains the expected region before parsing
295+ g .Expect (configData ).To (ContainSubstring (testRegion ))
332296 }, timeout , interval ).Should (Succeed ())
297+
298+ // Parse the INI file once after Eventually succeeds (avoids repeated parsing)
299+ cfg , err := ini .Load ([]byte (configData ))
300+ Expect (err ).ShouldNot (HaveOccurred (), "Should be able to parse config as INI" )
301+
302+ // Verify region_name in [keystone_authtoken]
303+ section := cfg .Section ("keystone_authtoken" )
304+ Expect (section ).ShouldNot (BeNil (), "Should find [keystone_authtoken] section" )
305+ Expect (section .Key ("region_name" ).String ()).Should (Equal (testRegion ))
306+
307+ // Verify region_name in [placement]
308+ section = cfg .Section ("placement" )
309+ Expect (section ).ShouldNot (BeNil (), "Should find [placement] section" )
310+ Expect (section .Key ("region_name" ).String ()).Should (Equal (testRegion ))
311+
312+ // Verify region_name in [glance]
313+ section = cfg .Section ("glance" )
314+ Expect (section ).ShouldNot (BeNil (), "Should find [glance] section" )
315+ Expect (section .Key ("region_name" ).String ()).Should (Equal (testRegion ))
316+
317+ // Verify region_name in [neutron]
318+ section = cfg .Section ("neutron" )
319+ Expect (section ).ShouldNot (BeNil (), "Should find [neutron] section" )
320+ Expect (section .Key ("region_name" ).String ()).Should (Equal (testRegion ))
321+
322+ // Verify os_region_name in [cinder]
323+ section = cfg .Section ("cinder" )
324+ Expect (section ).ShouldNot (BeNil (), "Should find [cinder] section" )
325+ Expect (section .Key ("os_region_name" ).String ()).Should (Equal (testRegion ))
326+
327+ // Verify barbican_region_name in [barbican]
328+ section = cfg .Section ("barbican" )
329+ Expect (section ).ShouldNot (BeNil (), "Should find [barbican] section" )
330+ Expect (section .Key ("barbican_region_name" ).String ()).Should (Equal (testRegion ))
331+
332+ // Verify endpoint_region_name in [oslo_limit]
333+ section = cfg .Section ("oslo_limit" )
334+ Expect (section ).ShouldNot (BeNil (), "Should find [oslo_limit] section" )
335+ Expect (section .Key ("endpoint_region_name" ).String ()).Should (Equal (testRegion ))
333336 })
334337
335338 It ("stored the input hash in the Status" , func () {
0 commit comments