mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2025-03-28 02:37:11 +00:00
Add empty e2e test stub
Patch the (Kubernetes) e2e wireframe introduced in the previous commit with some minor modifications, dropping some bits in order to simplify the code. Also adds a dummy test stub for node feature discovery.
This commit is contained in:
parent
b284b2f42b
commit
9065c7adbe
3 changed files with 74 additions and 68 deletions
|
@ -18,7 +18,6 @@ package e2e
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"testing"
|
||||
|
@ -32,28 +31,11 @@ import (
|
|||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtimeutils "k8s.io/apimachinery/pkg/util/runtime"
|
||||
"k8s.io/apiserver/pkg/util/logs"
|
||||
clientset "k8s.io/client-go/kubernetes"
|
||||
"k8s.io/kubernetes/pkg/version"
|
||||
commontest "k8s.io/kubernetes/test/e2e/common"
|
||||
"k8s.io/kubernetes/test/e2e/framework"
|
||||
"k8s.io/kubernetes/test/e2e/framework/ginkgowrapper"
|
||||
"k8s.io/kubernetes/test/e2e/framework/metrics"
|
||||
"k8s.io/kubernetes/test/e2e/manifest"
|
||||
testutils "k8s.io/kubernetes/test/utils"
|
||||
|
||||
// ensure auth plugins are loaded
|
||||
_ "k8s.io/client-go/plugin/pkg/client/auth"
|
||||
|
||||
// ensure that cloud providers are loaded
|
||||
_ "k8s.io/kubernetes/test/e2e/framework/providers/aws"
|
||||
_ "k8s.io/kubernetes/test/e2e/framework/providers/azure"
|
||||
_ "k8s.io/kubernetes/test/e2e/framework/providers/gce"
|
||||
_ "k8s.io/kubernetes/test/e2e/framework/providers/kubemark"
|
||||
)
|
||||
|
||||
var (
|
||||
cloudConfig = &framework.TestContext.CloudConfig
|
||||
)
|
||||
|
||||
// There are certain operations we only want to run once per overall test invocation
|
||||
|
@ -67,11 +49,6 @@ var (
|
|||
var _ = ginkgo.SynchronizedBeforeSuite(func() []byte {
|
||||
// Run only on Ginkgo node 1
|
||||
|
||||
switch framework.TestContext.Provider {
|
||||
case "gce", "gke":
|
||||
framework.LogClusterImageSources()
|
||||
}
|
||||
|
||||
c, err := framework.LoadClientset()
|
||||
if err != nil {
|
||||
klog.Fatal("Error loading client: ", err)
|
||||
|
@ -120,9 +97,6 @@ var _ = ginkgo.SynchronizedBeforeSuite(func() []byte {
|
|||
framework.Logf("WARNING: Waiting for all daemonsets to be ready failed: %v", err)
|
||||
}
|
||||
|
||||
// Log the version of the server and this client.
|
||||
framework.Logf("e2e test version: %s", version.Get().GitVersion)
|
||||
|
||||
dc := c.DiscoveryClient
|
||||
|
||||
serverVersion, serverErr := dc.ServerVersion()
|
||||
|
@ -133,9 +107,6 @@ var _ = ginkgo.SynchronizedBeforeSuite(func() []byte {
|
|||
framework.Logf("kube-apiserver version: %s", serverVersion.GitVersion)
|
||||
}
|
||||
|
||||
// Reference common test to make the import valid.
|
||||
commontest.CurrentSuite = commontest.E2E
|
||||
|
||||
return nil
|
||||
|
||||
}, func(data []byte) {
|
||||
|
@ -155,45 +126,8 @@ var _ = ginkgo.SynchronizedAfterSuite(func() {
|
|||
if framework.TestContext.ReportDir != "" {
|
||||
framework.CoreDump(framework.TestContext.ReportDir)
|
||||
}
|
||||
if framework.TestContext.GatherSuiteMetricsAfterTest {
|
||||
if err := gatherTestSuiteMetrics(); err != nil {
|
||||
framework.Logf("Error gathering metrics: %v", err)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
func gatherTestSuiteMetrics() error {
|
||||
framework.Logf("Gathering metrics")
|
||||
c, err := framework.LoadClientset()
|
||||
if err != nil {
|
||||
return fmt.Errorf("error loading client: %v", err)
|
||||
}
|
||||
|
||||
// Grab metrics for apiserver, scheduler, controller-manager, kubelet (for non-kubemark case) and cluster autoscaler (optionally).
|
||||
grabber, err := metrics.NewMetricsGrabber(c, nil, !framework.ProviderIs("kubemark"), true, true, true, framework.TestContext.IncludeClusterAutoscalerMetrics)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create MetricsGrabber: %v", err)
|
||||
}
|
||||
|
||||
received, err := grabber.Grab()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to grab metrics: %v", err)
|
||||
}
|
||||
|
||||
metricsForE2E := (*framework.MetricsForE2E)(&received)
|
||||
metricsJSON := metricsForE2E.PrintJSON()
|
||||
if framework.TestContext.ReportDir != "" {
|
||||
filePath := path.Join(framework.TestContext.ReportDir, "MetricsForE2ESuite_"+time.Now().Format(time.RFC3339)+".json")
|
||||
if err := ioutil.WriteFile(filePath, []byte(metricsJSON), 0644); err != nil {
|
||||
return fmt.Errorf("error writing to %q: %v", filePath, err)
|
||||
}
|
||||
} else {
|
||||
framework.Logf("\n\nTest Suite Metrics:\n%s\n", metricsJSON)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// RunE2ETests checks configuration parameters (specified through flags) and then runs
|
||||
// E2E tests using the Ginkgo runner.
|
||||
// If a "report directory" is specified, one or more JUnit test reports will be
|
||||
|
@ -201,8 +135,6 @@ func gatherTestSuiteMetrics() error {
|
|||
// This function is called on each Ginkgo node in parallel mode.
|
||||
func RunE2ETests(t *testing.T) {
|
||||
runtimeutils.ReallyCrash = true
|
||||
logs.InitLogs()
|
||||
defer logs.FlushLogs()
|
||||
|
||||
gomega.RegisterFailHandler(ginkgowrapper.Fail)
|
||||
// Disable skipped tests unless they are explicitly requested.
|
||||
|
|
43
test/e2e/e2e_test.go
Normal file
43
test/e2e/e2e_test.go
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
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 (
|
||||
"testing"
|
||||
|
||||
"k8s.io/kubernetes/test/e2e/framework"
|
||||
"k8s.io/kubernetes/test/e2e/framework/testfiles"
|
||||
)
|
||||
|
||||
func init() {
|
||||
// Register framework flags, then handle flags and Viper config.
|
||||
framework.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})
|
||||
}
|
||||
}
|
||||
|
||||
func TestE2E(t *testing.T) {
|
||||
RunE2ETests(t)
|
||||
}
|
31
test/e2e/node_feature_discovery.go
Normal file
31
test/e2e/node_feature_discovery.go
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
Copyright 2018 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 (
|
||||
"k8s.io/kubernetes/test/e2e/framework"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
)
|
||||
|
||||
var _ = framework.KubeDescribe("Node Feature Discovery", func() {
|
||||
Context("when not deployed", func() {
|
||||
It("should do nothing", func() {
|
||||
By("empty step")
|
||||
})
|
||||
})
|
||||
})
|
Loading…
Add table
Reference in a new issue