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
f3ea5e5c
Commit
f3ea5e5c
authored
May 10, 2019
by
danielqsj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace test error checking with more readable way
parent
ef9e794a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
14 deletions
+14
-14
resource_quota.go
test/e2e/apimachinery/resource_quota.go
+5
-5
cronjob.go
test/e2e/apps/cronjob.go
+4
-4
deployment.go
test/e2e/apps/deployment.go
+1
-1
kubectl.go
test/e2e/kubectl/kubectl.go
+3
-3
addon_update.go
test/e2e/lifecycle/addon_update.go
+1
-1
No files found.
test/e2e/apimachinery/resource_quota.go
View file @
f3ea5e5c
...
...
@@ -216,7 +216,7 @@ var _ = SIGDescribe("ResourceQuota", func() {
requests
[
v1
.
ResourceMemory
]
=
resource
.
MustParse
(
"100Mi"
)
pod
=
newTestPodForQuota
(
f
,
"fail-pod"
,
requests
,
v1
.
ResourceList
{})
pod
,
err
=
f
.
ClientSet
.
CoreV1
()
.
Pods
(
f
.
Namespace
.
Name
)
.
Create
(
pod
)
gomega
.
Expect
(
err
)
.
To
(
gomega
.
HaveOccurred
()
)
framework
.
ExpectError
(
err
)
ginkgo
.
By
(
"Not allowing a pod to be created that exceeds remaining quota(validation on extended resources)"
)
requests
=
v1
.
ResourceList
{}
...
...
@@ -228,7 +228,7 @@ var _ = SIGDescribe("ResourceQuota", func() {
limits
[
v1
.
ResourceName
(
extendedResourceName
)]
=
resource
.
MustParse
(
"2"
)
pod
=
newTestPodForQuota
(
f
,
"fail-pod-for-extended-resource"
,
requests
,
limits
)
pod
,
err
=
f
.
ClientSet
.
CoreV1
()
.
Pods
(
f
.
Namespace
.
Name
)
.
Create
(
pod
)
gomega
.
Expect
(
err
)
.
To
(
gomega
.
HaveOccurred
()
)
framework
.
ExpectError
(
err
)
ginkgo
.
By
(
"Ensuring a pod cannot update its resource requirements"
)
// a pod cannot dynamically update its resource requirements.
...
...
@@ -238,7 +238,7 @@ var _ = SIGDescribe("ResourceQuota", func() {
requests
[
v1
.
ResourceEphemeralStorage
]
=
resource
.
MustParse
(
"10Gi"
)
podToUpdate
.
Spec
.
Containers
[
0
]
.
Resources
.
Requests
=
requests
_
,
err
=
f
.
ClientSet
.
CoreV1
()
.
Pods
(
f
.
Namespace
.
Name
)
.
Update
(
podToUpdate
)
gomega
.
Expect
(
err
)
.
To
(
gomega
.
HaveOccurred
()
)
framework
.
ExpectError
(
err
)
ginkgo
.
By
(
"Ensuring attempts to update pod resource requirements did not change quota usage"
)
err
=
waitForResourceQuota
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
quotaName
,
usedResources
)
...
...
@@ -561,7 +561,7 @@ var _ = SIGDescribe("ResourceQuota", func() {
},
},
resourceClient
,
testcrd
.
Crd
)
// since we only give one quota, this creation should fail.
gomega
.
Expect
(
err
)
.
To
(
gomega
.
HaveOccurred
()
)
framework
.
ExpectError
(
err
)
ginkgo
.
By
(
"Deleting a custom resource"
)
err
=
deleteCustomResource
(
resourceClient
,
testcr
.
GetName
())
...
...
@@ -1052,7 +1052,7 @@ var _ = SIGDescribe("ResourceQuota [Feature:PodPriority]", func() {
podName2
:=
"testpod-pclass2-2"
pod2
:=
newTestPodForQuotaWithPriority
(
f
,
podName2
,
v1
.
ResourceList
{},
v1
.
ResourceList
{},
"pclass2"
)
pod2
,
err
=
f
.
ClientSet
.
CoreV1
()
.
Pods
(
f
.
Namespace
.
Name
)
.
Create
(
pod2
)
gomega
.
Expect
(
err
)
.
To
(
gomega
.
HaveOccurred
()
)
framework
.
ExpectError
(
err
)
ginkgo
.
By
(
"Deleting first pod"
)
err
=
f
.
ClientSet
.
CoreV1
()
.
Pods
(
f
.
Namespace
.
Name
)
.
Delete
(
pod
.
Name
,
metav1
.
NewDeleteOptions
(
0
))
...
...
test/e2e/apps/cronjob.go
View file @
f3ea5e5c
...
...
@@ -91,7 +91,7 @@ var _ = SIGDescribe("CronJob", func() {
ginkgo
.
By
(
"Ensuring no jobs are scheduled"
)
err
=
waitForNoJobs
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
cronJob
.
Name
,
false
)
gomega
.
Expect
(
err
)
.
To
(
gomega
.
HaveOccurred
()
)
framework
.
ExpectError
(
err
)
ginkgo
.
By
(
"Ensuring no job exists by listing jobs explicitly"
)
jobs
,
err
:=
f
.
ClientSet
.
BatchV1
()
.
Jobs
(
f
.
Namespace
.
Name
)
.
List
(
metav1
.
ListOptions
{})
...
...
@@ -128,7 +128,7 @@ var _ = SIGDescribe("CronJob", func() {
ginkgo
.
By
(
"Ensuring no more jobs are scheduled"
)
err
=
waitForActiveJobs
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
cronJob
.
Name
,
2
)
gomega
.
Expect
(
err
)
.
To
(
gomega
.
HaveOccurred
()
)
framework
.
ExpectError
(
err
)
ginkgo
.
By
(
"Removing cronjob"
)
err
=
deleteCronJob
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
cronJob
.
Name
)
...
...
@@ -183,7 +183,7 @@ var _ = SIGDescribe("CronJob", func() {
ginkgo
.
By
(
"Ensuring no unexpected event has happened"
)
err
=
waitForEventWithReason
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
cronJob
.
Name
,
[]
string
{
"MissingJob"
,
"UnexpectedJob"
})
gomega
.
Expect
(
err
)
.
To
(
gomega
.
HaveOccurred
()
)
framework
.
ExpectError
(
err
)
ginkgo
.
By
(
"Removing cronjob"
)
err
=
deleteCronJob
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
cronJob
.
Name
)
...
...
@@ -213,7 +213,7 @@ var _ = SIGDescribe("CronJob", func() {
ginkgo
.
By
(
"Ensuring job was deleted"
)
_
,
err
=
jobutil
.
GetJob
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
job
.
Name
)
gomega
.
Expect
(
err
)
.
To
(
gomega
.
HaveOccurred
()
)
framework
.
ExpectError
(
err
)
gomega
.
Expect
(
errors
.
IsNotFound
(
err
))
.
To
(
gomega
.
BeTrue
())
ginkgo
.
By
(
"Ensuring the job is not in the cronjob active list"
)
...
...
test/e2e/apps/deployment.go
View file @
f3ea5e5c
...
...
@@ -198,7 +198,7 @@ func stopDeployment(c clientset.Interface, ns, deploymentName string) {
e2elog
.
Logf
(
"Ensuring deployment %s was deleted"
,
deploymentName
)
_
,
err
=
c
.
AppsV1
()
.
Deployments
(
ns
)
.
Get
(
deployment
.
Name
,
metav1
.
GetOptions
{})
gomega
.
Expect
(
err
)
.
To
(
gomega
.
HaveOccurred
()
)
framework
.
ExpectError
(
err
)
gomega
.
Expect
(
errors
.
IsNotFound
(
err
))
.
To
(
gomega
.
BeTrue
())
e2elog
.
Logf
(
"Ensuring deployment %s's RSes were deleted"
,
deploymentName
)
selector
,
err
:=
metav1
.
LabelSelectorAsSelector
(
deployment
.
Spec
.
Selector
)
...
...
test/e2e/kubectl/kubectl.go
View file @
f3ea5e5c
...
...
@@ -711,7 +711,7 @@ metadata:
ginkgo
.
By
(
"trying to use kubectl with invalid token"
)
_
,
err
=
framework
.
RunHostCmd
(
ns
,
simplePodName
,
"/tmp/kubectl get pods --token=invalid --v=7 2>&1"
)
e2elog
.
Logf
(
"got err %v"
,
err
)
gomega
.
Expect
(
err
)
.
To
(
gomega
.
HaveOccurred
()
)
framework
.
ExpectError
(
err
)
gomega
.
Expect
(
err
)
.
To
(
gomega
.
ContainSubstring
(
"Using in-cluster namespace"
))
gomega
.
Expect
(
err
)
.
To
(
gomega
.
ContainSubstring
(
"Using in-cluster configuration"
))
gomega
.
Expect
(
err
)
.
To
(
gomega
.
ContainSubstring
(
"Authorization: Bearer invalid"
))
...
...
@@ -720,7 +720,7 @@ metadata:
ginkgo
.
By
(
"trying to use kubectl with invalid server"
)
_
,
err
=
framework
.
RunHostCmd
(
ns
,
simplePodName
,
"/tmp/kubectl get pods --server=invalid --v=6 2>&1"
)
e2elog
.
Logf
(
"got err %v"
,
err
)
gomega
.
Expect
(
err
)
.
To
(
gomega
.
HaveOccurred
()
)
framework
.
ExpectError
(
err
)
gomega
.
Expect
(
err
)
.
To
(
gomega
.
ContainSubstring
(
"Unable to connect to the server"
))
gomega
.
Expect
(
err
)
.
To
(
gomega
.
ContainSubstring
(
"GET http://invalid/api"
))
...
...
@@ -1717,7 +1717,7 @@ metadata:
ginkgo
.
By
(
"verifying the job "
+
jobName
+
" was deleted"
)
_
,
err
=
c
.
BatchV1
()
.
Jobs
(
ns
)
.
Get
(
jobName
,
metav1
.
GetOptions
{})
gomega
.
Expect
(
err
)
.
To
(
gomega
.
HaveOccurred
()
)
framework
.
ExpectError
(
err
)
gomega
.
Expect
(
apierrs
.
IsNotFound
(
err
))
.
To
(
gomega
.
BeTrue
())
})
})
...
...
test/e2e/lifecycle/addon_update.go
View file @
f3ea5e5c
...
...
@@ -334,7 +334,7 @@ var _ = SIGDescribe("Addon update", func() {
ginkgo
.
By
(
"verify invalid addons weren't created"
)
_
,
err
=
f
.
ClientSet
.
CoreV1
()
.
ReplicationControllers
(
addonNsName
)
.
Get
(
"invalid-addon-test"
,
metav1
.
GetOptions
{})
gomega
.
Expect
(
err
)
.
To
(
gomega
.
HaveOccurred
()
)
framework
.
ExpectError
(
err
)
// Invalid addon manifests and the "ensure exist class" addon will be deleted by the deferred function.
})
...
...
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