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
dcf2dd33
Unverified
Commit
dcf2dd33
authored
May 29, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
May 29, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #77612 from oomichi/add-check-test-code
Add hack/verify-test-code.sh
parents
6e78282a
496a18fe
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
8 deletions
+54
-8
verify-test-code.sh
hack/verify-test-code.sh
+47
-0
webhook.go
test/e2e/apimachinery/webhook.go
+6
-6
limit_range.go
test/e2e/scheduling/limit_range.go
+1
-1
ubernetes_lite_volumes.go
test/e2e/scheduling/ubernetes_lite_volumes.go
+0
-1
No files found.
hack/verify-test-code.sh
0 → 100755
View file @
dcf2dd33
#!/usr/bin/env bash
# Copyright 2019 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set
-o
errexit
set
-o
nounset
set
-o
pipefail
KUBE_ROOT
=
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
/..
cd
"
${
KUBE_ROOT
}
"
mapfile
-t
all_e2e_files < <
(
find
test
/e2e
-name
'*.go'
)
errors_expect_no_error
=()
for
file
in
"
${
all_e2e_files
[@]
}
"
do
if
grep
"Expect(.*)
\.
NotTo(.*HaveOccurred()"
"
${
file
}
"
>
/dev/null
then
errors_expect_no_error+
=(
"
${
file
}
"
)
fi
done
if
[
${#
errors_expect_no_error
[@]
}
-ne
0
]
;
then
{
echo
"Errors:"
for
err
in
"
${
errors_expect_no_error
[@]
}
"
;
do
echo
"
$err
"
done
echo
echo
'The above files need to use framework.ExpectNoError(err) instead of '
echo
'Expect(err).NotTo(HaveOccurred()) or gomega.Expect(err).NotTo(gomega.HaveOccurred())'
echo
}
>
&2
exit
1
fi
echo
'Congratulations! All e2e test source files are valid.'
test/e2e/apimachinery/webhook.go
View file @
dcf2dd33
...
@@ -795,7 +795,7 @@ func testBlockingConfigmapDeletion(f *framework.Framework) {
...
@@ -795,7 +795,7 @@ func testBlockingConfigmapDeletion(f *framework.Framework) {
client
:=
f
.
ClientSet
client
:=
f
.
ClientSet
configmap
:=
nonDeletableConfigmap
(
f
)
configmap
:=
nonDeletableConfigmap
(
f
)
_
,
err
:=
client
.
CoreV1
()
.
ConfigMaps
(
f
.
Namespace
.
Name
)
.
Create
(
configmap
)
_
,
err
:=
client
.
CoreV1
()
.
ConfigMaps
(
f
.
Namespace
.
Name
)
.
Create
(
configmap
)
gomega
.
Expect
(
err
)
.
NotTo
(
gomega
.
HaveOccurred
()
,
"failed to create configmap %s in namespace: %s"
,
configmap
.
Name
,
f
.
Namespace
.
Name
)
framework
.
ExpectNoError
(
err
,
"failed to create configmap %s in namespace: %s"
,
configmap
.
Name
,
f
.
Namespace
.
Name
)
ginkgo
.
By
(
"deleting the configmap should be denied by the webhook"
)
ginkgo
.
By
(
"deleting the configmap should be denied by the webhook"
)
err
=
client
.
CoreV1
()
.
ConfigMaps
(
f
.
Namespace
.
Name
)
.
Delete
(
configmap
.
Name
,
&
metav1
.
DeleteOptions
{})
err
=
client
.
CoreV1
()
.
ConfigMaps
(
f
.
Namespace
.
Name
)
.
Delete
(
configmap
.
Name
,
&
metav1
.
DeleteOptions
{})
...
@@ -813,11 +813,11 @@ func testBlockingConfigmapDeletion(f *framework.Framework) {
...
@@ -813,11 +813,11 @@ func testBlockingConfigmapDeletion(f *framework.Framework) {
cm
.
Data
[
"webhook-e2e-test"
]
=
"webhook-allow"
cm
.
Data
[
"webhook-e2e-test"
]
=
"webhook-allow"
}
}
_
,
err
=
updateConfigMap
(
client
,
f
.
Namespace
.
Name
,
configmap
.
Name
,
toCompliantFn
)
_
,
err
=
updateConfigMap
(
client
,
f
.
Namespace
.
Name
,
configmap
.
Name
,
toCompliantFn
)
gomega
.
Expect
(
err
)
.
NotTo
(
gomega
.
HaveOccurred
()
,
"failed to update configmap %s in namespace: %s"
,
configmap
.
Name
,
f
.
Namespace
.
Name
)
framework
.
ExpectNoError
(
err
,
"failed to update configmap %s in namespace: %s"
,
configmap
.
Name
,
f
.
Namespace
.
Name
)
ginkgo
.
By
(
"deleting the updated configmap should be successful"
)
ginkgo
.
By
(
"deleting the updated configmap should be successful"
)
err
=
client
.
CoreV1
()
.
ConfigMaps
(
f
.
Namespace
.
Name
)
.
Delete
(
configmap
.
Name
,
&
metav1
.
DeleteOptions
{})
err
=
client
.
CoreV1
()
.
ConfigMaps
(
f
.
Namespace
.
Name
)
.
Delete
(
configmap
.
Name
,
&
metav1
.
DeleteOptions
{})
gomega
.
Expect
(
err
)
.
NotTo
(
gomega
.
HaveOccurred
()
,
"failed to delete configmap %s in namespace: %s"
,
configmap
.
Name
,
f
.
Namespace
.
Name
)
framework
.
ExpectNoError
(
err
,
"failed to delete configmap %s in namespace: %s"
,
configmap
.
Name
,
f
.
Namespace
.
Name
)
}
}
func
testAttachingPodWebhook
(
f
*
framework
.
Framework
)
{
func
testAttachingPodWebhook
(
f
*
framework
.
Framework
)
{
...
@@ -1440,7 +1440,7 @@ func testBlockingCustomResourceDeletion(f *framework.Framework, crd *apiextensio
...
@@ -1440,7 +1440,7 @@ func testBlockingCustomResourceDeletion(f *framework.Framework, crd *apiextensio
},
},
}
}
_
,
err
:=
customResourceClient
.
Create
(
crInstance
,
metav1
.
CreateOptions
{})
_
,
err
:=
customResourceClient
.
Create
(
crInstance
,
metav1
.
CreateOptions
{})
gomega
.
Expect
(
err
)
.
NotTo
(
gomega
.
HaveOccurred
()
,
"failed to create custom resource %s in namespace: %s"
,
crInstanceName
,
f
.
Namespace
.
Name
)
framework
.
ExpectNoError
(
err
,
"failed to create custom resource %s in namespace: %s"
,
crInstanceName
,
f
.
Namespace
.
Name
)
ginkgo
.
By
(
"Deleting the custom resource should be denied"
)
ginkgo
.
By
(
"Deleting the custom resource should be denied"
)
err
=
customResourceClient
.
Delete
(
crInstanceName
,
&
metav1
.
DeleteOptions
{})
err
=
customResourceClient
.
Delete
(
crInstanceName
,
&
metav1
.
DeleteOptions
{})
...
@@ -1459,11 +1459,11 @@ func testBlockingCustomResourceDeletion(f *framework.Framework, crd *apiextensio
...
@@ -1459,11 +1459,11 @@ func testBlockingCustomResourceDeletion(f *framework.Framework, crd *apiextensio
data
[
"webhook-e2e-test"
]
=
"webhook-allow"
data
[
"webhook-e2e-test"
]
=
"webhook-allow"
}
}
_
,
err
=
updateCustomResource
(
customResourceClient
,
f
.
Namespace
.
Name
,
crInstanceName
,
toCompliantFn
)
_
,
err
=
updateCustomResource
(
customResourceClient
,
f
.
Namespace
.
Name
,
crInstanceName
,
toCompliantFn
)
gomega
.
Expect
(
err
)
.
NotTo
(
gomega
.
HaveOccurred
()
,
"failed to update custom resource %s in namespace: %s"
,
crInstanceName
,
f
.
Namespace
.
Name
)
framework
.
ExpectNoError
(
err
,
"failed to update custom resource %s in namespace: %s"
,
crInstanceName
,
f
.
Namespace
.
Name
)
ginkgo
.
By
(
"Deleting the updated custom resource should be successful"
)
ginkgo
.
By
(
"Deleting the updated custom resource should be successful"
)
err
=
customResourceClient
.
Delete
(
crInstanceName
,
&
metav1
.
DeleteOptions
{})
err
=
customResourceClient
.
Delete
(
crInstanceName
,
&
metav1
.
DeleteOptions
{})
gomega
.
Expect
(
err
)
.
NotTo
(
gomega
.
HaveOccurred
()
,
"failed to delete custom resource %s in namespace: %s"
,
crInstanceName
,
f
.
Namespace
.
Name
)
framework
.
ExpectNoError
(
err
,
"failed to delete custom resource %s in namespace: %s"
,
crInstanceName
,
f
.
Namespace
.
Name
)
}
}
...
...
test/e2e/scheduling/limit_range.go
View file @
dcf2dd33
...
@@ -146,7 +146,7 @@ var _ = SIGDescribe("LimitRange", func() {
...
@@ -146,7 +146,7 @@ var _ = SIGDescribe("LimitRange", func() {
ginkgo
.
By
(
"Verifying LimitRange updating is effective"
)
ginkgo
.
By
(
"Verifying LimitRange updating is effective"
)
err
=
wait
.
Poll
(
time
.
Second
*
2
,
time
.
Second
*
20
,
func
()
(
bool
,
error
)
{
err
=
wait
.
Poll
(
time
.
Second
*
2
,
time
.
Second
*
20
,
func
()
(
bool
,
error
)
{
limitRange
,
err
=
f
.
ClientSet
.
CoreV1
()
.
LimitRanges
(
f
.
Namespace
.
Name
)
.
Get
(
limitRange
.
Name
,
metav1
.
GetOptions
{})
limitRange
,
err
=
f
.
ClientSet
.
CoreV1
()
.
LimitRanges
(
f
.
Namespace
.
Name
)
.
Get
(
limitRange
.
Name
,
metav1
.
GetOptions
{})
gomega
.
Expect
(
err
)
.
NotTo
(
gomega
.
HaveOccurred
()
)
framework
.
ExpectNoError
(
err
)
return
reflect
.
DeepEqual
(
limitRange
.
Spec
.
Limits
[
0
]
.
Min
,
newMin
),
nil
return
reflect
.
DeepEqual
(
limitRange
.
Spec
.
Limits
[
0
]
.
Min
,
newMin
),
nil
})
})
framework
.
ExpectNoError
(
err
)
framework
.
ExpectNoError
(
err
)
...
...
test/e2e/scheduling/ubernetes_lite_volumes.go
View file @
dcf2dd33
...
@@ -164,7 +164,6 @@ func OnlyAllowNodeZones(f *framework.Framework, zoneCount int, image string) {
...
@@ -164,7 +164,6 @@ func OnlyAllowNodeZones(f *framework.Framework, zoneCount int, image string) {
// Get the related PV
// Get the related PV
pv
,
err
:=
c
.
CoreV1
()
.
PersistentVolumes
()
.
Get
(
claim
.
Spec
.
VolumeName
,
metav1
.
GetOptions
{})
pv
,
err
:=
c
.
CoreV1
()
.
PersistentVolumes
()
.
Get
(
claim
.
Spec
.
VolumeName
,
metav1
.
GetOptions
{})
gomega
.
Expect
(
err
)
.
NotTo
(
gomega
.
HaveOccurred
())
framework
.
ExpectNoError
(
err
)
framework
.
ExpectNoError
(
err
)
pvZone
,
ok
:=
pv
.
ObjectMeta
.
Labels
[
v1
.
LabelZoneFailureDomain
]
pvZone
,
ok
:=
pv
.
ObjectMeta
.
Labels
[
v1
.
LabelZoneFailureDomain
]
...
...
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