Check conformance test should not call any Skip

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.
k3s-v1.15.3
Kenichi Omichi 2019-04-17 19:37:29 +00:00
parent 6f1fd17b7a
commit 52885a8ec3
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() {
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)
@ -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 {
@ -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) {

View File

@ -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)

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/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",

View File

@ -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")
@ -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{
{
@ -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{
{

View File

@ -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)