@@ -10,16 +10,17 @@ 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+ liveISOForcePersistentBootDevice string
18+ kernelAndRamdiskForcePersistentBootDevice string
19+ ironicCACertFile string
20+ ironicClientCertFile string
21+ ironicClientPrivateKeyFile string
22+ ironicInsecure string
23+ ironicSkipClientSANVerify string
2324
2425 origEnv map [string ]string
2526}
@@ -50,6 +51,7 @@ func (f *EnvFixture) SetUp() {
5051 f .replace ("DEPLOY_RAMDISK_URL" , f .ramdiskURL )
5152 f .replace ("DEPLOY_ISO_URL" , f .isoURL )
5253 f .replace ("LIVE_ISO_FORCE_PERSISTENT_BOOT_DEVICE" , f .liveISOForcePersistentBootDevice )
54+ f .replace ("KERNEL_AND_RAMDISK_FORCE_PERSISTENT_BOOT_DEVICE" , f .kernelAndRamdiskForcePersistentBootDevice )
5355 f .replace ("IRONIC_CACERT_FILE" , f .ironicCACertFile )
5456 f .replace ("IRONIC_CLIENT_CERT_FILE" , f .ironicClientCertFile )
5557 f .replace ("IRONIC_CLIENT_PRIVATE_KEY_FILE" , f .ironicClientPrivateKeyFile )
@@ -62,6 +64,7 @@ func (f EnvFixture) VerifyConfig(t *testing.T, c ironicConfig, _ string) {
6264 assert .Equal (t , f .ramdiskURL , c .deployRamdiskURL )
6365 assert .Equal (t , f .isoURL , c .deployISOURL )
6466 assert .Equal (t , f .liveISOForcePersistentBootDevice , c .liveISOForcePersistentBootDevice )
67+ assert .Equal (t , f .kernelAndRamdiskForcePersistentBootDevice , c .kernelAndRamdiskForcePersistentBootDevice )
6568}
6669
6770func (f EnvFixture ) VerifyEndpoints (t * testing.T , ironic string ) {
@@ -131,38 +134,75 @@ func TestLoadConfigFromEnv(t *testing.T) {
131134 expectedImgBuildError : "DEPLOY_RAMDISK_URL requires DEPLOY_KERNEL_URL to be set also" ,
132135 },
133136 {
134- name : "Force Persistent Default" ,
137+ name : "ISO Force Persistent Default" ,
135138 env : EnvFixture {
136139 isoURL : "http://iso" ,
137140 liveISOForcePersistentBootDevice : "Default" ,
138141 },
139142 forcePersistent : "Default" ,
140143 },
141144 {
142- name : "Force Persistent Never" ,
145+ name : "ISO Force Persistent Never" ,
143146 env : EnvFixture {
144147 isoURL : "http://iso" ,
145148 liveISOForcePersistentBootDevice : "Never" ,
146149 },
147150 forcePersistent : "Never" ,
148151 },
149152 {
150- name : "Force Persistent Always" ,
153+ name : "ISO Force Persistent Always" ,
151154 env : EnvFixture {
152155 isoURL : "http://iso" ,
153156 liveISOForcePersistentBootDevice : "Always" ,
154157 },
155158 forcePersistent : "Always" ,
156159 },
157160 {
158- name : "Force Persistent Invalid" ,
161+ name : "ISO Force Persistent Invalid" ,
159162 env : EnvFixture {
160163 isoURL : "http://iso" ,
161164 liveISOForcePersistentBootDevice : "NotAValidOption" ,
162165 },
163166 expectedError : "invalid value for variable LIVE_ISO_FORCE_PERSISTENT_BOOT_DEVICE" ,
164167 expectedImgBuildError : "invalid value for variable LIVE_ISO_FORCE_PERSISTENT_BOOT_DEVICE" ,
165168 },
169+ {
170+ name : "kernel/ramdisk Force Persistent Default" ,
171+ env : EnvFixture {
172+ kernelURL : "http://kernel" ,
173+ ramdiskURL : "http://ramdisk" ,
174+ kernelAndRamdiskForcePersistentBootDevice : "Default" ,
175+ },
176+ forcePersistent : "Default" ,
177+ },
178+ {
179+ name : "kernel/ramdisk Force Persistent Never" ,
180+ env : EnvFixture {
181+ kernelURL : "http://kernel" ,
182+ ramdiskURL : "http://ramdisk" ,
183+ kernelAndRamdiskForcePersistentBootDevice : "Never" ,
184+ },
185+ forcePersistent : "Never" ,
186+ },
187+ {
188+ name : "kernel/ramdisk Force Persistent Always" ,
189+ env : EnvFixture {
190+ kernelURL : "http://kernel" ,
191+ ramdiskURL : "http://ramdisk" ,
192+ kernelAndRamdiskForcePersistentBootDevice : "Always" ,
193+ },
194+ forcePersistent : "Always" ,
195+ },
196+ {
197+ name : "kernel/ramdisk Force Persistent Invalid" ,
198+ env : EnvFixture {
199+ kernelURL : "http://kernel" ,
200+ ramdiskURL : "http://ramdisk" ,
201+ kernelAndRamdiskForcePersistentBootDevice : "NotAValidOption" ,
202+ },
203+ expectedError : "invalid value for variable KERNEL_AND_RAMDISK_FORCE_PERSISTENT_BOOT_DEVICE" ,
204+ expectedImgBuildError : "invalid value for variable KERNEL_AND_RAMDISK_FORCE_PERSISTENT_BOOT_DEVICE" ,
205+ },
166206 }
167207
168208 for _ , tt := range []string {"" , " (with img builder)" } {
0 commit comments