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
b4f50913
Unverified
Commit
b4f50913
authored
Jan 24, 2020
by
Erik Wilson
Committed by
GitHub
Jan 24, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1348 from erikwilson/error-on-test-fail
Fix exit code on test error
parents
c5728cef
5221af47
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
29 deletions
+15
-29
test-helpers
scripts/test-helpers
+15
-29
No files found.
scripts/test-helpers
View file @
b4f50913
...
@@ -189,12 +189,12 @@ sonobuoy-test() {
...
@@ -189,12 +189,12 @@ sonobuoy-test() {
return
0
return
0
fi
fi
echo
'Starting sonobuoy tests'
echo
'Starting sonobuoy tests'
local
VERSION_CONFORMANCE
=
$(
sed
-e
's/[-+].*$//g'
<<<
"
$VERSION_K8S
"
)
local
conformanceVersion
=
$(
sed
-e
's/[-+].*$//g'
<<<
"
$VERSION_K8S
"
)
sonobuoy run
\
sonobuoy run
\
--config
=
scripts/sonobuoy-config.json
\
--config
=
scripts/sonobuoy-config.json
\
--plugin-env
=
e2e.E2E_USE_GO_RUNNER
=
true
\
--plugin-env
=
e2e.E2E_USE_GO_RUNNER
=
true
\
--kube-conformance-image-version
=
${
VERSION_CONFORMANCE
}
\
--kube-conformance-image-version
=
${
conformanceVersion
}
\
--wait
=
30
\
--wait
=
30
\
$@
&
$@
&
...
@@ -497,28 +497,32 @@ export -f test-run-sonobuoy
...
@@ -497,28 +497,32 @@ export -f test-run-sonobuoy
pid-cleanup
()
{
pid-cleanup
()
{
local
code
=
$?
local
code
=
$?
set
+e
local
failCount
=
0
local
failCount
=
0
set
+e
if
[
$code
-eq
0
]
;
then
for
pid
in
${
pids
[@]
}
;
do
wait
$pid
||
code
=
$?
done
fi
if
[
$code
-ne
0
]
;
then
if
[
$code
-ne
0
]
;
then
for
pid
in
${
pids
[@]
}
;
do
for
pid
in
${
pids
[@]
}
;
do
pkill
-P
$pid
pkill
-P
$pid
wait
$pid
||
failCount
=
$((
failCount+1
))
wait
$pid
||
failCount
=
$((
failCount+1
))
done
done
fi
fi
wait
trap
- EXIT INT TERM
trap
- EXIT INT TERM
set
+x
set
+x
echo
echo
if
[
$failCount
-eq
0
]
;
then
if
[
$failCount
-eq
0
]
;
then
printf
'\033[32mAll tests passed.\033[m\n'
printf
'\033[32mAll tests passed.\033[m\n'
if
[
$code
-ne
0
]
;
then
printf
"
\0
33[31mExit code is
$code
.
\0
33[m
\n
"
fi
else
else
printf
"
\0
33[31m
$failCount
tests failed.
\0
33[m
\n
"
printf
"
\0
33[31m
$failCount
tests failed.
\0
33[m
\n
"
fi
if
[
"
$DRONE_BUILD_EVENT
"
=
'tag'
]
;
then
if
[
"
$DRONE_BUILD_EVENT
"
=
'tag'
]
;
then
printf
"
\0
33[31mIgnoring test failures on tag.
\0
33[m
\n
"
code
=
0
code
=
0
else
code
=
1
fi
fi
fi
echo
echo
exit
$code
exit
$code
...
@@ -527,23 +531,5 @@ export -f pid-cleanup
...
@@ -527,23 +531,5 @@ export -f pid-cleanup
# ---
# ---
wait-pids
()
{
trap
- EXIT
set
+e
local
code
=
0
for
pid
in
"
${
pids
[@]
}
"
;
do
wait
$pid
||
code
=
$?
done
pid-cleanup
if
[
"
$DRONE_BUILD_EVENT
"
=
'tag'
]
;
then
code
=
0
fi
exit
$code
}
export
-f
wait-pids
# ---
pids
=()
pids
=()
trap
pid-cleanup INT TERM
trap
pid-cleanup EXIT INT TERM
trap
wait-pids EXIT
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