Merge pull request #75989 from neolit123/remove-aggregator-from-e2e-fw

[e2e] decouple the aggregated clientset from the e2e testing framework
This commit is contained in:
Kubernetes Prow Robot 2019-04-16 16:20:09 -07:00 committed by GitHub
commit 92e087c402
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 11 deletions

View File

@ -25,7 +25,7 @@ import (
"time"
apps "k8s.io/api/apps/v1"
"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
rbacv1beta1 "k8s.io/api/rbac/v1beta1"
apierrs "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@ -74,7 +74,17 @@ var _ = SIGDescribe("Aggregator", func() {
ginkgo.BeforeEach(func() {
c = f.ClientSet
ns = f.Namespace.Name
aggrclient = f.AggregatorClient
if aggrclient == nil {
config, err := framework.LoadConfig()
if err != nil {
framework.Failf("could not load config: %v", err)
}
aggrclient, err = aggregatorclient.NewForConfig(config)
if err != nil {
framework.Failf("could not create aggregator client: %v", err)
}
}
})
/*
@ -84,7 +94,7 @@ var _ = SIGDescribe("Aggregator", func() {
*/
framework.ConformanceIt("Should be able to support the 1.10 Sample API Server using the current Aggregator", func() {
// Testing a 1.10 version of the sample-apiserver
TestSampleAPIServer(f, imageutils.GetE2EImage(imageutils.APIServer))
TestSampleAPIServer(f, aggrclient, imageutils.GetE2EImage(imageutils.APIServer))
})
})
@ -104,11 +114,10 @@ func cleanTest(client clientset.Interface, aggrclient *aggregatorclient.Clientse
// TestSampleAPIServer is a basic test if the sample-apiserver code from 1.10 and compiled against 1.10
// will work on the current Aggregator/API-Server.
func TestSampleAPIServer(f *framework.Framework, image string) {
func TestSampleAPIServer(f *framework.Framework, aggrclient *aggregatorclient.Clientset, image string) {
ginkgo.By("Registering the sample API server.")
client := f.ClientSet
restClient := client.Discovery().RESTClient()
aggrclient := f.AggregatorClient
namespace := f.Namespace.Name
context := setupServerCert(namespace, "sample-api")

View File

@ -116,7 +116,6 @@ go_library(
"//staging/src/k8s.io/client-go/tools/watch:go_default_library",
"//staging/src/k8s.io/client-go/util/retry:go_default_library",
"//staging/src/k8s.io/component-base/cli/flag:go_default_library",
"//staging/src/k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset:go_default_library",
"//test/e2e/framework/ginkgowrapper:go_default_library",
"//test/e2e/framework/metrics:go_default_library",
"//test/e2e/framework/testfiles:go_default_library",

View File

@ -46,7 +46,6 @@ import (
"k8s.io/client-go/rest"
"k8s.io/client-go/restmapper"
scaleclient "k8s.io/client-go/scale"
aggregatorclient "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset"
"k8s.io/kubernetes/test/e2e/framework/metrics"
testutils "k8s.io/kubernetes/test/utils"
@ -75,8 +74,7 @@ type Framework struct {
ClientSet clientset.Interface
KubemarkExternalClusterClientSet clientset.Interface
AggregatorClient *aggregatorclient.Clientset
DynamicClient dynamic.Interface
DynamicClient dynamic.Interface
ScalesGetter scaleclient.ScalesGetter
@ -182,8 +180,6 @@ func (f *Framework) BeforeEach() {
}
f.ClientSet, err = clientset.NewForConfig(config)
ExpectNoError(err)
f.AggregatorClient, err = aggregatorclient.NewForConfig(config)
ExpectNoError(err)
f.DynamicClient, err = dynamic.NewForConfig(config)
ExpectNoError(err)
// node.k8s.io is based on CRD, which is served only as JSON