Add generated file
This PR adds generated files under pkg/client and vendor folder.
This commit is contained in:
56
vendor/k8s.io/kubernetes/test/conformance/BUILD
generated
vendored
Normal file
56
vendor/k8s.io/kubernetes/test/conformance/BUILD
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["walk.go"],
|
||||
importpath = "k8s.io/kubernetes/test/conformance",
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
go_binary(
|
||||
name = "conformance",
|
||||
embed = [":go_default_library"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = "list_conformance_tests",
|
||||
srcs = [
|
||||
"//test/e2e:all-srcs",
|
||||
"//test/e2e_node:all-srcs",
|
||||
],
|
||||
outs = ["conformance.txt"],
|
||||
cmd = "./$(location :conformance) $(locations //test/e2e:all-srcs) $(locations //test/e2e_node:all-srcs) > $@",
|
||||
message = "Listing all conformance tests.",
|
||||
tools = [":conformance"],
|
||||
)
|
||||
|
||||
sh_test(
|
||||
name = "conformance_test",
|
||||
srcs = ["conformance_test.sh"],
|
||||
data = [
|
||||
"testdata/conformance.txt",
|
||||
":list_conformance_tests",
|
||||
],
|
||||
)
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
srcs = ["walk_test.go"],
|
||||
data = glob(["testdata/**"]),
|
||||
embed = [":go_default_library"],
|
||||
)
|
7
vendor/k8s.io/kubernetes/test/conformance/OWNERS
generated
vendored
Normal file
7
vendor/k8s.io/kubernetes/test/conformance/OWNERS
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
# This is the owner of the test code. The test data itself is owned by sig-architecture.
|
||||
reviewers:
|
||||
- mml
|
||||
- cheftako
|
||||
approvers:
|
||||
- mml
|
||||
- cheftako
|
15
vendor/k8s.io/kubernetes/test/conformance/README.md
generated
vendored
Normal file
15
vendor/k8s.io/kubernetes/test/conformance/README.md
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
This directory contains the regression test for controlling the list of all
|
||||
conformance tests.
|
||||
|
||||
If you add or remove a conformance test, this test will fail and you will need
|
||||
to update the golden list of tests stored in `testdata/`. Changes to that file
|
||||
require review by sig-architecture.
|
||||
|
||||
To update the list, run
|
||||
|
||||
```console
|
||||
$ bazel build //test/conformance:list_conformance_tests
|
||||
$ cp bazel-genfiles/test/conformance/conformance.txt test/conformance/testdata
|
||||
```
|
||||
|
||||
Add the changed file to your PR, then send for review.
|
41
vendor/k8s.io/kubernetes/test/conformance/cf_header.md
generated
vendored
Normal file
41
vendor/k8s.io/kubernetes/test/conformance/cf_header.md
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
# Kubernetes Conformance Test Suite - v1.9
|
||||
|
||||
## **Summary**
|
||||
This document provides a summary of the tests included in the Kubernetes conformance test suite.
|
||||
Each test lists a set of formal requirements that a platform that meets conformance requirements must adhere to.
|
||||
|
||||
The tests are a subset of the "e2e" tests that make up the Kubernetes testing infrastructure.
|
||||
Each test is identified by the presence of the `[Conformance]` keyword in the ginkgo descriptive function calls.
|
||||
The contents of this document are extracted from comments preceding those `[Conformance]` keywords
|
||||
and those comments are expected to include a descriptive overview of what the test is validating using
|
||||
RFC2119 keywords. This will provide a clear distinction between which bits of code in the tests are
|
||||
there for the purposes of validating the platform rather than simply infrastructure logic used to setup, or
|
||||
clean up the tests.
|
||||
|
||||
Example:
|
||||
```
|
||||
/*
|
||||
Testname: Kubelet-OutputToLogs
|
||||
Description: By default the stdout and stderr from the process
|
||||
being executed in a pod MUST be sent to the pod's logs.
|
||||
*/
|
||||
// Note this test needs to be fixed to also test for stderr
|
||||
It("it should print the output to logs [Conformance]", func() {
|
||||
```
|
||||
|
||||
would generate the following documentation for the test. Note that the "TestName" from the Documentation above will
|
||||
be used to document the test which make it more human readable. The "Description" field will be used as the
|
||||
documentation for that test.
|
||||
|
||||
### **Output:**
|
||||
## [Kubelet-OutputToLogs](https://github.com/kubernetes/kubernetes/blob/release-1.9/test/e2e_node/kubelet_test.go#L42)
|
||||
|
||||
By default the stdout and stderr from the process
|
||||
being executed in a pod MUST be sent to the pod's logs.
|
||||
Note this test needs to be fixed to also test for stderr
|
||||
|
||||
Notational Conventions when documenting the tests with the key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" are to be interpreted as described in [RFC 2119](https://tools.ietf.org/html/rfc2119).
|
||||
|
||||
Note: Please see the Summary at the end of this document to find the number of tests documented for conformance.
|
||||
|
||||
## **List of Tests**
|
29
vendor/k8s.io/kubernetes/test/conformance/conformance_test.sh
generated
vendored
Executable file
29
vendor/k8s.io/kubernetes/test/conformance/conformance_test.sh
generated
vendored
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2017 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.
|
||||
|
||||
|
||||
# echo ${TEST_SRCDIR}
|
||||
# pwd
|
||||
# env | grep --color=always test/conformance
|
||||
# find ${TEST_SRCDIR} -ls | grep --color=always test/conformance
|
||||
|
||||
set -o errexit
|
||||
|
||||
if diff -u test/conformance/testdata/conformance.txt test/conformance/conformance.txt; then
|
||||
echo PASS
|
||||
exit 0
|
||||
fi
|
||||
echo 'See instructions in test/conformance/README.md'
|
||||
exit 1
|
9
vendor/k8s.io/kubernetes/test/conformance/testdata/OWNERS
generated
vendored
Normal file
9
vendor/k8s.io/kubernetes/test/conformance/testdata/OWNERS
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
# To be owned by sig-architecture.
|
||||
options:
|
||||
no_parent_owners: true
|
||||
reviewers:
|
||||
- bgrant0607
|
||||
- smarterclayton
|
||||
approvers:
|
||||
- bgrant0607
|
||||
- smarterclayton
|
177
vendor/k8s.io/kubernetes/test/conformance/testdata/conformance.txt
generated
vendored
Executable file
177
vendor/k8s.io/kubernetes/test/conformance/testdata/conformance.txt
generated
vendored
Executable file
@@ -0,0 +1,177 @@
|
||||
test/e2e/apimachinery/custom_resource_definition.go: "creating/deleting custom resource definition objects works"
|
||||
test/e2e/apimachinery/garbage_collector.go: "should delete pods created by rc when not orphaning"
|
||||
test/e2e/apimachinery/garbage_collector.go: "should orphan pods created by rc if delete options say so"
|
||||
test/e2e/apimachinery/garbage_collector.go: "should delete RS created by deployment when not orphaning"
|
||||
test/e2e/apimachinery/garbage_collector.go: "should orphan RS created by deployment when deleteOptions.PropagationPolicy is Orphan"
|
||||
test/e2e/apimachinery/garbage_collector.go: "should keep the rc around until all its pods are deleted if the deleteOptions says so"
|
||||
test/e2e/apimachinery/garbage_collector.go: "should not delete dependents that have both valid owner and owner that's waiting for dependents to be deleted"
|
||||
test/e2e/apimachinery/garbage_collector.go: "should not be blocked by dependency circle"
|
||||
test/e2e/apimachinery/watch.go: "should observe add, update, and delete watch notifications on configmaps"
|
||||
test/e2e/apimachinery/watch.go: "should be able to start watching from a specific resource version"
|
||||
test/e2e/apimachinery/watch.go: "should be able to restart watching from the last resource version observed by the previous watch"
|
||||
test/e2e/apimachinery/watch.go: "should observe an object deletion if it stops meeting the requirements of the selector"
|
||||
test/e2e/apps/daemon_set.go: "should run and stop simple daemon"
|
||||
test/e2e/apps/daemon_set.go: "should run and stop complex daemon"
|
||||
test/e2e/apps/daemon_set.go: "should retry creating failed daemon pods"
|
||||
test/e2e/apps/daemon_set.go: "should update pod when spec was updated and update strategy is RollingUpdate"
|
||||
test/e2e/apps/daemon_set.go: "should rollback without unnecessary restarts"
|
||||
test/e2e/apps/rc.go: "should serve a basic image on each replica with a public image"
|
||||
test/e2e/apps/replica_set.go: "should serve a basic image on each replica with a public image"
|
||||
test/e2e/apps/statefulset.go: "should perform rolling updates and roll backs of template modifications"
|
||||
test/e2e/apps/statefulset.go: "should perform canary updates and phased rolling updates of template modifications"
|
||||
test/e2e/apps/statefulset.go: "Scaling should happen in predictable order and halt if any stateful pod is unhealthy"
|
||||
test/e2e/apps/statefulset.go: "Burst scaling should run to completion even with unhealthy pods"
|
||||
test/e2e/apps/statefulset.go: "Should recreate evicted statefulset"
|
||||
test/e2e/auth/service_accounts.go: "should mount an API token into pods"
|
||||
test/e2e/auth/service_accounts.go: "should allow opting out of API token automount"
|
||||
test/e2e/common/configmap.go: "should be consumable via environment variable"
|
||||
test/e2e/common/configmap.go: "should be consumable via the environment"
|
||||
test/e2e/common/configmap_volume.go: "should be consumable from pods in volume"
|
||||
test/e2e/common/configmap_volume.go: "should be consumable from pods in volume with defaultMode set"
|
||||
test/e2e/common/configmap_volume.go: "should be consumable from pods in volume as non-root"
|
||||
test/e2e/common/configmap_volume.go: "should be consumable from pods in volume with mappings"
|
||||
test/e2e/common/configmap_volume.go: "should be consumable from pods in volume with mappings and Item mode set"
|
||||
test/e2e/common/configmap_volume.go: "should be consumable from pods in volume with mappings as non-root"
|
||||
test/e2e/common/configmap_volume.go: "updates should be reflected in volume"
|
||||
test/e2e/common/configmap_volume.go: "optional updates should be reflected in volume"
|
||||
test/e2e/common/configmap_volume.go: "should be consumable in multiple volumes in the same pod"
|
||||
test/e2e/common/container_probe.go: "with readiness probe should not be ready before initial delay and never restart"
|
||||
test/e2e/common/container_probe.go: "with readiness probe that fails should never be ready and never restart"
|
||||
test/e2e/common/container_probe.go: "should be restarted with a exec \\\"cat /tmp/health\\\" liveness probe"
|
||||
test/e2e/common/container_probe.go: "should *not* be restarted with a exec \\\"cat /tmp/health\\\" liveness probe"
|
||||
test/e2e/common/container_probe.go: "should be restarted with a /healthz http liveness probe"
|
||||
test/e2e/common/container_probe.go: "should have monotonically increasing restart count"
|
||||
test/e2e/common/container_probe.go: "should *not* be restarted with a /healthz http liveness probe"
|
||||
test/e2e/common/docker_containers.go: "should use the image defaults if command and args are blank"
|
||||
test/e2e/common/docker_containers.go: "should be able to override the image's default arguments (docker cmd)"
|
||||
test/e2e/common/docker_containers.go: "should be able to override the image's default command (docker entrypoint)"
|
||||
test/e2e/common/docker_containers.go: "should be able to override the image's default command and arguments"
|
||||
test/e2e/common/downward_api.go: "should provide pod name, namespace and IP address as env vars"
|
||||
test/e2e/common/downward_api.go: "should provide host IP as an env var"
|
||||
test/e2e/common/downward_api.go: "should provide container's limits.cpu/memory and requests.cpu/memory as env vars"
|
||||
test/e2e/common/downward_api.go: "should provide default limits.cpu/memory from node allocatable"
|
||||
test/e2e/common/downward_api.go: "should provide pod UID as env vars"
|
||||
test/e2e/common/downwardapi_volume.go: "should provide podname only"
|
||||
test/e2e/common/downwardapi_volume.go: "should set DefaultMode on files"
|
||||
test/e2e/common/downwardapi_volume.go: "should set mode on item file"
|
||||
test/e2e/common/downwardapi_volume.go: "should update labels on modification"
|
||||
test/e2e/common/downwardapi_volume.go: "should update annotations on modification"
|
||||
test/e2e/common/downwardapi_volume.go: "should provide container's cpu limit"
|
||||
test/e2e/common/downwardapi_volume.go: "should provide container's memory limit"
|
||||
test/e2e/common/downwardapi_volume.go: "should provide container's cpu request"
|
||||
test/e2e/common/downwardapi_volume.go: "should provide container's memory request"
|
||||
test/e2e/common/downwardapi_volume.go: "should provide node allocatable (cpu) as default cpu limit if the limit is not set"
|
||||
test/e2e/common/downwardapi_volume.go: "should provide node allocatable (memory) as default memory limit if the limit is not set"
|
||||
test/e2e/common/empty_dir.go: "volume on tmpfs should have the correct mode"
|
||||
test/e2e/common/empty_dir.go: "should support (root,0644,tmpfs)"
|
||||
test/e2e/common/empty_dir.go: "should support (root,0666,tmpfs)"
|
||||
test/e2e/common/empty_dir.go: "should support (root,0777,tmpfs)"
|
||||
test/e2e/common/empty_dir.go: "should support (non-root,0644,tmpfs)"
|
||||
test/e2e/common/empty_dir.go: "should support (non-root,0666,tmpfs)"
|
||||
test/e2e/common/empty_dir.go: "should support (non-root,0777,tmpfs)"
|
||||
test/e2e/common/empty_dir.go: "volume on default medium should have the correct mode"
|
||||
test/e2e/common/empty_dir.go: "should support (root,0644,default)"
|
||||
test/e2e/common/empty_dir.go: "should support (root,0666,default)"
|
||||
test/e2e/common/empty_dir.go: "should support (root,0777,default)"
|
||||
test/e2e/common/empty_dir.go: "should support (non-root,0644,default)"
|
||||
test/e2e/common/empty_dir.go: "should support (non-root,0666,default)"
|
||||
test/e2e/common/empty_dir.go: "should support (non-root,0777,default)"
|
||||
test/e2e/common/expansion.go: "should allow composing env vars into new env vars"
|
||||
test/e2e/common/expansion.go: "should allow substituting values in a container's command"
|
||||
test/e2e/common/expansion.go: "should allow substituting values in a container's args"
|
||||
test/e2e/common/host_path.go: "should give a volume the correct mode"
|
||||
test/e2e/common/kubelet_etc_hosts.go: "should test kubelet managed /etc/hosts file"
|
||||
test/e2e/common/networking.go: "should function for intra-pod communication: http"
|
||||
test/e2e/common/networking.go: "should function for intra-pod communication: udp"
|
||||
test/e2e/common/networking.go: "should function for node-pod communication: http"
|
||||
test/e2e/common/networking.go: "should function for node-pod communication: udp"
|
||||
test/e2e/common/pods.go: "should get a host IP"
|
||||
test/e2e/common/pods.go: "should be submitted and removed"
|
||||
test/e2e/common/pods.go: "should be updated"
|
||||
test/e2e/common/pods.go: "should allow activeDeadlineSeconds to be updated"
|
||||
test/e2e/common/pods.go: "should contain environment variables for services"
|
||||
test/e2e/common/projected.go: "should be consumable from pods in volume"
|
||||
test/e2e/common/projected.go: "should be consumable from pods in volume with defaultMode set"
|
||||
test/e2e/common/projected.go: "should be consumable from pods in volume as non-root with defaultMode and fsGroup set"
|
||||
test/e2e/common/projected.go: "should be consumable from pods in volume with mappings"
|
||||
test/e2e/common/projected.go: "should be consumable from pods in volume with mappings and Item Mode set"
|
||||
test/e2e/common/projected.go: "should be consumable in multiple volumes in a pod"
|
||||
test/e2e/common/projected.go: "optional updates should be reflected in volume"
|
||||
test/e2e/common/projected.go: "should be consumable from pods in volume"
|
||||
test/e2e/common/projected.go: "should be consumable from pods in volume with defaultMode set"
|
||||
test/e2e/common/projected.go: "should be consumable from pods in volume as non-root"
|
||||
test/e2e/common/projected.go: "should be consumable from pods in volume with mappings"
|
||||
test/e2e/common/projected.go: "should be consumable from pods in volume with mappings and Item mode set"
|
||||
test/e2e/common/projected.go: "should be consumable from pods in volume with mappings as non-root"
|
||||
test/e2e/common/projected.go: "updates should be reflected in volume"
|
||||
test/e2e/common/projected.go: "optional updates should be reflected in volume"
|
||||
test/e2e/common/projected.go: "should be consumable in multiple volumes in the same pod"
|
||||
test/e2e/common/projected.go: "should provide podname only"
|
||||
test/e2e/common/projected.go: "should set DefaultMode on files"
|
||||
test/e2e/common/projected.go: "should set mode on item file"
|
||||
test/e2e/common/projected.go: "should update labels on modification"
|
||||
test/e2e/common/projected.go: "should update annotations on modification"
|
||||
test/e2e/common/projected.go: "should provide container's cpu limit"
|
||||
test/e2e/common/projected.go: "should provide container's memory limit"
|
||||
test/e2e/common/projected.go: "should provide container's cpu request"
|
||||
test/e2e/common/projected.go: "should provide container's memory request"
|
||||
test/e2e/common/projected.go: "should provide node allocatable (cpu) as default cpu limit if the limit is not set"
|
||||
test/e2e/common/projected.go: "should provide node allocatable (memory) as default memory limit if the limit is not set"
|
||||
test/e2e/common/projected.go: "should project all components that make up the projection API"
|
||||
test/e2e/common/secrets.go: "should be consumable from pods in env vars"
|
||||
test/e2e/common/secrets.go: "should be consumable via the environment"
|
||||
test/e2e/common/secrets_volume.go: "should be consumable from pods in volume"
|
||||
test/e2e/common/secrets_volume.go: "should be consumable from pods in volume with defaultMode set"
|
||||
test/e2e/common/secrets_volume.go: "should be consumable from pods in volume as non-root with defaultMode and fsGroup set"
|
||||
test/e2e/common/secrets_volume.go: "should be consumable from pods in volume with mappings"
|
||||
test/e2e/common/secrets_volume.go: "should be consumable from pods in volume with mappings and Item Mode set"
|
||||
test/e2e/common/secrets_volume.go: "should be consumable in multiple volumes in a pod"
|
||||
test/e2e/common/secrets_volume.go: "optional updates should be reflected in volume"
|
||||
test/e2e/kubectl/kubectl.go: "should create and stop a replication controller"
|
||||
test/e2e/kubectl/kubectl.go: "should scale a replication controller"
|
||||
test/e2e/kubectl/kubectl.go: "should do a rolling update of a replication controller"
|
||||
test/e2e/kubectl/kubectl.go: "should create and stop a working application"
|
||||
test/e2e/kubectl/kubectl.go: "should check if v1 is in available api versions"
|
||||
test/e2e/kubectl/kubectl.go: "should check if Kubernetes master services is included in cluster-info"
|
||||
test/e2e/kubectl/kubectl.go: "should check if kubectl describe prints relevant information for rc and pods"
|
||||
test/e2e/kubectl/kubectl.go: "should create services for rc"
|
||||
test/e2e/kubectl/kubectl.go: "should update the label on a resource"
|
||||
test/e2e/kubectl/kubectl.go: "should be able to retrieve and filter logs"
|
||||
test/e2e/kubectl/kubectl.go: "should add annotations for pods in rc"
|
||||
test/e2e/kubectl/kubectl.go: "should check is all data is printed"
|
||||
test/e2e/kubectl/kubectl.go: "should create an rc or deployment from an image"
|
||||
test/e2e/kubectl/kubectl.go: "should create an rc from an image"
|
||||
test/e2e/kubectl/kubectl.go: "should support rolling-update to same image"
|
||||
test/e2e/kubectl/kubectl.go: "should create a deployment from an image"
|
||||
test/e2e/kubectl/kubectl.go: "should create a job from an image when restart is OnFailure"
|
||||
test/e2e/kubectl/kubectl.go: "should create a pod from an image when restart is Never"
|
||||
test/e2e/kubectl/kubectl.go: "should update a single-container pod's image"
|
||||
test/e2e/kubectl/kubectl.go: "should create a job from an image, then delete the job"
|
||||
test/e2e/kubectl/kubectl.go: "should support proxy with --port 0"
|
||||
test/e2e/kubectl/kubectl.go: "should support --unix-socket=/path"
|
||||
test/e2e/network/dns.go: "should provide DNS for the cluster"
|
||||
test/e2e/network/dns.go: "should provide DNS for services"
|
||||
test/e2e/network/proxy.go: "should proxy logs on node with explicit kubelet port using proxy subresource"
|
||||
test/e2e/network/proxy.go: "should proxy logs on node using proxy subresource"
|
||||
test/e2e/network/proxy.go: "should proxy through a service and a pod"
|
||||
test/e2e/network/service.go: "should provide secure master service"
|
||||
test/e2e/network/service.go: "should serve a basic endpoint from pods"
|
||||
test/e2e/network/service.go: "should serve multiport endpoints from pods"
|
||||
test/e2e/network/service_latency.go: "should not be very high"
|
||||
test/e2e/node/events.go: "should be sent by kubelets and the scheduler about pods scheduling and running"
|
||||
test/e2e/node/pods.go: "should be submitted and removed"
|
||||
test/e2e/node/pods.go: "should be submitted and removed"
|
||||
test/e2e/node/pre_stop.go: "should call prestop when killing a pod"
|
||||
test/e2e/scheduling/predicates.go: "validates resource limits of pods that are allowed to run"
|
||||
test/e2e/scheduling/predicates.go: "validates that NodeSelector is respected if not matching"
|
||||
test/e2e/scheduling/predicates.go: "validates that NodeSelector is respected if matching"
|
||||
test/e2e_node/kubelet_test.go: "it should print the output to logs"
|
||||
test/e2e_node/kubelet_test.go: "it should not write to root filesystem"
|
||||
test/e2e_node/lifecycle_hook_test.go: "should execute poststart exec hook properly"
|
||||
test/e2e_node/lifecycle_hook_test.go: "should execute prestop exec hook properly"
|
||||
test/e2e_node/lifecycle_hook_test.go: "should execute poststart http hook properly"
|
||||
test/e2e_node/lifecycle_hook_test.go: "should execute prestop http hook properly"
|
||||
test/e2e_node/mirror_pod_test.go: "should be updated when static pod updated"
|
||||
test/e2e_node/mirror_pod_test.go: "should be recreated when mirror pod gracefully deleted"
|
||||
test/e2e_node/mirror_pod_test.go: "should be recreated when mirror pod forcibly deleted"
|
||||
test/e2e_node/runtime_conformance_test.go: "it should run with the expected status"
|
369
vendor/k8s.io/kubernetes/test/conformance/walk.go
generated
vendored
Normal file
369
vendor/k8s.io/kubernetes/test/conformance/walk.go
generated
vendored
Normal file
@@ -0,0 +1,369 @@
|
||||
/*
|
||||
Copyright 2017 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 main provides a tool that scans kubernetes e2e test source code
|
||||
// looking for conformance test declarations, which it emits on stdout. It
|
||||
// also looks for legacy, manually added "[Conformance]" tags and reports an
|
||||
// error if it finds any.
|
||||
//
|
||||
// This approach is not air tight, but it will serve our purpose as a
|
||||
// pre-submit check.
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"go/ast"
|
||||
"go/parser"
|
||||
"go/token"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var (
|
||||
baseURL = flag.String("url", "https://github.com/kubernetes/kubernetes/tree/master/", "location of the current source")
|
||||
confDoc = flag.Bool("conformance", false, "write a conformance document")
|
||||
totalConfTests, totalLegacyTests, missingComments int
|
||||
)
|
||||
|
||||
const regexDescribe = "Describe|KubeDescribe|SIGDescribe"
|
||||
const regexContext = "Context"
|
||||
|
||||
type visitor struct {
|
||||
FileSet *token.FileSet
|
||||
lastDescribe describe
|
||||
cMap ast.CommentMap
|
||||
//list of all the conformance tests in the path
|
||||
tests []conformanceData
|
||||
}
|
||||
|
||||
//describe contains text associated with ginkgo describe container
|
||||
type describe struct {
|
||||
text string
|
||||
lastContext context
|
||||
}
|
||||
|
||||
//context contain the text associated with the Context clause
|
||||
type context struct {
|
||||
text string
|
||||
}
|
||||
|
||||
type conformanceData struct {
|
||||
// A URL to the line of code in the kube src repo for the test
|
||||
URL string
|
||||
// Extracted from the "Testname:" comment before the test
|
||||
TestName string
|
||||
// Extracted from the "Description:" comment before the test
|
||||
Description string
|
||||
}
|
||||
|
||||
func (v *visitor) convertToConformanceData(at *ast.BasicLit) {
|
||||
cd := conformanceData{}
|
||||
|
||||
comment := v.comment(at)
|
||||
pos := v.FileSet.Position(at.Pos())
|
||||
cd.URL = fmt.Sprintf("%s%s#L%d", *baseURL, pos.Filename, pos.Line)
|
||||
|
||||
lines := strings.Split(comment, "\n")
|
||||
cd.Description = ""
|
||||
for _, line := range lines {
|
||||
line = strings.TrimSpace(line)
|
||||
if strings.HasPrefix(line, "Testname:") {
|
||||
line = strings.TrimSpace(line[9:])
|
||||
cd.TestName = line
|
||||
continue
|
||||
}
|
||||
if strings.HasPrefix(line, "Description:") {
|
||||
line = strings.TrimSpace(line[12:])
|
||||
}
|
||||
cd.Description += line + "\n"
|
||||
}
|
||||
|
||||
if cd.TestName == "" {
|
||||
testName := v.getDescription(at.Value)
|
||||
i := strings.Index(testName, "[Conformance]")
|
||||
if i > 0 {
|
||||
cd.TestName = strings.TrimSpace(testName[:i])
|
||||
} else {
|
||||
cd.TestName = testName
|
||||
}
|
||||
}
|
||||
|
||||
v.tests = append(v.tests, cd)
|
||||
}
|
||||
|
||||
func newVisitor() *visitor {
|
||||
return &visitor{
|
||||
FileSet: token.NewFileSet(),
|
||||
}
|
||||
}
|
||||
|
||||
func (v *visitor) isConformanceCall(call *ast.CallExpr) bool {
|
||||
switch fun := call.Fun.(type) {
|
||||
case *ast.SelectorExpr:
|
||||
if fun.Sel != nil {
|
||||
return fun.Sel.Name == "ConformanceIt"
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (v *visitor) isLegacyItCall(call *ast.CallExpr) bool {
|
||||
switch fun := call.Fun.(type) {
|
||||
case *ast.Ident:
|
||||
if fun.Name != "It" {
|
||||
return false
|
||||
}
|
||||
if len(call.Args) < 1 {
|
||||
v.failf(call, "Not enough arguments to It()")
|
||||
}
|
||||
default:
|
||||
return false
|
||||
}
|
||||
|
||||
switch arg := call.Args[0].(type) {
|
||||
case *ast.BasicLit:
|
||||
if arg.Kind != token.STRING {
|
||||
v.failf(arg, "Unexpected non-string argument to It()")
|
||||
}
|
||||
if strings.Contains(arg.Value, "[Conformance]") {
|
||||
return true
|
||||
}
|
||||
default:
|
||||
// non-literal argument to It()... we just ignore these even though they could be a way to "sneak in" a conformance test
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func (v *visitor) failf(expr ast.Expr, format string, a ...interface{}) {
|
||||
msg := fmt.Sprintf(format, a...)
|
||||
fmt.Fprintf(os.Stderr, "ERROR at %v: %s\n", v.FileSet.Position(expr.Pos()), msg)
|
||||
}
|
||||
|
||||
func (v *visitor) comment(x *ast.BasicLit) string {
|
||||
for _, comm := range v.cMap.Comments() {
|
||||
testOffset := int(x.Pos()-comm.End()) - len("framework.ConformanceIt(\"")
|
||||
if 0 < testOffset && testOffset < 3 {
|
||||
return comm.Text()
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (v *visitor) emit(arg ast.Expr) {
|
||||
switch at := arg.(type) {
|
||||
case *ast.BasicLit:
|
||||
if at.Kind != token.STRING {
|
||||
v.failf(at, "framework.ConformanceIt() called with non-string argument")
|
||||
return
|
||||
}
|
||||
|
||||
at.Value = normalizeTestName(at.Value)
|
||||
if *confDoc {
|
||||
v.convertToConformanceData(at)
|
||||
} else {
|
||||
fmt.Printf("%s: %q\n", v.FileSet.Position(at.Pos()).Filename, at.Value)
|
||||
}
|
||||
default:
|
||||
v.failf(at, "framework.ConformanceIt() called with non-literal argument")
|
||||
fmt.Fprintf(os.Stderr, "ERROR: non-literal argument %v at %v\n", arg, v.FileSet.Position(arg.Pos()))
|
||||
}
|
||||
}
|
||||
|
||||
func (v *visitor) getDescription(value string) string {
|
||||
if len(v.lastDescribe.lastContext.text) > 0 {
|
||||
return strings.Trim(v.lastDescribe.text, "\"") +
|
||||
" " + strings.Trim(v.lastDescribe.lastContext.text, "\"") +
|
||||
" " + strings.Trim(value, "\"")
|
||||
}
|
||||
return strings.Trim(v.lastDescribe.text, "\"") +
|
||||
" " + strings.Trim(value, "\"")
|
||||
}
|
||||
|
||||
var (
|
||||
regexTag = regexp.MustCompile(`(\[[a-zA-Z0-9:-]+\])`)
|
||||
)
|
||||
|
||||
// normalizeTestName removes tags (e.g., [Feature:Foo]), double quotes and trim
|
||||
// the spaces to normalize the test name.
|
||||
func normalizeTestName(s string) string {
|
||||
r := regexTag.ReplaceAllString(s, "")
|
||||
r = strings.Trim(r, "\"")
|
||||
return strings.TrimSpace(r)
|
||||
}
|
||||
|
||||
// funcName converts a selectorExpr with two idents into a string,
|
||||
// x.y -> "x.y"
|
||||
func funcName(n ast.Expr) string {
|
||||
if sel, ok := n.(*ast.SelectorExpr); ok {
|
||||
if x, ok := sel.X.(*ast.Ident); ok {
|
||||
return x.String() + "." + sel.Sel.String()
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// isSprintf returns whether the given node is a call to fmt.Sprintf
|
||||
func isSprintf(n ast.Expr) bool {
|
||||
call, ok := n.(*ast.CallExpr)
|
||||
return ok && funcName(call.Fun) == "fmt.Sprintf" && len(call.Args) != 0
|
||||
}
|
||||
|
||||
// firstArg attempts to statically determine the value of the first
|
||||
// argument. It only handles strings, and converts any unknown values
|
||||
// (fmt.Sprintf interpolations) into *.
|
||||
func (v *visitor) firstArg(n *ast.CallExpr) string {
|
||||
if len(n.Args) == 0 {
|
||||
return ""
|
||||
}
|
||||
var lit *ast.BasicLit
|
||||
if isSprintf(n.Args[0]) {
|
||||
return v.firstArg(n.Args[0].(*ast.CallExpr))
|
||||
}
|
||||
lit, ok := n.Args[0].(*ast.BasicLit)
|
||||
if ok && lit.Kind == token.STRING {
|
||||
val, err := strconv.Unquote(lit.Value)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if strings.Contains(val, "%") {
|
||||
val = strings.Replace(val, "%d", "*", -1)
|
||||
val = strings.Replace(val, "%v", "*", -1)
|
||||
val = strings.Replace(val, "%s", "*", -1)
|
||||
}
|
||||
return val
|
||||
}
|
||||
if ident, ok := n.Args[0].(*ast.Ident); ok {
|
||||
return ident.String()
|
||||
}
|
||||
return "*"
|
||||
}
|
||||
|
||||
// matchFuncName returns the first argument of a function if it's
|
||||
// a Ginkgo-relevant function (Describe/KubeDescribe/Context),
|
||||
// and the empty string otherwise.
|
||||
func (v *visitor) matchFuncName(n *ast.CallExpr, pattern string) string {
|
||||
switch x := n.Fun.(type) {
|
||||
case *ast.SelectorExpr:
|
||||
if match, err := regexp.MatchString(pattern, x.Sel.Name); err == nil && match {
|
||||
return v.firstArg(n)
|
||||
}
|
||||
case *ast.Ident:
|
||||
if match, err := regexp.MatchString(pattern, x.Name); err == nil && match {
|
||||
return v.firstArg(n)
|
||||
}
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// Visit visits each node looking for either calls to framework.ConformanceIt,
|
||||
// which it will emit in its list of conformance tests, or legacy calls to
|
||||
// It() with a manually embedded [Conformance] tag, which it will complain
|
||||
// about.
|
||||
func (v *visitor) Visit(node ast.Node) (w ast.Visitor) {
|
||||
switch t := node.(type) {
|
||||
case *ast.CallExpr:
|
||||
if name := v.matchFuncName(t, regexDescribe); name != "" && len(t.Args) >= 2 {
|
||||
v.lastDescribe = describe{text: name}
|
||||
} else if name := v.matchFuncName(t, regexContext); name != "" && len(t.Args) >= 2 {
|
||||
v.lastDescribe.lastContext = context{text: name}
|
||||
} else if v.isConformanceCall(t) {
|
||||
totalConfTests++
|
||||
v.emit(t.Args[0])
|
||||
return nil
|
||||
} else if v.isLegacyItCall(t) {
|
||||
totalLegacyTests++
|
||||
v.failf(t, "Using It() with manual [Conformance] tag is no longer allowed. Use framework.ConformanceIt() instead.")
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
func scandir(dir string) {
|
||||
v := newVisitor()
|
||||
pkg, err := parser.ParseDir(v.FileSet, dir, nil, parser.ParseComments)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
for _, p := range pkg {
|
||||
ast.Walk(v, p)
|
||||
}
|
||||
}
|
||||
|
||||
func scanfile(path string, src interface{}) []conformanceData {
|
||||
v := newVisitor()
|
||||
file, err := parser.ParseFile(v.FileSet, path, src, parser.ParseComments)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
v.cMap = ast.NewCommentMap(v.FileSet, file, file.Comments)
|
||||
|
||||
ast.Walk(v, file)
|
||||
return v.tests
|
||||
}
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
if len(flag.Args()) < 1 {
|
||||
fmt.Fprintf(os.Stderr, "USAGE: %s <DIR or FILE> [...]\n", os.Args[0])
|
||||
os.Exit(64)
|
||||
}
|
||||
|
||||
if *confDoc {
|
||||
// Note: this assumes that you're running from the root of the kube src repo
|
||||
header, err := ioutil.ReadFile("test/conformance/cf_header.md")
|
||||
if err == nil {
|
||||
fmt.Printf("%s\n\n", header)
|
||||
}
|
||||
}
|
||||
|
||||
totalConfTests = 0
|
||||
totalLegacyTests = 0
|
||||
missingComments = 0
|
||||
for _, arg := range flag.Args() {
|
||||
filepath.Walk(arg, func(path string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if strings.HasSuffix(path, ".go") {
|
||||
tests := scanfile(path, nil)
|
||||
for _, cd := range tests {
|
||||
fmt.Printf("## [%s](%s)\n\n", cd.TestName, cd.URL)
|
||||
fmt.Printf("%s\n\n", cd.Description)
|
||||
if len(cd.Description) < 10 {
|
||||
missingComments++
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
if *confDoc {
|
||||
fmt.Println("\n## **Summary**")
|
||||
fmt.Printf("\nTotal Conformance Tests: %d, total legacy tests that need conversion: %d, while total tests that need comment sections: %d\n\n", totalConfTests, totalLegacyTests, missingComments)
|
||||
}
|
||||
}
|
117
vendor/k8s.io/kubernetes/test/conformance/walk_test.go
generated
vendored
Normal file
117
vendor/k8s.io/kubernetes/test/conformance/walk_test.go
generated
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
Copyright 2016 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 main
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var conformanceCases = []struct {
|
||||
filename string
|
||||
code string
|
||||
output []conformanceData
|
||||
}{
|
||||
// Go unit test
|
||||
{"test/list/main_test.go", `
|
||||
var num = 3
|
||||
func Helper(x int) { return x / 0 }
|
||||
var _ = Describe("Feature", func() {
|
||||
/*
|
||||
Testname: Kubelet-OutputToLogs
|
||||
Description: By default the stdout and stderr from the process
|
||||
being executed in a pod MUST be sent to the pod's logs.
|
||||
*/
|
||||
framework.ConformanceIt("validates describe with ConformanceIt", func() {})
|
||||
})`, []conformanceData{{URL: "https://github.com/kubernetes/kubernetes/tree/master/test/list/main_test.go#L11", TestName: "Kubelet-OutputToLogs",
|
||||
Description: `By default the stdout and stderr from the process
|
||||
being executed in a pod MUST be sent to the pod's logs.` + "\n\n"}},
|
||||
},
|
||||
// Describe + It
|
||||
{"e2e/foo.go", `
|
||||
var _ = Describe("Feature", func() {
|
||||
//It should have comment
|
||||
framework.ConformanceIt("should work properly", func() {})
|
||||
})`, []conformanceData{{URL: "https://github.com/kubernetes/kubernetes/tree/master/e2e/foo.go#L5", TestName: "Feature should work properly", Description: "It should have comment\n\n"}},
|
||||
},
|
||||
// KubeDescribe + It
|
||||
{"e2e/foo.go", `
|
||||
var _ = framework.KubeDescribe("Feature", func() {
|
||||
/*It should have comment*/
|
||||
framework.ConformanceIt("should work properly", func() {})
|
||||
})`, []conformanceData{{URL: "https://github.com/kubernetes/kubernetes/tree/master/e2e/foo.go#L5", TestName: "Feature should work properly", Description: "It should have comment\n\n"}},
|
||||
},
|
||||
// KubeDescribe + Context + It
|
||||
{"e2e/foo.go", `
|
||||
var _ = framework.KubeDescribe("Feature", func() {
|
||||
Context("when offline", func() {
|
||||
//Testname: Kubelet-OutputToLogs
|
||||
//Description: By default the stdout and stderr from the process
|
||||
//being executed in a pod MUST be sent to the pod's logs.
|
||||
framework.ConformanceIt("should work", func() {})
|
||||
})
|
||||
})`, []conformanceData{{URL: "https://github.com/kubernetes/kubernetes/tree/master/e2e/foo.go#L8", TestName: "Kubelet-OutputToLogs",
|
||||
Description: `By default the stdout and stderr from the process
|
||||
being executed in a pod MUST be sent to the pod's logs.` + "\n\n"}},
|
||||
},
|
||||
// KubeDescribe + Context + It
|
||||
{"e2e/foo.go", `
|
||||
var _ = framework.KubeDescribe("Feature", func() {
|
||||
Context("with context", func() {
|
||||
//Description: By default the stdout and stderr from the process
|
||||
//being executed in a pod MUST be sent to the pod's logs.
|
||||
framework.ConformanceIt("should work", func() {})
|
||||
})
|
||||
})`, []conformanceData{{URL: "https://github.com/kubernetes/kubernetes/tree/master/e2e/foo.go#L7", TestName: "Feature with context should work",
|
||||
Description: `By default the stdout and stderr from the process
|
||||
being executed in a pod MUST be sent to the pod's logs.` + "\n\n"}},
|
||||
},
|
||||
}
|
||||
|
||||
func TestConformance(t *testing.T) {
|
||||
for _, test := range conformanceCases {
|
||||
code := "package test\n" + test.code
|
||||
*confDoc = true
|
||||
tests := scanfile(test.filename, code)
|
||||
if !reflect.DeepEqual(tests, test.output) {
|
||||
t.Errorf("code:\n%s\ngot %v\nwant %v",
|
||||
code, tests, test.output)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestNormalizeTestNames(t *testing.T) {
|
||||
testCases := []struct {
|
||||
rawName string
|
||||
normalizedName string
|
||||
}{
|
||||
{
|
||||
"should have monotonically increasing restart count [Slow]",
|
||||
"should have monotonically increasing restart count",
|
||||
},
|
||||
{
|
||||
" should check is all data is printed ",
|
||||
"should check is all data is printed",
|
||||
},
|
||||
}
|
||||
for i, tc := range testCases {
|
||||
actualName := normalizeTestName(tc.rawName)
|
||||
if actualName != tc.normalizedName {
|
||||
t.Errorf("test case[%d]: expected normalized name %q, got %q", i, tc.normalizedName, actualName)
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user