mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-14 14:23:37 +00:00
Merge pull request #119103 from pohly/e2e-unexpected-args
e2e: detect unexpected command line arguments
This commit is contained in:
commit
ddb2013363
@ -92,6 +92,11 @@ func TestMain(m *testing.M) {
|
|||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if flag.CommandLine.NArg() > 0 {
|
||||||
|
fmt.Fprintf(os.Stderr, "unknown additional command line arguments: %s", flag.CommandLine.Args())
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
// Enable embedded FS file lookup as fallback
|
// Enable embedded FS file lookup as fallback
|
||||||
testfiles.AddFileSource(e2etestingmanifests.GetE2ETestingManifestsFS())
|
testfiles.AddFileSource(e2etestingmanifests.GetE2ETestingManifestsFS())
|
||||||
testfiles.AddFileSource(testfixtures.GetTestFixturesFS())
|
testfiles.AddFileSource(testfixtures.GetTestFixturesFS())
|
||||||
|
@ -18,6 +18,7 @@ package kubeadm
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
@ -42,6 +43,10 @@ func TestMain(m *testing.M) {
|
|||||||
framework.RegisterClusterFlags(flag.CommandLine)
|
framework.RegisterClusterFlags(flag.CommandLine)
|
||||||
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
|
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
|
||||||
pflag.Parse()
|
pflag.Parse()
|
||||||
|
if pflag.CommandLine.NArg() > 0 {
|
||||||
|
fmt.Fprintf(os.Stderr, "unknown additional command line arguments: %s", pflag.CommandLine.Args())
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
framework.AfterReadingAllFlags(&framework.TestContext)
|
framework.AfterReadingAllFlags(&framework.TestContext)
|
||||||
os.Exit(m.Run())
|
os.Exit(m.Run())
|
||||||
}
|
}
|
||||||
|
@ -130,6 +130,10 @@ func TestMain(m *testing.M) {
|
|||||||
|
|
||||||
rand.Seed(time.Now().UnixNano())
|
rand.Seed(time.Now().UnixNano())
|
||||||
pflag.Parse()
|
pflag.Parse()
|
||||||
|
if pflag.CommandLine.NArg() > 0 {
|
||||||
|
fmt.Fprintf(os.Stderr, "unknown additional command line arguments: %s", pflag.CommandLine.Args())
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
framework.AfterReadingAllFlags(&framework.TestContext)
|
framework.AfterReadingAllFlags(&framework.TestContext)
|
||||||
if err := e2eskipper.InitFeatureGates(utilfeature.DefaultFeatureGate, featureGates); err != nil {
|
if err := e2eskipper.InitFeatureGates(utilfeature.DefaultFeatureGate, featureGates); err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "ERROR: initialize feature gates: %v", err)
|
fmt.Fprintf(os.Stderr, "ERROR: initialize feature gates: %v", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user