Merge pull request #76734 from oomichi/conformance-req-01

Check conformance test should not call any Skip
This commit is contained in:
Kubernetes Prow Robot 2019-05-10 19:28:11 -07:00 committed by GitHub
commit a245408f38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 4 additions and 18 deletions

View File

@ -34,7 +34,7 @@ const (
//e.g. framework.ConformanceIt("should provide secure master service ", func() { //e.g. framework.ConformanceIt("should provide secure master service ", func() {
patternStartConformance = "framework.ConformanceIt\\(.*, func\\(\\) {$" patternStartConformance = "framework.ConformanceIt\\(.*, func\\(\\) {$"
patternEndConformance = "}\\)$" patternEndConformance = "}\\)$"
patternSkipProviderIs = "Skip.*ProviderIs\\(" patternSkip = "framework.Skip.*\\("
) )
// This function checks the requirement: it works for all providers (e.g., no SkipIfProviderIs/SkipUnlessProviderIs calls) // This function checks the requirement: it works for all providers (e.g., no SkipIfProviderIs/SkipUnlessProviderIs calls)
@ -44,7 +44,7 @@ func checkAllProviders(e2eFile string) error {
regStartConformance := regexp.MustCompile(patternStartConformance) regStartConformance := regexp.MustCompile(patternStartConformance)
regEndConformance := regexp.MustCompile(patternEndConformance) regEndConformance := regexp.MustCompile(patternEndConformance)
regSkipProviderIs := regexp.MustCompile(patternSkipProviderIs) regSkip := regexp.MustCompile(patternSkip)
fileInput, err := ioutil.ReadFile(e2eFile) fileInput, err := ioutil.ReadFile(e2eFile)
if err != nil { if err != nil {
@ -62,9 +62,9 @@ func checkAllProviders(e2eFile string) error {
inConformanceCode = true inConformanceCode = true
} }
if inConformanceCode { if inConformanceCode {
if regSkipProviderIs.MatchString(line) { if regSkip.MatchString(line) {
// To list all invalid places in a single operation of this tool, here doesn't return error and continues checking. // To list all invalid places in a single operation of this tool, here doesn't return error and continues checking.
fmt.Fprintf(os.Stderr, "%v: Conformance test should not call SkipIfProviderIs()/SkipUnlessProviderIs()\n", e2eFile) fmt.Fprintf(os.Stderr, "%v: Conformance test should not call any framework.Skip*()\n", e2eFile)
checkFailed = true checkFailed = true
} }
if regEndConformance.MatchString(line) { if regEndConformance.MatchString(line) {

View File

@ -40,8 +40,6 @@ var _ = SIGDescribe("CustomResourceDefinition resources", func() {
*/ */
framework.ConformanceIt("creating/deleting custom resource definition objects works ", func() { framework.ConformanceIt("creating/deleting custom resource definition objects works ", func() {
framework.SkipUnlessServerVersionGTE(crdVersion, f.ClientSet.Discovery())
config, err := framework.LoadConfig() config, err := framework.LoadConfig()
if err != nil { if err != nil {
framework.Failf("failed to load config: %v", err) framework.Failf("failed to load config: %v", err)

View File

@ -69,7 +69,6 @@ go_library(
"//staging/src/k8s.io/apimachinery/pkg/util/intstr:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/intstr:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/uuid:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/uuid:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/version:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/watch:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/watch:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes:go_default_library", "//staging/src/k8s.io/client-go/kubernetes:go_default_library",

View File

@ -23,18 +23,12 @@ import (
"k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/uuid" "k8s.io/apimachinery/pkg/util/uuid"
utilversion "k8s.io/apimachinery/pkg/util/version"
"k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework"
imageutils "k8s.io/kubernetes/test/utils/image" imageutils "k8s.io/kubernetes/test/utils/image"
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo"
) )
var (
hostIPVersion = utilversion.MustParseSemantic("v1.8.0")
podUIDVersion = utilversion.MustParseSemantic("v1.8.0")
)
var _ = Describe("[sig-node] Downward API", func() { var _ = Describe("[sig-node] Downward API", func() {
f := framework.NewDefaultFramework("downward-api") f := framework.NewDefaultFramework("downward-api")
@ -90,7 +84,6 @@ var _ = Describe("[sig-node] Downward API", func() {
Description: Downward API MUST expose Pod and Container fields as environment variables. Specify host IP as environment variable in the Pod Spec are visible at runtime in the container. Description: Downward API MUST expose Pod and Container fields as environment variables. Specify host IP as environment variable in the Pod Spec are visible at runtime in the container.
*/ */
framework.ConformanceIt("should provide host IP as an env var [NodeConformance]", func() { framework.ConformanceIt("should provide host IP as an env var [NodeConformance]", func() {
framework.SkipUnlessServerVersionGTE(hostIPVersion, f.ClientSet.Discovery())
podName := "downward-api-" + string(uuid.NewUUID()) podName := "downward-api-" + string(uuid.NewUUID())
env := []v1.EnvVar{ env := []v1.EnvVar{
{ {
@ -218,7 +211,6 @@ var _ = Describe("[sig-node] Downward API", func() {
Description: Downward API MUST expose Pod UID set through environment variables at runtime in the container. Description: Downward API MUST expose Pod UID set through environment variables at runtime in the container.
*/ */
framework.ConformanceIt("should provide pod UID as env vars [NodeConformance]", func() { framework.ConformanceIt("should provide pod UID as env vars [NodeConformance]", func() {
framework.SkipUnlessServerVersionGTE(podUIDVersion, f.ClientSet.Discovery())
podName := "downward-api-" + string(uuid.NewUUID()) podName := "downward-api-" + string(uuid.NewUUID())
env := []v1.EnvVar{ env := []v1.EnvVar{
{ {

View File

@ -945,9 +945,6 @@ metadata:
Description: Deploy a redis controller and a redis service. Kubectl describe pods SHOULD return the name, namespace, labels, state and other information as expected. Kubectl describe on rc, service, node and namespace SHOULD also return proper information. Description: Deploy a redis controller and a redis service. Kubectl describe pods SHOULD return the name, namespace, labels, state and other information as expected. Kubectl describe on rc, service, node and namespace SHOULD also return proper information.
*/ */
framework.ConformanceIt("should check if kubectl describe prints relevant information for rc and pods ", func() { framework.ConformanceIt("should check if kubectl describe prints relevant information for rc and pods ", func() {
kv, err := framework.KubectlVersion()
framework.ExpectNoError(err)
framework.SkipUnlessServerVersionGTE(kv, c.Discovery())
controllerJSON := commonutils.SubstituteImageName(string(readTestFileOrDie(redisControllerFilename))) controllerJSON := commonutils.SubstituteImageName(string(readTestFileOrDie(redisControllerFilename)))
serviceJSON := readTestFileOrDie(redisServiceFilename) serviceJSON := readTestFileOrDie(redisServiceFilename)