Commit fa476b80 authored by Vishnu kannan's avatar Vishnu kannan

Framework support for node e2e.

parent 4c7abddc
......@@ -18,7 +18,7 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${KUBE_ROOT}/hack/lib/init.sh"
kube::golang::setup_env
focus=${FOCUS}
focus=${FOCUS:-""}
skip=${SKIP:-""}
ginkgo=$(kube::util::find-binary "ginkgo")
......
......@@ -93,14 +93,15 @@ func NewDefaultFramework(baseName string) *Framework {
ClientQPS: 20,
ClientBurst: 50,
}
return NewFramework(baseName, options)
return NewFramework(baseName, options, nil)
}
func NewFramework(baseName string, options FrameworkOptions) *Framework {
func NewFramework(baseName string, options FrameworkOptions, client *client.Client) *Framework {
f := &Framework{
BaseName: baseName,
AddonResourceConstraints: make(map[string]ResourceConstraint),
options: options,
Client: client,
}
BeforeEach(f.BeforeEach)
......@@ -115,17 +116,18 @@ func (f *Framework) BeforeEach() {
// https://github.com/onsi/ginkgo/issues/222
f.cleanupHandle = AddCleanupAction(f.AfterEach)
By("Creating a kubernetes client")
config, err := LoadConfig()
Expect(err).NotTo(HaveOccurred())
config.QPS = f.options.ClientQPS
config.Burst = f.options.ClientBurst
c, err := loadClientFromConfig(config)
Expect(err).NotTo(HaveOccurred())
f.Client = c
f.Clientset_1_2 = adapter_1_2.FromUnversionedClient(c)
f.Clientset_1_3 = adapter_1_3.FromUnversionedClient(c)
if f.Client == nil {
By("Creating a kubernetes client")
config, err := LoadConfig()
Expect(err).NotTo(HaveOccurred())
config.QPS = f.options.ClientQPS
config.Burst = f.options.ClientBurst
c, err := loadClientFromConfig(config)
Expect(err).NotTo(HaveOccurred())
f.Client = c
}
f.Clientset_1_2 = adapter_1_2.FromUnversionedClient(f.Client)
f.Clientset_1_3 = adapter_1_3.FromUnversionedClient(f.Client)
By("Building a namespace api object")
namespace, err := f.CreateNamespace(f.BaseName, map[string]string{
......@@ -137,14 +139,14 @@ func (f *Framework) BeforeEach() {
if TestContext.VerifyServiceAccount {
By("Waiting for a default service account to be provisioned in namespace")
err = WaitForDefaultServiceAccountInNamespace(c, namespace.Name)
err = WaitForDefaultServiceAccountInNamespace(f.Client, namespace.Name)
Expect(err).NotTo(HaveOccurred())
} else {
Logf("Skipping waiting for service account")
}
if TestContext.GatherKubeSystemResourceUsageData {
f.gatherer, err = NewResourceUsageGatherer(c, ResourceGathererOptions{inKubemark: ProviderIs("kubemark")})
f.gatherer, err = NewResourceUsageGatherer(f.Client, ResourceGathererOptions{inKubemark: ProviderIs("kubemark")})
if err != nil {
Logf("Error while creating NewResourceUsageGatherer: %v", err)
} else {
......@@ -156,7 +158,7 @@ func (f *Framework) BeforeEach() {
f.logsSizeWaitGroup = sync.WaitGroup{}
f.logsSizeWaitGroup.Add(1)
f.logsSizeCloseChannel = make(chan bool)
f.logsSizeVerifier = NewLogsVerifier(c, f.logsSizeCloseChannel)
f.logsSizeVerifier = NewLogsVerifier(f.Client, f.logsSizeCloseChannel)
go func() {
f.logsSizeVerifier.Run()
f.logsSizeWaitGroup.Done()
......
......@@ -71,7 +71,7 @@ var _ = framework.KubeDescribe("Load capacity", func() {
ClientQPS: 50,
ClientBurst: 100,
}
f := framework.NewFramework("load", options)
f := framework.NewFramework("load", options, nil)
f.NamespaceDeletionTimeout = time.Hour
BeforeEach(func() {
......
......@@ -35,13 +35,6 @@ import (
. "github.com/onsi/gomega"
)
var kubeletAddress = flag.String("kubelet-address", "http://127.0.0.1:10255", "Host and port of the kubelet")
var apiServerAddress = flag.String("api-server-address", "http://127.0.0.1:8080", "Host and port of the api server")
var nodeName = flag.String("node-name", "", "Name of the node")
var buildServices = flag.Bool("build-services", true, "If true, build local executables")
var startServices = flag.Bool("start-services", true, "If true, start local node services")
var stopServices = flag.Bool("stop-services", true, "If true, stop local node services after running tests")
var e2es *e2eService
func TestE2eNode(t *testing.T) {
......
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
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_node
import (
"flag"
"k8s.io/kubernetes/pkg/client/restclient"
client "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/test/e2e/framework"
)
var kubeletAddress = flag.String("kubelet-address", "http://127.0.0.1:10255", "Host and port of the kubelet")
var apiServerAddress = flag.String("api-server-address", "http://127.0.0.1:8080", "Host and port of the api server")
var nodeName = flag.String("node-name", "", "Name of the node")
var buildServices = flag.Bool("build-services", true, "If true, build local executables")
var startServices = flag.Bool("start-services", true, "If true, start local node services")
var stopServices = flag.Bool("stop-services", true, "If true, stop local node services after running tests")
func NewDefaultFramework(baseName string) *framework.Framework {
client := client.NewOrDie(&restclient.Config{Host: *apiServerAddress})
return framework.NewFramework(baseName, framework.FrameworkOptions{
ClientQPS: 100,
ClientBurst: 100,
}, client)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment