Skip to content

Commit

Permalink
Merge pull request kubernetes#21882 from gmarek/throttle
Browse files Browse the repository at this point in the history
Auto commit by PR queue bot
  • Loading branch information
k8s-merge-robot committed Mar 1, 2016
2 parents bf534a4 + 110340c commit 9e5d1b6
Show file tree
Hide file tree
Showing 68 changed files with 102 additions and 87 deletions.
2 changes: 1 addition & 1 deletion test/e2e/addon_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ var _ = Describe("Addon update", func() {

var dir string
var sshClient *ssh.Client
f := NewFramework("addon-update-test")
f := NewDefaultFramework("addon-update-test")

BeforeEach(func() {
// This test requires:
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/cadvisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const (

var _ = Describe("Cadvisor", func() {

f := NewFramework("cadvisor")
f := NewDefaultFramework("cadvisor")

It("should be healthy on every node.", func() {
CheckCadvisorHealthOnAllNodes(f.Client, 5*time.Minute)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/cluster_size_autoscaling.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const (
//
// These tests take ~20 minutes to run each.
var _ = Describe("Cluster size autoscaling [Feature:ClusterSizeAutoscaling] [Slow]", func() {
f := NewFramework("autoscaling")
f := NewDefaultFramework("autoscaling")
var nodeCount int
var coresPerNode int
var memCapacityMb int
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/cluster_upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ var _ = Describe("Upgrade [Feature:Upgrade]", func() {
Logf("Version for %q is %q", testContext.UpgradeTarget, v)
})

f := NewFramework("cluster-upgrade")
f := NewDefaultFramework("cluster-upgrade")
var w *ServiceTestFixture
BeforeEach(func() {
By("Setting up the service, RC, and pods")
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (

var _ = Describe("ConfigMap", func() {

f := NewFramework("configmap")
f := NewDefaultFramework("configmap")

It("should be consumable from pods in volume [Conformance]", func() {
name := "configmap-test-volume-" + string(util.NewUUID())
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/container_probe.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const (
)

var _ = Describe("Probing container", func() {
framework := NewFramework("container-probe")
framework := NewDefaultFramework("container-probe")
var podClient client.PodInterface
probe := webserverProbeBuilder{}

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/daemon_restart.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func getContainerRestarts(c *client.Client, ns string, labelSelector labels.Sele

var _ = Describe("DaemonRestart [Disruptive]", func() {

framework := NewFramework("daemonrestart")
framework := NewDefaultFramework("daemonrestart")
rcName := "daemonrestart" + strconv.Itoa(numPods) + "-" + string(util.NewUUID())
labelSelector := labels.Set(map[string]string{"name": rcName}).AsSelector()
existingPods := cache.NewStore(cache.MetaNamespaceKeyFunc)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/daemon_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ var _ = Describe("Daemon set [Serial]", func() {
Expect(err).NotTo(HaveOccurred())
})

f = NewFramework("daemonsets")
f = NewDefaultFramework("daemonsets")

image := "gcr.io/google_containers/serve_hostname:1.1"
dsName := "daemon-set"
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var _ = Describe("Kubernetes Dashboard", func() {
serverStartTimeout = 1 * time.Minute
)

f := NewFramework(uiServiceName)
f := NewDefaultFramework(uiServiceName)

It("should check that the kubernetes-dashboard instance is alive", func() {
By("Checking whether the kubernetes-dashboard service exists.")
Expand Down
18 changes: 7 additions & 11 deletions test/e2e/density.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,19 +145,15 @@ var _ = Describe("Density", func() {

// Explicitly put here, to delete namespace at the end of the test
// (after measuring latency metrics, etc.).framework := NewFramework("density")
framework := NewFramework("density")
options := FrameworkOptions{
clientQPS: 20,
clientBurst: 30,
}
framework := NewFramework("density", options)
framework.NamespaceDeletionTimeout = time.Hour

BeforeEach(func() {
// Explicitly create a client with higher QPS limits.
// However, make those at most comparable to components.
config, err := loadConfig()
Expect(err).NotTo(HaveOccurred())
config.QPS = 20
config.Burst = 30
c, err = loadClientFromConfig(config)
Expect(err).NotTo(HaveOccurred())

c = framework.Client
ns = framework.Namespace.Name

nodes := ListSchedulableNodesOrDie(c)
Expand All @@ -167,7 +163,7 @@ var _ = Describe("Density", func() {
// Terminating a namespace (deleting the remaining objects from it - which
// generally means events) can affect the current run. Thus we wait for all
// terminating namespace to be finally deleted before starting this test.
err = checkTestingNSDeletedExcept(c, ns)
err := checkTestingNSDeletedExcept(c, ns)
expectNoError(err)

uuid = string(util.NewUUID())
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import (
)

var _ = Describe("Deployment", func() {
f := NewFramework("deployment")
f := NewDefaultFramework("deployment")

It("deployment should create new pods", func() {
testNewDeployment(f)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func validateDNSResults(f *Framework, pod *api.Pod, fileNames []string) {
}

var _ = Describe("DNS", func() {
f := NewFramework("dns")
f := NewDefaultFramework("dns")

It("should provide DNS for the cluster", func() {
// TODO: support DNS on vagrant #3580
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/docker_containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
)

var _ = Describe("Docker Containers", func() {
framework := NewFramework("containers")
framework := NewDefaultFramework("containers")
var c *client.Client
var ns string

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/downward_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
)

var _ = Describe("Downward API", func() {
framework := NewFramework("downward-api")
framework := NewDefaultFramework("downward-api")

It("should provide pod name and namespace as env vars [Conformance]", func() {
podName := "downward-api-" + string(util.NewUUID())
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/downwardapi_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var _ = Describe("Downward API volume", func() {
// How long to wait for a log pod to be displayed
const podLogTimeout = 45 * time.Second

f := NewFramework("downward-api")
f := NewDefaultFramework("downward-api")
It("should provide podname only [Conformance]", func() {
podName := "downwardapi-volume-" + string(util.NewUUID())
pod := downwardAPIVolumePodForSimpleTest(podName, "/etc/podname")
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/empty_dir.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const (

var _ = Describe("EmptyDir volumes", func() {

f := NewFramework("emptydir")
f := NewDefaultFramework("emptydir")

Context("when FSGroup is specified [Feature:FSGroup]", func() {
It("new files should be created with FSGroup ownership when container is root", func() {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/empty_dir_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
// This test will create a pod with a secret volume and gitRepo volume
// Thus requests a secret, a git server pod, and a git server service
var _ = Describe("EmptyDir wrapper volumes", func() {
f := NewFramework("secrets")
f := NewDefaultFramework("secrets")

It("should becomes running", func() {
name := "secret-test-" + string(util.NewUUID())
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/es_cluster_logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
)

var _ = Describe("Cluster level logging using Elasticsearch [Feature:Elasticsearch]", func() {
f := NewFramework("es-logging")
f := NewDefaultFramework("es-logging")

BeforeEach(func() {
// TODO: For now assume we are only testing cluster logging with Elasticsearch
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/etcd_failure.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (

var _ = Describe("Etcd failure [Disruptive]", func() {

framework := NewFramework("etcd-failure")
framework := NewDefaultFramework("etcd-failure")

BeforeEach(func() {
// This test requires:
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
)

var _ = Describe("Events", func() {
framework := NewFramework("events")
framework := NewDefaultFramework("events")

It("should be sent by kubelets and the scheduler about pods scheduling and running [Conformance]", func() {

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/example_cluster_dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ except:
print 'err'`

var _ = Describe("ClusterDns [Feature:Example]", func() {
framework := NewFramework("cluster-dns")
framework := NewDefaultFramework("cluster-dns")

var c *client.Client
BeforeEach(func() {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/example_k8petstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ var _ = Describe("Pet Store [Feature:Example]", func() {

// The number of nodes dictates total number of generators/transaction expectations.
var nodeCount int
f := NewFramework("petstore")
f := NewDefaultFramework("petstore")

It(fmt.Sprintf("should scale to persist a nominal number ( %v ) of transactions in %v seconds", k8bpsSmokeTestFinalTransactions, k8bpsSmokeTestTimeout), func() {
nodes := ListSchedulableNodesOrDie(f.Client)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/examples.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const (
)

var _ = Describe("[Feature:Example]", func() {
framework := NewFramework("examples")
framework := NewDefaultFramework("examples")
var c *client.Client
var ns string
BeforeEach(func() {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/expansion.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
// These tests exercise the Kubernetes expansion syntax $(VAR).
// For more information, see: docs/design/expansion.md
var _ = Describe("Variable Expansion", func() {
framework := NewFramework("var-expansion")
framework := NewDefaultFramework("var-expansion")

It("should allow composing env vars into new env vars [Conformance]", func() {
podName := "var-expansion-" + string(util.NewUUID())
Expand Down
25 changes: 23 additions & 2 deletions test/e2e/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,36 @@ type Framework struct {
// we install a cleanup action before each test and clear it after. If we
// should abort, the AfterSuite hook should run all cleanup actions.
cleanupHandle CleanupActionHandle

// configuration for framework's client
options FrameworkOptions
}

type TestDataSummary interface {
PrintHumanReadable() string
PrintJSON() string
}

type FrameworkOptions struct {
clientQPS float32
clientBurst int
}

// NewFramework makes a new framework and sets up a BeforeEach/AfterEach for
// you (you can write additional before/after each functions).
func NewFramework(baseName string) *Framework {
func NewDefaultFramework(baseName string) *Framework {
options := FrameworkOptions{
clientQPS: 5,
clientBurst: 10,
}
return NewFramework(baseName, options)
}

func NewFramework(baseName string, options FrameworkOptions) *Framework {
f := &Framework{
BaseName: baseName,
addonResourceConstraints: make(map[string]resourceConstraint),
options: options,
}

BeforeEach(f.beforeEach)
Expand All @@ -93,7 +110,11 @@ func (f *Framework) beforeEach() {
f.cleanupHandle = AddCleanupAction(f.afterEach)

By("Creating a kubernetes client")
c, err := loadClient()
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
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/garbage_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
//
// Slow by design (7 min)
var _ = Describe("Garbage collector [Slow]", func() {
f := NewFramework("garbage-collector")
f := NewDefaultFramework("garbage-collector")
It("should handle the creation of 1000 pods", func() {
SkipUnlessProviderIs("gce")

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/generated_clientset.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
)

var _ = Describe("Generated release_1_2 clientset", func() {
framework := NewFramework("clientset")
framework := NewDefaultFramework("clientset")
It("should create pods, delete pods, watch pods", func() {
podClient := framework.Clientset_1_2.Core().Pods(framework.Namespace.Name)
By("creating the pod")
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/horizontal_pod_autoscaling.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const (
// These tests take ~20 minutes each.
var _ = Describe("Horizontal pod autoscaling (scale resource: CPU) [Serial] [Slow]", func() {
var rc *ResourceConsumer
f := NewFramework("horizontal-pod-autoscaling")
f := NewDefaultFramework("horizontal-pod-autoscaling")

titleUp := "Should scale from 1 pod to 3 pods and from 3 to 5"
titleDown := "Should scale from 5 pods to 3 pods and from 3 to 1"
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/host_path.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
//TODO : Consolidate this code with the code for emptyDir.
//This will require some smart.
var _ = Describe("hostPath", func() {
framework := NewFramework("hostpath")
framework := NewDefaultFramework("hostpath")
var c *client.Client
var namespace *api.Namespace

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/initial_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
//
// Flaky issue #20272
var _ = Describe("Initial Resources [Feature:InitialResources] [Flaky]", func() {
f := NewFramework("initial-resources")
f := NewDefaultFramework("initial-resources")

It("should set initial resources based on historical data", func() {
// TODO(piosz): Add cleanup data in InfluxDB that left from previous tests.
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const (
)

var _ = Describe("Job", func() {
f := NewFramework("job")
f := NewDefaultFramework("job")
parallelism := 2
completions := 4
lotsOfFailures := 5 // more than completions
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/kibana_logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
)

var _ = Describe("Kibana Logging Instances Is Alive", func() {
f := NewFramework("kibana-logging")
f := NewDefaultFramework("kibana-logging")

BeforeEach(func() {
// TODO: For now assume we are only testing cluster logging with Elasticsearch
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/kubectl.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ var (

var _ = Describe("Kubectl client", func() {
defer GinkgoRecover()
framework := NewFramework("kubectl")
framework := NewDefaultFramework("kubectl")
var c *client.Client
var ns string
BeforeEach(func() {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func waitTillNPodsRunningOnNodes(c *client.Client, nodeNames sets.String, podNam
var _ = Describe("kubelet", func() {
var numNodes int
var nodeNames sets.String
framework := NewFramework("kubelet")
framework := NewDefaultFramework("kubelet")
var resourceMonitor *resourceMonitor

BeforeEach(func() {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/kubelet_etc_hosts.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type KubeletManagedHostConfig struct {
}

var _ = Describe("KubeletManagedEtcHosts", func() {
f := NewFramework("e2e-kubelet-etc-hosts")
f := NewDefaultFramework("e2e-kubelet-etc-hosts")
config := &KubeletManagedHostConfig{
f: f,
}
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/kubelet_perf.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func verifyCPULimits(expected containersCPUSummary, actual nodesCPUSummary) {
// Slow by design (1 hour)
var _ = Describe("Kubelet [Serial] [Slow]", func() {
var nodeNames sets.String
framework := NewFramework("kubelet-perf")
framework := NewDefaultFramework("kubelet-perf")
var rm *resourceMonitor

BeforeEach(func() {
Expand Down
Loading

0 comments on commit 9e5d1b6

Please sign in to comment.