Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nfs-subdir-external-provisioner
Project
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Rancher商店
nfs-subdir-external-provisioner
Commits
aa45a1cd
Commit
aa45a1cd
authored
Apr 08, 2019
by
Patrick Ohly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prow.sh: more efficient execution of individual tests
When running only some tests, sometimes extra, unnecessarily work was done, like bringing up the cluster without alpha gates.
parent
f3d1d2df
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
116 additions
and
98 deletions
+116
-98
prow.sh
prow.sh
+116
-98
No files found.
prow.sh
View file @
aa45a1cd
...
@@ -202,18 +202,30 @@ configvar CSI_PROW_SANITY_CONTAINER "hostpath" "Kubernetes container with CSI dr
...
@@ -202,18 +202,30 @@ configvar CSI_PROW_SANITY_CONTAINER "hostpath" "Kubernetes container with CSI dr
# is off by default. A CSI driver can change that default in its .prow.sh
# is off by default. A CSI driver can change that default in its .prow.sh
# by setting CSI_PROW_TESTS_SANITY.
# by setting CSI_PROW_TESTS_SANITY.
configvar CSI_PROW_TESTS
"unit parallel serial parallel-alpha serial-alpha
${
CSI_PROW_TESTS_SANITY
}
"
"tests to run"
configvar CSI_PROW_TESTS
"unit parallel serial parallel-alpha serial-alpha
${
CSI_PROW_TESTS_SANITY
}
"
"tests to run"
test_enabled
()
{
tests_enabled
()
{
local test
=
"
$1
"
local
t1 t2
# We want word-splitting here, so ignore: Double quote to prevent globbing and word splitting.
# We want word-splitting here, so ignore: Quote to prevent word splitting, or split robustly with mapfile or read -a.
# shellcheck disable=SC2086
# shellcheck disable=SC2206
set
${
CSI_PROW_TESTS
}
local
tests
=(
${
CSI_PROW_TESTS
}
)
for
t
in
"
$@
"
;
do
for
t1
in
"
$@
"
;
do
if
[
"
$t
"
=
"
$test
"
]
;
then
for
t2
in
"
${
tests
[@]
}
"
;
do
return
if
[
"
$t1
"
=
"
$t2
"
]
;
then
fi
return
fi
done
done
done
return
1
return
1
}
}
tests_need_kind
()
{
tests_enabled
"sanity"
"parallel"
"serial"
"serial-alpha"
"parallel-alpha"
}
tests_need_non_alpha_cluster
()
{
tests_enabled
"sanity"
"parallel"
"serial"
}
tests_need_alpha_cluster
()
{
tests_enabled
"parallel-alpha"
"serial-alpha"
}
# Serial vs. parallel is always determined by these regular expressions.
# Serial vs. parallel is always determined by these regular expressions.
# Individual regular expressions are seperated by spaces for readability
# Individual regular expressions are seperated by spaces for readability
...
@@ -521,6 +533,15 @@ install_hostpath () {
...
@@ -521,6 +533,15 @@ install_hostpath () {
return
1
return
1
fi
fi
if
${
CSI_PROW_BUILD_JOB
}
;
then
# Ignore: Double quote to prevent globbing and word splitting.
# Ignore: To read lines rather than words, pipe/redirect to a 'while read' loop.
# shellcheck disable=SC2086 disable=SC2013
for
i
in
$(
grep
'^\s*CMDS\s*='
Makefile |
sed
-e
's/\s*CMDS\s*=//'
)
;
do
kind load docker-image
--name
csi-prow
$i
:csiprow
||
die
"could not load the
$i
:latest image into the kind cluster"
done
fi
if
deploy_hostpath
=
"
$(
find_deployment
"
$(
pwd
)
/deploy"
)
"
;
then
if
deploy_hostpath
=
"
$(
find_deployment
"
$(
pwd
)
/deploy"
)
"
;
then
:
:
elif
[
"
${
CSI_PROW_HOSTPATH_REPO
}
"
=
"none"
]
;
then
elif
[
"
${
CSI_PROW_HOSTPATH_REPO
}
"
=
"none"
]
;
then
...
@@ -836,7 +857,7 @@ main () {
...
@@ -836,7 +857,7 @@ main () {
# might have been minor or unavoidable, for example when experimenting with
# might have been minor or unavoidable, for example when experimenting with
# changes in "release-tools" in a PR (that fails the "is release-tools unmodified"
# changes in "release-tools" in a PR (that fails the "is release-tools unmodified"
# test).
# test).
if
test_enabled
"unit"
;
then
if
test
s
_enabled
"unit"
;
then
if
!
run_with_go
"
${
CSI_PROW_GO_VERSION_BUILD
}
"
make
-k
test
2>&1 | make_test_to_junit
;
then
if
!
run_with_go
"
${
CSI_PROW_GO_VERSION_BUILD
}
"
make
-k
test
2>&1 | make_test_to_junit
;
then
warn
"'make test' failed, proceeding anyway"
warn
"'make test' failed, proceeding anyway"
ret
=
1
ret
=
1
...
@@ -846,102 +867,99 @@ main () {
...
@@ -846,102 +867,99 @@ main () {
run_with_go
"
${
CSI_PROW_GO_VERSION_BUILD
}
"
make container
||
die
"'make container' failed"
run_with_go
"
${
CSI_PROW_GO_VERSION_BUILD
}
"
make container
||
die
"'make container' failed"
fi
fi
i
nstall_kind
||
die
"installing kind failed"
i
f
tests_need_kind
;
then
start_cluster
||
die
"starting the cluster
failed"
install_kind
||
die
"installing kind
failed"
if
${
CSI_PROW_BUILD_JOB
}
;
then
if
${
CSI_PROW_BUILD_JOB
}
;
then
cmds
=
"
$(
grep
'^\s*CMDS\s*='
Makefile |
sed
-e
's/\s*CMDS\s*=//'
)
"
cmds
=
"
$(
grep
'^\s*CMDS\s*='
Makefile |
sed
-e
's/\s*CMDS\s*=//'
)
"
# Get the image that was just built (if any) from the
# Get the image that was just built (if any) from the
# top-level Makefile CMDS variable and set the
# top-level Makefile CMDS variable and set the
# deploy-hostpath.sh env variables for it. We also need to
# deploy-hostpath.sh env variables for it. We also need to
# side-load those images into the cluster.
# side-load those images into the cluster.
for
i
in
$cmds
;
do
for
i
in
$cmds
;
do
e
=
$(
echo
"
$i
"
|
tr
'[:lower:]'
'[:upper:]'
|
tr
- _
)
e
=
$(
echo
"
$i
"
|
tr
'[:lower:]'
'[:upper:]'
|
tr
- _
)
images
=
"
$images
${
e
}
_REGISTRY=none
${
e
}
_TAG=csiprow"
images
=
"
$images
${
e
}
_REGISTRY=none
${
e
}
_TAG=csiprow"
# We must avoid the tag "latest" because that implies
# We must avoid the tag "latest" because that implies
# always pulling the image
# always pulling the image
# (https://github.com/kubernetes-sigs/kind/issues/328).
# (https://github.com/kubernetes-sigs/kind/issues/328).
docker tag
"
$i
:latest"
"
$i
:csiprow"
||
die
"tagging the locally built container image for
$i
failed"
docker tag
"
$i
:latest"
"
$i
:csiprow"
||
die
"tagging the locally built container image for
$i
failed"
kind load docker-image
--name
csi-prow
"
$i
:csiprow"
||
die
"could not load the
$i
:latest image into the kind cluster"
done
done
if
[
-e
deploy/kubernetes/rbac.yaml
]
;
then
if
[
-e
deploy/kubernetes/rbac.yaml
]
;
then
# This is one of those components which has its own RBAC rules (like external-provisioner).
# This is one of those components which has its own RBAC rules (like external-provisioner).
# We are testing a locally built image and also want to test with the the current,
# We are testing a locally built image and also want to test with the the current,
# potentially modified RBAC rules.
# potentially modified RBAC rules.
if
[
"
$(
echo
"
$cmds
"
|
wc
-w
)
"
!=
1
]
;
then
if
[
"
$(
echo
"
$cmds
"
|
wc
-w
)
"
!=
1
]
;
then
die
"ambiguous deploy/kubernetes/rbac.yaml: need exactly one command, got:
$cmds
"
die
"ambiguous deploy/kubernetes/rbac.yaml: need exactly one command, got:
$cmds
"
fi
e
=
$(
echo
"
$cmds
"
|
tr
'[:lower:]'
'[:upper:]'
|
tr
- _
)
images
=
"
$images
${
e
}
_RBAC=
$(
pwd
)
/deploy/kubernetes/rbac.yaml"
fi
fi
e
=
$(
echo
"
$cmds
"
|
tr
'[:lower:]'
'[:upper:]'
|
tr
- _
)
images
=
"
$images
${
e
}
_RBAC=
$(
pwd
)
/deploy/kubernetes/rbac.yaml"
fi
fi
# Installing the driver might be disabled, in which case we bail out early.
if
!
install_hostpath
"
$images
"
;
then
info
"hostpath driver installation disabled, skipping E2E testing"
return
"
$ret
"
fi
collect_cluster_info
if
test_enabled
"sanity"
;
then
if
!
run_sanity
;
then
ret
=
1
fi
fi
if
test_enabled
"parallel"
;
then
# Ignore: Double quote to prevent globbing and word splitting.
# shellcheck disable=SC2086
if
!
run_e2e parallel
${
CSI_PROW_GINKO_PARALLEL
}
\
-focus
=
"External.Storage"
\
-skip
=
"
$(
regex_join
"
${
CSI_PROW_E2E_SERIAL
}
"
"
${
CSI_PROW_E2E_ALPHA
}
"
"
${
CSI_PROW_E2E_SKIP
}
"
)
"
;
then
warn
"E2E parallel failed"
ret
=
1
fi
fi
fi
if
test_enabled
"serial"
;
then
if
!
run_e2e serial
\
-focus
=
"External.Storage.*(
$(
regex_join
"
${
CSI_PROW_E2E_SERIAL
}
"
)
)"
\
-skip
=
"
$(
regex_join
"
${
CSI_PROW_E2E_ALPHA
}
"
"
${
CSI_PROW_E2E_SKIP
}
"
)
"
;
then
warn
"E2E serial failed"
ret
=
1
fi
fi
if
(
test_enabled
"parallel-alpha"
||
test_enabled
"serial-alpha"
)
&&
[
"
${
CSI_PROW_E2E_ALPHA_GATES
}
"
]
;
then
if
tests_need_non_alpha_cluster
;
then
# Need to (re)create the cluster.
start_cluster
||
die
"starting the non-alpha cluster failed"
start_cluster
"
${
CSI_PROW_E2E_ALPHA_GATES
}
"
||
die
"starting alpha cluster failed"
if
${
CSI_PROW_BUILD_JOB
}
;
then
# Installing the driver might be disabled.
# Ignore: Double quote to prevent globbing and word splitting.
if
install_hostpath
"
$images
"
;
then
# Ignore: To read lines rather than words, pipe/redirect to a 'while read' loop.
collect_cluster_info
# shellcheck disable=SC2086 disable=SC2013
for
i
in
$(
grep
'^\s*CMDS\s*='
Makefile |
sed
-e
's/\s*CMDS\s*=//'
)
;
do
if
tests_enabled
"sanity"
;
then
kind load docker-image
--name
csi-prow
$i
:csiprow
||
die
"could not load the
$i
:latest image into the kind cluster"
if
!
run_sanity
;
then
done
ret
=
1
fi
fi
install_hostpath
"
$images
"
||
die
"hostpath driver installation failed unexpectedly on alpha cluster"
fi
if
test_enabled
"parallel-alpha"
;
then
if
tests_enabled
"parallel"
;
then
# Ignore: Double quote to prevent globbing and word splitting.
# Ignore: Double quote to prevent globbing and word splitting.
# shellcheck disable=SC2086
# shellcheck disable=SC2086
if
!
run_e2e parallel-alpha
${
CSI_PROW_GINKO_PARALLEL
}
\
if
!
run_e2e parallel
${
CSI_PROW_GINKO_PARALLEL
}
\
-focus
=
"External.Storage.*(
$(
regex_join
"
${
CSI_PROW_E2E_ALPHA
}
"
)
)"
\
-focus
=
"External.Storage"
\
-skip
=
"
$(
regex_join
"
${
CSI_PROW_E2E_SERIAL
}
"
"
${
CSI_PROW_E2E_SKIP
}
"
)
"
;
then
-skip
=
"
$(
regex_join
"
${
CSI_PROW_E2E_SERIAL
}
"
"
${
CSI_PROW_E2E_ALPHA
}
"
"
${
CSI_PROW_E2E_SKIP
}
"
)
"
;
then
warn
"E2E parallel alpha failed"
warn
"E2E parallel failed"
ret
=
1
ret
=
1
fi
fi
if
tests_enabled
"serial"
;
then
if
!
run_e2e serial
\
-focus
=
"External.Storage.*(
$(
regex_join
"
${
CSI_PROW_E2E_SERIAL
}
"
)
)"
\
-skip
=
"
$(
regex_join
"
${
CSI_PROW_E2E_ALPHA
}
"
"
${
CSI_PROW_E2E_SKIP
}
"
)
"
;
then
warn
"E2E serial failed"
ret
=
1
fi
fi
fi
fi
fi
fi
if
test_enabled
"serial-alpha"
;
then
if
tests_need_alpha_cluster
&&
[
"
${
CSI_PROW_E2E_ALPHA_GATES
}
"
]
;
then
if
!
run_e2e serial-alpha
\
# Need to (re)create the cluster.
-focus
=
"External.Storage.*((
$(
regex_join
"
${
CSI_PROW_E2E_SERIAL
}
"
)
).*(
$(
regex_join
"
${
CSI_PROW_E2E_ALPHA
}
"
)
)|(
$(
regex_join
"
${
CSI_PROW_E2E_ALPHA
}
"
)
).*(
$(
regex_join
"
${
CSI_PROW_E2E_SERIAL
}
"
)
))"
\
start_cluster
"
${
CSI_PROW_E2E_ALPHA_GATES
}
"
||
die
"starting alpha cluster failed"
-skip
=
"
$(
regex_join
"
${
CSI_PROW_E2E_SKIP
}
"
)
"
;
then
warn
"E2E serial alpha failed"
# Installing the driver might be disabled.
ret
=
1
if
install_hostpath
"
$images
"
;
then
collect_cluster_info
if
tests_enabled
"parallel-alpha"
;
then
# Ignore: Double quote to prevent globbing and word splitting.
# shellcheck disable=SC2086
if
!
run_e2e parallel-alpha
${
CSI_PROW_GINKO_PARALLEL
}
\
-focus
=
"External.Storage.*(
$(
regex_join
"
${
CSI_PROW_E2E_ALPHA
}
"
)
)"
\
-skip
=
"
$(
regex_join
"
${
CSI_PROW_E2E_SERIAL
}
"
"
${
CSI_PROW_E2E_SKIP
}
"
)
"
;
then
warn
"E2E parallel alpha failed"
ret
=
1
fi
fi
if
tests_enabled
"serial-alpha"
;
then
if
!
run_e2e serial-alpha
\
-focus
=
"External.Storage.*((
$(
regex_join
"
${
CSI_PROW_E2E_SERIAL
}
"
)
).*(
$(
regex_join
"
${
CSI_PROW_E2E_ALPHA
}
"
)
)|(
$(
regex_join
"
${
CSI_PROW_E2E_ALPHA
}
"
)
).*(
$(
regex_join
"
${
CSI_PROW_E2E_SERIAL
}
"
)
))"
\
-skip
=
"
$(
regex_join
"
${
CSI_PROW_E2E_SKIP
}
"
)
"
;
then
warn
"E2E serial alpha failed"
ret
=
1
fi
fi
fi
fi
fi
fi
fi
fi
...
...
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