Skip to content

Commit 28880be

Browse files
committed
Fix region_name placement in config template and test
Move region_name to after auth settings in the keystone_authtoken section and update test to verify it appears in that section.
1 parent e9a7d70 commit 28880be

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

templates/placementapi/config/placement.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ connection = {{ .DatabaseConnection }}
1515
auth_strategy = keystone
1616

1717
[keystone_authtoken]
18-
{{ if (index . "Region") -}}
19-
region_name = {{ .Region }}
20-
{{ end -}}
2118
www_authenticate_uri = {{ .KeystonePublicURL }}
2219
auth_url = {{ .KeystoneInternalURL }}
2320
{{ if .UseApplicationCredentials -}}
@@ -32,6 +29,9 @@ user_domain_name = Default
3229
project_domain_name = Default
3330
project_name = service
3431
{{- end }}
32+
{{ if (index . "Region") -}}
33+
region_name = {{ .Region }}
34+
{{ end -}}
3535
interface = internal
3636

3737
[oslo_policy]

test/functional/placementapi_controller_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,11 +374,10 @@ var _ = Describe("PlacementAPI controller", func() {
374374
// Verify region_name is set in [keystone_authtoken] section
375375
// GetRegion() returns Status.Region, so check that
376376
Expect(keystoneAPI.Status.Region).ToNot(BeEmpty(), "KeystoneAPI should have a region set in status")
377-
// The region_name should appear in the [keystone_authtoken] section
378-
// It's conditionally rendered, so check it appears between password and www_authenticate_uri
377+
// The region_name should appear in the [keystone_authtoken] section (before [oslo_policy])
379378
Expect(conf).Should(
380379
MatchRegexp(fmt.Sprintf(
381-
"password = .*\\nregion_name = %s\\n", keystoneAPI.Status.Region)))
380+
`\[keystone_authtoken\][\s\S]*region_name = %s[\s\S]*\[oslo_policy\]`, keystoneAPI.Status.Region)))
382381
})
383382

384383
It("creates service account, role and rolebindig", func() {

0 commit comments

Comments
 (0)