@@ -10,16 +10,16 @@ import (
1010)
1111
1212type EnvFixture struct {
13- ironicEndpoint string
14- kernelURL string
15- ramdiskURL string
16- isoURL string
17- liveISOForcePersistentBootDevice string
18- ironicCACertFile string
19- ironicClientCertFile string
20- ironicClientPrivateKeyFile string
21- ironicInsecure string
22- ironicSkipClientSANVerify string
13+ ironicEndpoint string
14+ kernelURL string
15+ ramdiskURL string
16+ isoURL string
17+ forcePersistentBootDevice string
18+ ironicCACertFile string
19+ ironicClientCertFile string
20+ ironicClientPrivateKeyFile string
21+ ironicInsecure string
22+ ironicSkipClientSANVerify string
2323
2424 origEnv map [string ]string
2525}
@@ -49,7 +49,7 @@ func (f *EnvFixture) SetUp() {
4949 f .replace ("DEPLOY_KERNEL_URL" , f .kernelURL )
5050 f .replace ("DEPLOY_RAMDISK_URL" , f .ramdiskURL )
5151 f .replace ("DEPLOY_ISO_URL" , f .isoURL )
52- f .replace ("LIVE_ISO_FORCE_PERSISTENT_BOOT_DEVICE" , f .liveISOForcePersistentBootDevice )
52+ f .replace ("LIVE_ISO_FORCE_PERSISTENT_BOOT_DEVICE" , f .forcePersistentBootDevice )
5353 f .replace ("IRONIC_CACERT_FILE" , f .ironicCACertFile )
5454 f .replace ("IRONIC_CLIENT_CERT_FILE" , f .ironicClientCertFile )
5555 f .replace ("IRONIC_CLIENT_PRIVATE_KEY_FILE" , f .ironicClientPrivateKeyFile )
@@ -61,7 +61,7 @@ func (f EnvFixture) VerifyConfig(t *testing.T, c ironicConfig, _ string) {
6161 assert .Equal (t , f .kernelURL , c .deployKernelURL )
6262 assert .Equal (t , f .ramdiskURL , c .deployRamdiskURL )
6363 assert .Equal (t , f .isoURL , c .deployISOURL )
64- assert .Equal (t , f .liveISOForcePersistentBootDevice , c .liveISOForcePersistentBootDevice )
64+ assert .Equal (t , f .forcePersistentBootDevice , c .forcePersistentBootDevice )
6565}
6666
6767func (f EnvFixture ) VerifyEndpoints (t * testing.T , ironic string ) {
@@ -131,34 +131,71 @@ func TestLoadConfigFromEnv(t *testing.T) {
131131 expectedImgBuildError : "DEPLOY_RAMDISK_URL requires DEPLOY_KERNEL_URL to be set also" ,
132132 },
133133 {
134- name : "Force Persistent Default" ,
134+ name : "ISO Force Persistent Default" ,
135135 env : EnvFixture {
136- isoURL : "http://iso" ,
137- liveISOForcePersistentBootDevice : "Default" ,
136+ isoURL : "http://iso" ,
137+ forcePersistentBootDevice : "Default" ,
138138 },
139139 forcePersistent : "Default" ,
140140 },
141141 {
142- name : "Force Persistent Never" ,
142+ name : "ISO Force Persistent Never" ,
143143 env : EnvFixture {
144- isoURL : "http://iso" ,
145- liveISOForcePersistentBootDevice : "Never" ,
144+ isoURL : "http://iso" ,
145+ forcePersistentBootDevice : "Never" ,
146146 },
147147 forcePersistent : "Never" ,
148148 },
149149 {
150- name : "Force Persistent Always" ,
150+ name : "ISO Force Persistent Always" ,
151151 env : EnvFixture {
152- isoURL : "http://iso" ,
153- liveISOForcePersistentBootDevice : "Always" ,
152+ isoURL : "http://iso" ,
153+ forcePersistentBootDevice : "Always" ,
154154 },
155155 forcePersistent : "Always" ,
156156 },
157157 {
158- name : "Force Persistent Invalid" ,
158+ name : "ISO Force Persistent Invalid" ,
159159 env : EnvFixture {
160- isoURL : "http://iso" ,
161- liveISOForcePersistentBootDevice : "NotAValidOption" ,
160+ isoURL : "http://iso" ,
161+ forcePersistentBootDevice : "NotAValidOption" ,
162+ },
163+ expectedError : "invalid value for variable LIVE_ISO_FORCE_PERSISTENT_BOOT_DEVICE" ,
164+ expectedImgBuildError : "invalid value for variable LIVE_ISO_FORCE_PERSISTENT_BOOT_DEVICE" ,
165+ },
166+ {
167+ name : "kernel/ramdisk Force Persistent Default" ,
168+ env : EnvFixture {
169+ kernelURL : "http://kernel" ,
170+ ramdiskURL : "http://ramdisk" ,
171+ forcePersistentBootDevice : "Default" ,
172+ },
173+ forcePersistent : "Default" ,
174+ },
175+ {
176+ name : "kernel/ramdisk Force Persistent Never" ,
177+ env : EnvFixture {
178+ kernelURL : "http://kernel" ,
179+ ramdiskURL : "http://ramdisk" ,
180+ forcePersistentBootDevice : "Never" ,
181+ },
182+ forcePersistent : "Never" ,
183+ },
184+ {
185+ name : "kernel/ramdisk Force Persistent Always" ,
186+ env : EnvFixture {
187+ kernelURL : "http://kernel" ,
188+ ramdiskURL : "http://ramdisk" ,
189+ forcePersistentBootDevice : "Always" ,
190+ },
191+ forcePersistent : "Always" ,
192+ },
193+ {
194+ name : "kernel/ramdisk Force Persistent Invalid" ,
195+ env : EnvFixture {
196+ kernelURL : "http://kernel" ,
197+ ramdiskURL : "http://ramdisk" ,
198+ forcePersistentBootDevice : "NotAValidOption" ,
162199 },
163200 expectedError : "invalid value for variable LIVE_ISO_FORCE_PERSISTENT_BOOT_DEVICE" ,
164201 expectedImgBuildError : "invalid value for variable LIVE_ISO_FORCE_PERSISTENT_BOOT_DEVICE" ,
0 commit comments