Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KubeDescribe #22206

Merged
merged 1 commit into from
Mar 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 35 additions & 0 deletions hack/after-build/verify-e2e.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

# 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.

# Verify that E2E's use Describe wrappers, so that we can auto tag and provide
# other wrapper functionality for the entire suite.
set -o errexit
set -o nounset
set -o pipefail

KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
cd "${KUBE_ROOT}"

findDescViolations() {
find ./test/e2e/ -name '*.go' | xargs cat | grep "\sDescribe("
}

# There should be only one call to describe.
if [ $(findDescViolations | wc -l) != 1 ]; then
echo "The following lines use Describe instead of KubeDescribe."
echo "Describe() is a reserved term which only should called via the KubeDescribe wrapper function."
findDescViolations
fi
2 changes: 1 addition & 1 deletion test/e2e/addon_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ type stringPair struct {
data, fileName string
}

var _ = Describe("Addon update", func() {
var _ = KubeDescribe("Addon update", func() {

var dir string
var sshClient *ssh.Client
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/batch_v1_jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const (
v1JobSelectorKey = "job-name"
)

var _ = Describe("V1Job", func() {
var _ = KubeDescribe("V1Job", func() {
f := NewDefaultFramework("v1job")
parallelism := 2
completions := 4
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/cadvisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const (
sleepDuration = 10 * time.Second
)

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

f := NewDefaultFramework("cadvisor")

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 @@ -37,7 +37,7 @@ const (
// run by default.
//
// These tests take ~20 minutes to run each.
var _ = Describe("Cluster size autoscaling [Feature:ClusterSizeAutoscaling] [Slow]", func() {
var _ = KubeDescribe("Cluster size autoscaling [Feature:ClusterSizeAutoscaling] [Slow]", func() {
f := NewDefaultFramework("autoscaling")
var nodeCount int
var coresPerNode int
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/cluster_upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func nodeUpgradeGKE(v string) error {
return err
}

var _ = Describe("Upgrade [Feature:Upgrade]", func() {
var _ = KubeDescribe("Upgrade [Feature:Upgrade]", func() {

svcName, replicas := "baz", 2
var rcName, ip, v string
Expand Down Expand Up @@ -190,7 +190,7 @@ var _ = Describe("Upgrade [Feature:Upgrade]", func() {
w.Cleanup()
})

Describe("master upgrade", func() {
KubeDescribe("master upgrade", func() {
It("should maintain responsive services [Feature:MasterUpgrade]", func() {
By("Validating cluster before master upgrade")
expectNoError(validate(f, svcName, rcName, ingress, replicas))
Expand All @@ -203,7 +203,7 @@ var _ = Describe("Upgrade [Feature:Upgrade]", func() {
})
})

Describe("node upgrade", func() {
KubeDescribe("node upgrade", func() {
var tmplBefore, tmplAfter string
BeforeEach(func() {
if providerIs("gce") {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
. "github.com/onsi/gomega"
)

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

f := NewDefaultFramework("configmap")

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 @@ -35,7 +35,7 @@ const (
probTestInitialDelaySeconds = 30
)

var _ = Describe("Probing container", func() {
var _ = KubeDescribe("Probing container", func() {
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 @@ -183,7 +183,7 @@ func getContainerRestarts(c *client.Client, ns string, labelSelector labels.Sele
return failedContainers, containerRestartNodes.List()
}

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

framework := NewDefaultFramework("daemonrestart")
rcName := "daemonrestart" + strconv.Itoa(numPods) + "-" + string(util.NewUUID())
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 @@ -53,7 +53,7 @@ const (
// happen. In the future, running in parallel may work if we have an eviction
// model which lets the DS controller kick out other pods to make room.
// See http://issues.k8s.io/21767 for more details
var _ = Describe("Daemon set [Serial]", func() {
var _ = KubeDescribe("Daemon set [Serial]", func() {
var f *Framework

AfterEach(func() {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
. "github.com/onsi/gomega"
)

var _ = Describe("Kubernetes Dashboard", func() {
var _ = KubeDescribe("Kubernetes Dashboard", func() {
const (
uiServiceName = "kubernetes-dashboard"
uiAppName = uiServiceName
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/density.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func density30AddonResourceVerifier() map[string]resourceConstraint {
// IMPORTANT: This test is designed to work on large (>= 100 Nodes) clusters. For smaller ones
// results will not be representative for control-plane performance as we'll start hitting
// limits on Docker's concurrent container startup.
var _ = Describe("Density", func() {
var _ = KubeDescribe("Density", func() {
var c *client.Client
var nodeCount int
var RCName string
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const (
redisImageName = "redis"
)

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

It("deployment should create new pods", func() {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ func createServiceSpec(serviceName string, isHeadless bool, selector map[string]
return headlessService
}

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

It("should provide DNS for the cluster [Conformance]", func() {
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 @@ -24,7 +24,7 @@ import (
. "github.com/onsi/ginkgo"
)

var _ = Describe("Docker Containers", func() {
var _ = KubeDescribe("Docker Containers", func() {
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 @@ -25,7 +25,7 @@ import (
. "github.com/onsi/ginkgo"
)

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

It("should provide pod name and namespace as env vars [Conformance]", func() {
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 @@ -27,7 +27,7 @@ import (
. "github.com/onsi/gomega"
)

var _ = Describe("Downward API volume", func() {
var _ = KubeDescribe("Downward API volume", func() {
// How long to wait for a log pod to be displayed
const podLogTimeout = 45 * time.Second

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 @@ -33,7 +33,7 @@ const (
testImageNonRootUid = "gcr.io/google_containers/mounttest-user:0.3"
)

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

f := NewDefaultFramework("emptydir")

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 @@ -28,7 +28,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() {
var _ = KubeDescribe("EmptyDir wrapper volumes", func() {
f := NewDefaultFramework("emptydir-wrapper")

It("should becomes running", func() {
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 @@ -30,7 +30,7 @@ import (
. "github.com/onsi/gomega"
)

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

BeforeEach(func() {
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 @@ -27,7 +27,7 @@ import (
. "github.com/onsi/gomega"
)

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

framework := NewDefaultFramework("etcd-failure")

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
. "github.com/onsi/gomega"
)

var _ = Describe("Events", func() {
var _ = KubeDescribe("Events", func() {
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 @@ -41,7 +41,7 @@ try:
except:
print 'err'`

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

var c *client.Client
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 @@ -153,7 +153,7 @@ T:
Ω(totalTransactions).Should(BeNumerically(">", finalTransactionsExpected))
}

var _ = Describe("Pet Store [Feature:Example]", func() {
var _ = KubeDescribe("Pet Store [Feature:Example]", func() {

BeforeEach(func() {
// The shell scripts in k8petstore break on jenkins... Pure golang rewrite is in progress.
Expand Down
22 changes: 11 additions & 11 deletions test/e2e/examples.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const (
serverStartTimeout = podStartTimeout + 3*time.Minute
)

var _ = Describe("[Feature:Example]", func() {
var _ = KubeDescribe("[Feature:Example]", func() {
framework := NewDefaultFramework("examples")
var c *client.Client
var ns string
Expand All @@ -46,7 +46,7 @@ var _ = Describe("[Feature:Example]", func() {
ns = framework.Namespace.Name
})

Describe("Redis", func() {
KubeDescribe("Redis", func() {
It("should create and stop redis servers", func() {
mkpath := func(file string) string {
return filepath.Join(testContext.RepoRoot, "examples/redis", file)
Expand Down Expand Up @@ -108,7 +108,7 @@ var _ = Describe("[Feature:Example]", func() {
})
})

Describe("Celery-RabbitMQ", func() {
KubeDescribe("Celery-RabbitMQ", func() {
It("should create and stop celery+rabbitmq servers", func() {
mkpath := func(file string) string {
return filepath.Join(testContext.RepoRoot, "examples", "celery-rabbitmq", file)
Expand Down Expand Up @@ -151,7 +151,7 @@ var _ = Describe("[Feature:Example]", func() {
})
})

Describe("Spark", func() {
KubeDescribe("Spark", func() {
It("should start spark master, driver and workers", func() {
mkpath := func(file string) string {
return filepath.Join(testContext.RepoRoot, "examples", "spark", file)
Expand Down Expand Up @@ -201,7 +201,7 @@ var _ = Describe("[Feature:Example]", func() {
})
})

Describe("Cassandra", func() {
KubeDescribe("Cassandra", func() {
It("should create and scale cassandra", func() {
mkpath := func(file string) string {
return filepath.Join(testContext.RepoRoot, "examples", "cassandra", file)
Expand Down Expand Up @@ -248,7 +248,7 @@ var _ = Describe("[Feature:Example]", func() {
})
})

Describe("Storm", func() {
KubeDescribe("Storm", func() {
It("should create and stop Zookeeper, Nimbus and Storm worker servers", func() {
mkpath := func(file string) string {
return filepath.Join(testContext.RepoRoot, "examples", "storm", file)
Expand Down Expand Up @@ -302,7 +302,7 @@ var _ = Describe("[Feature:Example]", func() {
})
})

Describe("Liveness", func() {
KubeDescribe("Liveness", func() {
It("liveness pods should be automatically restarted", func() {
mkpath := func(file string) string {
return filepath.Join(testContext.RepoRoot, "docs", "user-guide", "liveness", file)
Expand Down Expand Up @@ -352,7 +352,7 @@ var _ = Describe("[Feature:Example]", func() {
})
})

Describe("Secret", func() {
KubeDescribe("Secret", func() {
It("should create a pod that reads a secret", func() {
mkpath := func(file string) string {
return filepath.Join(testContext.RepoRoot, "docs", "user-guide", "secrets", file)
Expand All @@ -374,7 +374,7 @@ var _ = Describe("[Feature:Example]", func() {
})
})

Describe("Downward API", func() {
KubeDescribe("Downward API", func() {
It("should create a pod that prints his name and namespace", func() {
mkpath := func(file string) string {
return filepath.Join(testContext.RepoRoot, "docs", "user-guide", "downward-api", file)
Expand All @@ -396,7 +396,7 @@ var _ = Describe("[Feature:Example]", func() {
})
})

Describe("RethinkDB", func() {
KubeDescribe("RethinkDB", func() {
It("should create and stop rethinkdb servers", func() {
mkpath := func(file string) string {
return filepath.Join(testContext.RepoRoot, "examples", "rethinkdb", file)
Expand Down Expand Up @@ -438,7 +438,7 @@ var _ = Describe("[Feature:Example]", func() {
})
})

Describe("Hazelcast", func() {
KubeDescribe("Hazelcast", func() {
It("should create and scale hazelcast", func() {
mkpath := func(file string) string {
return filepath.Join(testContext.RepoRoot, "examples", "hazelcast", file)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/expansion.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (

// These tests exercise the Kubernetes expansion syntax $(VAR).
// For more information, see: docs/design/expansion.md
var _ = Describe("Variable Expansion", func() {
var _ = KubeDescribe("Variable Expansion", func() {
framework := NewDefaultFramework("var-expansion")

It("should allow composing env vars into new env vars [Conformance]", func() {
Expand Down
6 changes: 6 additions & 0 deletions test/e2e/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,3 +413,9 @@ func kubectlExec(namespace string, podName, containerName string, args ...string
err := cmd.Run()
return stdout.Bytes(), stderr.Bytes(), err
}

// Wrapper function for ginkgo describe. Adds namespacing.
// TODO: Support type safe tagging as well https://github.com/kubernetes/kubernetes/pull/22401.
func KubeDescribe(text string, body func()) bool {
return Describe("[k8s.io] "+text, body)
}
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 (
// This test requires that --terminated-pod-gc-threshold=100 be set on the controller manager
//
// Slow by design (7 min)
var _ = Describe("Garbage collector [Slow]", func() {
var _ = KubeDescribe("Garbage collector [Slow]", func() {
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 @@ -32,7 +32,7 @@ import (
. "github.com/onsi/gomega"
)

var _ = Describe("Generated release_1_2 clientset", func() {
var _ = KubeDescribe("Generated release_1_2 clientset", func() {
framework := NewDefaultFramework("clientset")
It("should create pods, delete pods, watch pods", func() {
podClient := framework.Clientset_1_2.Core().Pods(framework.Namespace.Name)
Expand Down