mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2024-12-14 11:57:51 +00:00
cc57fa6a93
Just drop it, bump to golang v1.20 will cause the generator to be automatically seeded at program startup: https://pkg.go.dev/math/rand@go1.20#Seed
69 lines
2 KiB
Go
69 lines
2 KiB
Go
/*
|
|
Copyright 2015 The Kubernetes Authors.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
package e2e
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"os"
|
|
"testing"
|
|
|
|
"k8s.io/kubernetes/test/e2e"
|
|
"k8s.io/kubernetes/test/e2e/framework"
|
|
"k8s.io/kubernetes/test/e2e/framework/config"
|
|
"k8s.io/kubernetes/test/e2e/framework/testfiles"
|
|
)
|
|
|
|
var (
|
|
dockerRepo = flag.String("nfd.repo", "gcr.io/k8s-staging-nfd/node-feature-discovery", "Docker repository to fetch image from")
|
|
dockerTag = flag.String("nfd.tag", "master", "Docker tag to use")
|
|
)
|
|
|
|
// handleFlags sets up all flags and parses the command line.
|
|
func handleFlags() {
|
|
config.CopyFlags(config.Flags, flag.CommandLine)
|
|
framework.RegisterCommonFlags(flag.CommandLine)
|
|
framework.RegisterClusterFlags(flag.CommandLine)
|
|
flag.Parse()
|
|
}
|
|
|
|
// must be called after flags are parsed
|
|
func dockerImage() string {
|
|
return fmt.Sprintf("%s:%s", *dockerRepo, *dockerTag)
|
|
}
|
|
|
|
func TestMain(m *testing.M) {
|
|
// Register test flags, then parse flags.
|
|
handleFlags()
|
|
|
|
framework.AfterReadingAllFlags(&framework.TestContext)
|
|
|
|
// TODO: Deprecating repo-root over time... instead just use gobindata_util.go , see #23987.
|
|
// Right now it is still needed, for example by
|
|
// test/e2e/framework/ingress/ingress_utils.go
|
|
// for providing the optional secret.yaml file and by
|
|
// test/e2e/framework/util.go for cluster/log-dump.
|
|
if framework.TestContext.RepoRoot != "" {
|
|
testfiles.AddFileSource(testfiles.RootFileSource{Root: framework.TestContext.RepoRoot})
|
|
}
|
|
|
|
os.Exit(m.Run())
|
|
}
|
|
|
|
func TestE2E(t *testing.T) {
|
|
e2e.RunE2ETests(t)
|
|
}
|