Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
14e69103
Commit
14e69103
authored
Jan 13, 2016
by
Isaac Hollander McCreery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skip kubectl tests that don't work before v1.1 when running against a pre-v1.1…
Skip kubectl tests that don't work before v1.1 when running against a pre-v1.1 cluster; fixes #18581
parent
34885806
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
1 deletion
+46
-1
kubectl.go
test/e2e/kubectl.go
+36
-1
util.go
test/e2e/util.go
+10
-0
No files found.
test/e2e/kubectl.go
View file @
14e69103
...
@@ -46,6 +46,7 @@ import (
...
@@ -46,6 +46,7 @@ import (
"k8s.io/kubernetes/pkg/kubectl/cmd/util"
"k8s.io/kubernetes/pkg/kubectl/cmd/util"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/util/wait"
"k8s.io/kubernetes/pkg/util/wait"
"k8s.io/kubernetes/pkg/version"
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/gomega"
.
"github.com/onsi/gomega"
...
@@ -73,7 +74,27 @@ const (
...
@@ -73,7 +74,27 @@ const (
runJobTimeout
=
5
*
time
.
Minute
runJobTimeout
=
5
*
time
.
Minute
)
)
var
proxyRegexp
=
regexp
.
MustCompile
(
"Starting to serve on 127.0.0.1:([0-9]+)"
)
var
(
proxyRegexp
=
regexp
.
MustCompile
(
"Starting to serve on 127.0.0.1:([0-9]+)"
)
// Extended pod logging options were introduced in #13780 (v1.1.0) so we don't expect tests
// that rely on extended pod logging options to work on clusters before that.
//
// TODO(ihmccreery): remove once we don't care about v1.0 anymore, (tentatively in v1.3).
extendedPodLogFilterVersion
=
version
.
MustParse
(
"v1.1.0"
)
// NodePorts were made optional in #12831 (v1.1.0) so we don't expect tests that used to
// require NodePorts but no longer include them to work on clusters before that.
//
// TODO(ihmccreery): remove once we don't care about v1.0 anymore, (tentatively in v1.3).
nodePortsOptionalVersion
=
version
.
MustParse
(
"v1.1.0"
)
// Jobs were introduced in v1.1, so we don't expect tests that rely on jobs to work on
// clusters before that.
//
// TODO(ihmccreery): remove once we don't care about v1.0 anymore, (tentatively in v1.3).
jobsVersion
=
version
.
MustParse
(
"v1.1.0"
)
)
var
_
=
Describe
(
"Kubectl client"
,
func
()
{
var
_
=
Describe
(
"Kubectl client"
,
func
()
{
defer
GinkgoRecover
()
defer
GinkgoRecover
()
...
@@ -133,6 +154,8 @@ var _ = Describe("Kubectl client", func() {
...
@@ -133,6 +154,8 @@ var _ = Describe("Kubectl client", func() {
})
})
It
(
"should create and stop a working application [Conformance]"
,
func
()
{
It
(
"should create and stop a working application [Conformance]"
,
func
()
{
SkipUnlessServerVersionGTE
(
nodePortsOptionalVersion
,
c
)
defer
cleanup
(
guestbookPath
,
ns
,
frontendSelector
,
redisMasterSelector
,
redisSlaveSelector
)
defer
cleanup
(
guestbookPath
,
ns
,
frontendSelector
,
redisMasterSelector
,
redisSlaveSelector
)
By
(
"creating all guestbook components"
)
By
(
"creating all guestbook components"
)
...
@@ -409,6 +432,8 @@ var _ = Describe("Kubectl client", func() {
...
@@ -409,6 +432,8 @@ var _ = Describe("Kubectl client", func() {
})
})
It
(
"should support inline execution and attach"
,
func
()
{
It
(
"should support inline execution and attach"
,
func
()
{
SkipUnlessServerVersionGTE
(
jobsVersion
,
c
)
nsFlag
:=
fmt
.
Sprintf
(
"--namespace=%v"
,
ns
)
nsFlag
:=
fmt
.
Sprintf
(
"--namespace=%v"
,
ns
)
By
(
"executing a command with run and attach with stdin"
)
By
(
"executing a command with run and attach with stdin"
)
...
@@ -524,6 +549,8 @@ var _ = Describe("Kubectl client", func() {
...
@@ -524,6 +549,8 @@ var _ = Describe("Kubectl client", func() {
Describe
(
"Kubectl describe"
,
func
()
{
Describe
(
"Kubectl describe"
,
func
()
{
It
(
"should check if kubectl describe prints relevant information for rc and pods [Conformance]"
,
func
()
{
It
(
"should check if kubectl describe prints relevant information for rc and pods [Conformance]"
,
func
()
{
SkipUnlessServerVersionGTE
(
nodePortsOptionalVersion
,
c
)
mkpath
:=
func
(
file
string
)
string
{
mkpath
:=
func
(
file
string
)
string
{
return
filepath
.
Join
(
testContext
.
RepoRoot
,
"examples/guestbook-go"
,
file
)
return
filepath
.
Join
(
testContext
.
RepoRoot
,
"examples/guestbook-go"
,
file
)
}
}
...
@@ -742,6 +769,8 @@ var _ = Describe("Kubectl client", func() {
...
@@ -742,6 +769,8 @@ var _ = Describe("Kubectl client", func() {
})
})
It
(
"should be able to retrieve and filter logs [Conformance]"
,
func
()
{
It
(
"should be able to retrieve and filter logs [Conformance]"
,
func
()
{
SkipUnlessServerVersionGTE
(
extendedPodLogFilterVersion
,
c
)
forEachPod
(
c
,
ns
,
"app"
,
"redis"
,
func
(
pod
api
.
Pod
)
{
forEachPod
(
c
,
ns
,
"app"
,
"redis"
,
func
(
pod
api
.
Pod
)
{
By
(
"checking for a matching strings"
)
By
(
"checking for a matching strings"
)
_
,
err
:=
lookForStringInLog
(
ns
,
pod
.
Name
,
containerName
,
"The server is now ready to accept connections"
,
podStartTimeout
)
_
,
err
:=
lookForStringInLog
(
ns
,
pod
.
Name
,
containerName
,
"The server is now ready to accept connections"
,
podStartTimeout
)
...
@@ -881,6 +910,8 @@ var _ = Describe("Kubectl client", func() {
...
@@ -881,6 +910,8 @@ var _ = Describe("Kubectl client", func() {
})
})
It
(
"should create a job from an image when restart is OnFailure [Conformance]"
,
func
()
{
It
(
"should create a job from an image when restart is OnFailure [Conformance]"
,
func
()
{
SkipUnlessServerVersionGTE
(
jobsVersion
,
c
)
image
:=
"nginx"
image
:=
"nginx"
By
(
"running the image "
+
image
)
By
(
"running the image "
+
image
)
...
@@ -900,6 +931,8 @@ var _ = Describe("Kubectl client", func() {
...
@@ -900,6 +931,8 @@ var _ = Describe("Kubectl client", func() {
})
})
It
(
"should create a job from an image when restart is Never [Conformance]"
,
func
()
{
It
(
"should create a job from an image when restart is Never [Conformance]"
,
func
()
{
SkipUnlessServerVersionGTE
(
jobsVersion
,
c
)
image
:=
"nginx"
image
:=
"nginx"
By
(
"running the image "
+
image
)
By
(
"running the image "
+
image
)
...
@@ -925,6 +958,8 @@ var _ = Describe("Kubectl client", func() {
...
@@ -925,6 +958,8 @@ var _ = Describe("Kubectl client", func() {
jobName
:=
"e2e-test-rm-busybox-job"
jobName
:=
"e2e-test-rm-busybox-job"
It
(
"should create a job from an image, then delete the job [Conformance]"
,
func
()
{
It
(
"should create a job from an image, then delete the job [Conformance]"
,
func
()
{
SkipUnlessServerVersionGTE
(
jobsVersion
,
c
)
By
(
"executing a command with run --rm and attach with stdin"
)
By
(
"executing a command with run --rm and attach with stdin"
)
t
:=
time
.
NewTimer
(
runJobTimeout
)
t
:=
time
.
NewTimer
(
runJobTimeout
)
defer
t
.
Stop
()
defer
t
.
Stop
()
...
...
test/e2e/util.go
View file @
14e69103
...
@@ -290,6 +290,16 @@ func providerIs(providers ...string) bool {
...
@@ -290,6 +290,16 @@ func providerIs(providers ...string) bool {
return
false
return
false
}
}
func
SkipUnlessServerVersionGTE
(
v
semver
.
Version
,
c
client
.
ServerVersionInterface
)
{
gte
,
err
:=
serverVersionGTE
(
v
,
c
)
if
err
!=
nil
{
Failf
(
"Failed to get server version: %v"
,
err
)
}
if
!
gte
{
Skipf
(
"Not supported for server versions before %q"
,
v
)
}
}
// providersWithSSH are those providers where each node is accessible with SSH
// providersWithSSH are those providers where each node is accessible with SSH
var
providersWithSSH
=
[]
string
{
"gce"
,
"gke"
,
"aws"
}
var
providersWithSSH
=
[]
string
{
"gce"
,
"gke"
,
"aws"
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment