mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-13 05:46:16 +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)
|
||||
}
|
||||
|
||||
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
|
||||
testfiles.AddFileSource(e2etestingmanifests.GetE2ETestingManifestsFS())
|
||||
testfiles.AddFileSource(testfixtures.GetTestFixturesFS())
|
||||
|
@ -18,6 +18,7 @@ package kubeadm
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
@ -42,6 +43,10 @@ func TestMain(m *testing.M) {
|
||||
framework.RegisterClusterFlags(flag.CommandLine)
|
||||
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
|
||||
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)
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
@ -130,6 +130,10 @@ func TestMain(m *testing.M) {
|
||||
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
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)
|
||||
if err := e2eskipper.InitFeatureGates(utilfeature.DefaultFeatureGate, featureGates); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "ERROR: initialize feature gates: %v", err)
|
||||
|
Loading…
Reference in New Issue
Block a user