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
fde2fedf
Commit
fde2fedf
authored
Oct 24, 2016
by
deads2k
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix kubectl e2e test to avoid alpha versions unless needed
parent
33ebe1f1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
38 deletions
+53
-38
kubectl.go
test/e2e/kubectl.go
+53
-38
No files found.
test/e2e/kubectl.go
View file @
fde2fedf
...
@@ -169,10 +169,62 @@ func runKubectlRetryOrDie(args ...string) string {
...
@@ -169,10 +169,62 @@ func runKubectlRetryOrDie(args ...string) string {
return
output
return
output
}
}
var
_
=
framework
.
KubeDescribe
(
"Kubectl client"
,
func
()
{
// duplicated setup to avoid polluting "normal" clients with alpha features which confuses the generated clients
var
_
=
framework
.
KubeDescribe
(
"Kubectl alpha client"
,
func
()
{
defer
GinkgoRecover
()
defer
GinkgoRecover
()
f
:=
framework
.
NewDefaultGroupVersionFramework
(
"kubectl"
,
BatchV2Alpha1GroupVersion
)
f
:=
framework
.
NewDefaultGroupVersionFramework
(
"kubectl"
,
BatchV2Alpha1GroupVersion
)
var
c
clientset
.
Interface
var
ns
string
BeforeEach
(
func
()
{
c
=
f
.
ClientSet
ns
=
f
.
Namespace
.
Name
})
// Customized Wait / ForEach wrapper for this test. These demonstrate the
framework
.
KubeDescribe
(
"Kubectl run ScheduledJob"
,
func
()
{
var
nsFlag
string
var
sjName
string
BeforeEach
(
func
()
{
nsFlag
=
fmt
.
Sprintf
(
"--namespace=%v"
,
ns
)
sjName
=
"e2e-test-echo-scheduledjob"
})
AfterEach
(
func
()
{
framework
.
RunKubectlOrDie
(
"delete"
,
"scheduledjobs"
,
sjName
,
nsFlag
)
})
It
(
"should create a ScheduledJob"
,
func
()
{
framework
.
SkipIfMissingResource
(
f
.
ClientPool
,
ScheduledJobGroupVersionResource
,
f
.
Namespace
.
Name
)
schedule
:=
"*/5 * * * ?"
framework
.
RunKubectlOrDie
(
"run"
,
sjName
,
"--restart=OnFailure"
,
"--generator=scheduledjob/v2alpha1"
,
"--schedule="
+
schedule
,
"--image="
+
busyboxImage
,
nsFlag
)
By
(
"verifying the ScheduledJob "
+
sjName
+
" was created"
)
sj
,
err
:=
c
.
Batch
()
.
ScheduledJobs
(
ns
)
.
Get
(
sjName
)
if
err
!=
nil
{
framework
.
Failf
(
"Failed getting ScheduledJob %s: %v"
,
sjName
,
err
)
}
if
sj
.
Spec
.
Schedule
!=
schedule
{
framework
.
Failf
(
"Failed creating a ScheduledJob with correct schedule %s"
,
schedule
)
}
containers
:=
sj
.
Spec
.
JobTemplate
.
Spec
.
Template
.
Spec
.
Containers
if
containers
==
nil
||
len
(
containers
)
!=
1
||
containers
[
0
]
.
Image
!=
busyboxImage
{
framework
.
Failf
(
"Failed creating ScheduledJob %s for 1 pod with expected image %s: %#v"
,
sjName
,
busyboxImage
,
containers
)
}
if
sj
.
Spec
.
JobTemplate
.
Spec
.
Template
.
Spec
.
RestartPolicy
!=
api
.
RestartPolicyOnFailure
{
framework
.
Failf
(
"Failed creating a ScheduledJob with correct restart policy for --restart=OnFailure"
)
}
})
})
})
var
_
=
framework
.
KubeDescribe
(
"Kubectl client"
,
func
()
{
defer
GinkgoRecover
()
f
:=
framework
.
NewDefaultFramework
(
"kubectl"
)
// Reustable cluster state function. This won't be adversly affected by lazy initialization of framework.
// Reustable cluster state function. This won't be adversly affected by lazy initialization of framework.
clusterState
:=
func
()
*
framework
.
ClusterVerification
{
clusterState
:=
func
()
*
framework
.
ClusterVerification
{
return
f
.
NewClusterVerification
(
return
f
.
NewClusterVerification
(
...
@@ -1082,43 +1134,6 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
...
@@ -1082,43 +1134,6 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
})
})
})
})
framework
.
KubeDescribe
(
"Kubectl run ScheduledJob"
,
func
()
{
var
nsFlag
string
var
sjName
string
BeforeEach
(
func
()
{
nsFlag
=
fmt
.
Sprintf
(
"--namespace=%v"
,
ns
)
sjName
=
"e2e-test-echo-scheduledjob"
})
AfterEach
(
func
()
{
framework
.
RunKubectlOrDie
(
"delete"
,
"scheduledjobs"
,
sjName
,
nsFlag
)
})
It
(
"should create a ScheduledJob"
,
func
()
{
framework
.
SkipIfMissingResource
(
f
.
ClientPool
,
ScheduledJobGroupVersionResource
,
f
.
Namespace
.
Name
)
schedule
:=
"*/5 * * * ?"
framework
.
RunKubectlOrDie
(
"run"
,
sjName
,
"--restart=OnFailure"
,
"--generator=scheduledjob/v2alpha1"
,
"--schedule="
+
schedule
,
"--image="
+
busyboxImage
,
nsFlag
)
By
(
"verifying the ScheduledJob "
+
sjName
+
" was created"
)
sj
,
err
:=
c
.
Batch
()
.
ScheduledJobs
(
ns
)
.
Get
(
sjName
)
if
err
!=
nil
{
framework
.
Failf
(
"Failed getting ScheduledJob %s: %v"
,
sjName
,
err
)
}
if
sj
.
Spec
.
Schedule
!=
schedule
{
framework
.
Failf
(
"Failed creating a ScheduledJob with correct schedule %s"
,
schedule
)
}
containers
:=
sj
.
Spec
.
JobTemplate
.
Spec
.
Template
.
Spec
.
Containers
if
containers
==
nil
||
len
(
containers
)
!=
1
||
containers
[
0
]
.
Image
!=
busyboxImage
{
framework
.
Failf
(
"Failed creating ScheduledJob %s for 1 pod with expected image %s: %#v"
,
sjName
,
busyboxImage
,
containers
)
}
if
sj
.
Spec
.
JobTemplate
.
Spec
.
Template
.
Spec
.
RestartPolicy
!=
api
.
RestartPolicyOnFailure
{
framework
.
Failf
(
"Failed creating a ScheduledJob with correct restart policy for --restart=OnFailure"
)
}
})
})
framework
.
KubeDescribe
(
"Kubectl run pod"
,
func
()
{
framework
.
KubeDescribe
(
"Kubectl run pod"
,
func
()
{
var
nsFlag
string
var
nsFlag
string
var
podName
string
var
podName
string
...
...
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