@@ -88,6 +88,7 @@ func TestFunctional(t *testing.T) {
88
88
{"CacheCmd" , validateCacheCmd }, // Caches images needed for subsequent tests because of proxy
89
89
{"MinikubeKubectlCmd" , validateMinikubeKubectl }, // Make sure `minikube kubectl` works
90
90
{"MinikubeKubectlCmdDirectly" , validateMinikubeKubectlDirectCall },
91
+ {"ExtraConfig" , validateExtraConfig }, // Ensure extra cmdline config change is saved
91
92
}
92
93
for _ , tc := range tests {
93
94
tc := tc
@@ -336,6 +337,32 @@ func validateMinikubeKubectlDirectCall(ctx context.Context, t *testing.T, profil
336
337
337
338
}
338
339
340
+ func validateExtraConfig (ctx context.Context , t * testing.T , profile string ) {
341
+ defer PostMortemLogs (t , profile )
342
+
343
+ start := time .Now ()
344
+ // The tests before this already created a profile, starting minikube with different --extra-config cmdline option.
345
+ startArgs := []string {"start" , "-p" , profile , "--extra-config=apiserver.enable-admission-plugins=NamespaceAutoProvision" }
346
+ c := exec .CommandContext (ctx , Target (), startArgs ... )
347
+ rr , err := Run (t , c )
348
+ if err != nil {
349
+ t .Errorf ("failed to restart minikube. args %q: %v" , rr .Command (), err )
350
+ }
351
+ t .Logf ("restart took %s for %q cluster." , time .Since (start ), profile )
352
+
353
+ afterCfg , err := config .LoadProfile (profile )
354
+ if err != nil {
355
+ t .Errorf ("error reading cluster config after soft start: %v" , err )
356
+ }
357
+
358
+ expectedExtraOptions := "apiserver.enable-admission-plugins=NamespaceAutoProvision"
359
+
360
+ if ! strings .Contains (afterCfg .Config .KubernetesConfig .ExtraOptions .String (), expectedExtraOptions ) {
361
+ t .Errorf ("expected ExtraOptions to contain %s but got %s" , expectedExtraOptions , afterCfg .Config .KubernetesConfig .ExtraOptions .String ())
362
+ }
363
+
364
+ }
365
+
339
366
// validateComponentHealth asserts that all Kubernetes components are healthy
340
367
func validateComponentHealth (ctx context.Context , t * testing.T , profile string ) {
341
368
defer PostMortemLogs (t , profile )
0 commit comments