@@ -42,6 +42,7 @@ import (
42
42
43
43
"k8s.io/minikube/pkg/drivers/kic/oci"
44
44
"k8s.io/minikube/pkg/minikube/config"
45
+ "k8s.io/minikube/pkg/minikube/constants"
45
46
"k8s.io/minikube/pkg/minikube/detect"
46
47
"k8s.io/minikube/pkg/minikube/localpath"
47
48
"k8s.io/minikube/pkg/minikube/reason"
@@ -72,9 +73,25 @@ var runCorpProxy = detect.GithubActionRunner() && runtime.GOOS == "linux" && !ar
72
73
73
74
// TestFunctional are functionality tests which can safely share a profile in parallel
74
75
func TestFunctional (t * testing.T ) {
76
+ testFunctional (t , "" )
77
+ }
78
+
79
+ // TestFunctionalNewestKuberentes are functionality run functional tests using NewestKubernetesVersion
80
+ func TestFunctionalNewestKuberentes (t * testing.T ) {
81
+ if strings .Contains (* startArgs , "--kubernetes-version" ) {
82
+ t .Skip ()
83
+ }
84
+ k8sVersionString := constants .NewestKubernetesVersion
85
+ t .Run ("Version" + k8sVersionString , func (t * testing.T ) {
86
+ testFunctional (t , k8sVersionString )
87
+ })
75
88
89
+ }
90
+
91
+ func testFunctional (t * testing.T , k8sVersion string ) {
76
92
profile := UniqueProfileName ("functional" )
77
- ctx , cancel := context .WithTimeout (context .Background (), Minutes (40 ))
93
+ ctx := context .WithValue (context .Background (), "k8sVersion" , k8sVersion )
94
+ ctx , cancel := context .WithTimeout (ctx , Minutes (40 ))
78
95
defer func () {
79
96
if ! * cleanup {
80
97
return
@@ -86,7 +103,6 @@ func TestFunctional(t *testing.T) {
86
103
87
104
Cleanup (t , profile , cancel )
88
105
}()
89
-
90
106
// Serial tests
91
107
t .Run ("serial" , func (t * testing.T ) {
92
108
tests := []struct {
@@ -965,7 +981,7 @@ func validateDryRun(ctx context.Context, t *testing.T, profile string) {
965
981
966
982
// docs: Run `minikube start --dry-run --memory 250MB`
967
983
// Too little memory!
968
- startArgs := append ([]string {"start" , "-p" , profile , "--dry-run" , "--memory" , "250MB" , "--alsologtostderr" }, StartArgs ( )... )
984
+ startArgs := append ([]string {"start" , "-p" , profile , "--dry-run" , "--memory" , "250MB" , "--alsologtostderr" }, StartArgsWithContext ( ctx )... )
969
985
c := exec .CommandContext (mctx , Target (), startArgs ... )
970
986
rr , err := Run (t , c )
971
987
@@ -982,7 +998,7 @@ func validateDryRun(ctx context.Context, t *testing.T, profile string) {
982
998
dctx , cancel := context .WithTimeout (ctx , timeout )
983
999
defer cancel ()
984
1000
// docs: Run `minikube start --dry-run`
985
- startArgs = append ([]string {"start" , "-p" , profile , "--dry-run" , "--alsologtostderr" , "-v=1" }, StartArgs ( )... )
1001
+ startArgs = append ([]string {"start" , "-p" , profile , "--dry-run" , "--alsologtostderr" , "-v=1" }, StartArgsWithContext ( ctx )... )
986
1002
c = exec .CommandContext (dctx , Target (), startArgs ... )
987
1003
rr , err = Run (t , c )
988
1004
// docs: Make sure the command doesn't raise any error
@@ -1007,7 +1023,7 @@ func validateInternationalLanguage(ctx context.Context, t *testing.T, profile st
1007
1023
defer cancel ()
1008
1024
1009
1025
// Too little memory!
1010
- startArgs := append ([]string {"start" , "-p" , profile , "--dry-run" , "--memory" , "250MB" , "--alsologtostderr" }, StartArgs ( )... )
1026
+ startArgs := append ([]string {"start" , "-p" , profile , "--dry-run" , "--memory" , "250MB" , "--alsologtostderr" }, StartArgsWithContext ( ctx )... )
1011
1027
c := exec .CommandContext (mctx , Target (), startArgs ... )
1012
1028
// docs: Set environment variable `LC_ALL=fr` to enable minikube translation to French
1013
1029
c .Env = append (os .Environ (), "LC_ALL=fr" )
@@ -2221,7 +2237,7 @@ func startMinikubeWithProxy(ctx context.Context, t *testing.T, profile string, p
2221
2237
memoryFlag = "--memory=6000"
2222
2238
}
2223
2239
// passing --api-server-port so later verify it didn't change in soft start.
2224
- startArgs := append ([]string {"start" , "-p" , profile , memoryFlag , fmt .Sprintf ("--apiserver-port=%d" , apiPortTest ), "--wait=all" }, StartArgs ( )... )
2240
+ startArgs := append ([]string {"start" , "-p" , profile , memoryFlag , fmt .Sprintf ("--apiserver-port=%d" , apiPortTest ), "--wait=all" }, StartArgsWithContext ( ctx )... )
2225
2241
c := exec .CommandContext (ctx , Target (), startArgs ... )
2226
2242
env := os .Environ ()
2227
2243
env = append (env , fmt .Sprintf ("%s=%s" , proxyEnv , addr ))
0 commit comments