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

Disable 1.4 ScheduledJob tests when master >= 1.5 #38828

Merged
Merged
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
14 changes: 14 additions & 0 deletions test/e2e/scheduledjob.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
client "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/controller/job"
"k8s.io/kubernetes/pkg/util/wait"
"k8s.io/kubernetes/pkg/version"
"k8s.io/kubernetes/test/e2e/framework"
)

Expand All @@ -46,6 +47,19 @@ var _ = framework.KubeDescribe("ScheduledJob", func() {
f := framework.NewFramework("scheduledjob", options, nil)

BeforeEach(func() {
// ScheduledJob was renamed to CronJob for the 1.5
// release. However, the ScheduledJob endpoint still
// exists, but returns CronJob objects. These tests
// can't work with that.
v := version.MustParse("1.5.0")
gte, err := framework.ServerVersionGTE(v, f.Client)
if err != nil {
framework.Failf("Failed to get server version: %v", err)
}
if gte {
framework.Skipf("Not supported for server versions after %q", v)
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not using framework.SkipUnlessServerVersionGTE, like here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I want the inversion of that. SkipIfServerVersionGTE

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But that's exactly what it does, it checks if the server version is at least X. Though I agree, the naming is unfortunate. Compare these lines with your code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name was right. My code was wrong. Thanks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or that 😉

framework.SkipIfMissingResource(f.ClientPool, unversioned.GroupVersionResource{Group: batch.GroupName, Version: "v2alpha1", Resource: "scheduledjobs"}, f.Namespace.Name)
})

Expand Down