Skip to content

Commit

Permalink
Check conformance test should not call any Skip
Browse files Browse the repository at this point in the history
Basically conformance test checks the target k8s cluster works all
features which are specified in each test and that should not depend
on any condition.
This adds checking that conformance test should not call any Skip
methods. And it detects the existing conformance test
"creating/deleting custom resource definition objects works"
calls framework.SkipUnlessServerVersionGTE(). So this removes the
Skip also.
  • Loading branch information
Kenichi Omichi committed May 3, 2019
1 parent 6f1fd17 commit 52885a8
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 18 deletions.
8 changes: 4 additions & 4 deletions hack/conformance/check_conformance_test_requirements.go
Expand Up @@ -34,7 +34,7 @@ const (
//e.g. framework.ConformanceIt("should provide secure master service ", func() {
patternStartConformance = "framework.ConformanceIt\\(.*, func\\(\\) {$"
patternEndConformance = "}\\)$"
patternSkipProviderIs = "Skip.*ProviderIs\\("
patternSkip = "framework.Skip.*\\("
)

// This function checks the requirement: it works for all providers (e.g., no SkipIfProviderIs/SkipUnlessProviderIs calls)
Expand All @@ -44,7 +44,7 @@ func checkAllProviders(e2eFile string) error {

regStartConformance := regexp.MustCompile(patternStartConformance)
regEndConformance := regexp.MustCompile(patternEndConformance)
regSkipProviderIs := regexp.MustCompile(patternSkipProviderIs)
regSkip := regexp.MustCompile(patternSkip)

fileInput, err := ioutil.ReadFile(e2eFile)
if err != nil {
Expand All @@ -62,9 +62,9 @@ func checkAllProviders(e2eFile string) error {
inConformanceCode = true
}
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.
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
}
if regEndConformance.MatchString(line) {
Expand Down
2 changes: 0 additions & 2 deletions test/e2e/apimachinery/custom_resource_definition.go
Expand Up @@ -40,8 +40,6 @@ var _ = SIGDescribe("CustomResourceDefinition resources", func() {
*/
framework.ConformanceIt("creating/deleting custom resource definition objects works ", func() {

framework.SkipUnlessServerVersionGTE(crdVersion, f.ClientSet.Discovery())

config, err := framework.LoadConfig()
if err != nil {
framework.Failf("failed to load config: %v", err)
Expand Down
1 change: 0 additions & 1 deletion test/e2e/common/BUILD
Expand Up @@ -69,7 +69,6 @@ go_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/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/watch:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
Expand Down
8 changes: 0 additions & 8 deletions test/e2e/common/downward_api.go
Expand Up @@ -23,18 +23,12 @@ import (
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/uuid"
utilversion "k8s.io/apimachinery/pkg/util/version"
"k8s.io/kubernetes/test/e2e/framework"
imageutils "k8s.io/kubernetes/test/utils/image"

. "github.com/onsi/ginkgo"
)

var (
hostIPVersion = utilversion.MustParseSemantic("v1.8.0")
podUIDVersion = utilversion.MustParseSemantic("v1.8.0")
)

var _ = Describe("[sig-node] Downward API", func() {
f := framework.NewDefaultFramework("downward-api")

Expand Down Expand Up @@ -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.
*/
framework.ConformanceIt("should provide host IP as an env var [NodeConformance]", func() {
framework.SkipUnlessServerVersionGTE(hostIPVersion, f.ClientSet.Discovery())
podName := "downward-api-" + string(uuid.NewUUID())
env := []v1.EnvVar{
{
Expand Down Expand Up @@ -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.
*/
framework.ConformanceIt("should provide pod UID as env vars [NodeConformance]", func() {
framework.SkipUnlessServerVersionGTE(podUIDVersion, f.ClientSet.Discovery())
podName := "downward-api-" + string(uuid.NewUUID())
env := []v1.EnvVar{
{
Expand Down
3 changes: 0 additions & 3 deletions test/e2e/kubectl/kubectl.go
Expand Up @@ -944,9 +944,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.
*/
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)))
serviceJSON := readTestFileOrDie(redisServiceFilename)

Expand Down

0 comments on commit 52885a8

Please sign in to comment.