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