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
be7acee3
Commit
be7acee3
authored
May 03, 2019
by
Erik Wilson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add e2e enhancements
parent
b0e42286
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
26 deletions
+27
-26
sonobuoy
scripts/sonobuoy
+23
-17
sonobuoy-e2e-tests
scripts/sonobuoy-e2e-tests
+4
-9
No files found.
scripts/sonobuoy
View file @
be7acee3
...
@@ -40,10 +40,15 @@ cleanup() {
...
@@ -40,10 +40,15 @@ cleanup() {
exit_status
=
$?
exit_status
=
$?
set
+e
set
+e
echo
"Cleaning up"
echo
"Cleaning up"
docker logs
${
K3S_SERVER
}
>
${
OUTPUT
}
/k3s-server.log 2>&1
for
container
in
${
K3S_SERVER
}
${
K3S_AGENT
}
;
do
docker logs
${
K3S_AGENT
}
>
${
OUTPUT
}
/k3s-agent.log 2>&1
docker
cp
${
container
}
:/var/lib/rancher/k3s/agent/containerd/containerd.log
${
OUTPUT
}
/
${
container
}
-containerd
.log
docker
rm
-f
${
K3S_SERVER
}
2>/dev/null
docker logs
${
container
}
>
${
OUTPUT
}
/
${
container
}
.log 2>&1
docker
rm
-f
${
K3S_AGENT
}
2>/dev/null
docker
rm
-f
${
container
}
2>/dev/null
if
[
${
exit_status
}
-ne
0
]
;
then
cat
${
OUTPUT
}
/
${
container
}
-containerd
.log
cat
${
OUTPUT
}
/
${
container
}
.log
fi
done
rm
${
KUBECONFIG
}
rm
${
KUBECONFIG
}
exit
${
exit_status
}
exit
${
exit_status
}
}
}
...
@@ -61,23 +66,13 @@ echo "Started ${K3S_SERVER} @ ${K3S_IP}:${K3S_PORT}"
...
@@ -61,23 +66,13 @@ echo "Started ${K3S_SERVER} @ ${K3S_IP}:${K3S_PORT}"
# ---
# ---
docker run
-d
--name
${
K3S_AGENT
}
--privileged
\
-e
K3S_CLUSTER_SECRET
=
${
SECRET
}
\
-e
K3S_URL
=
https://
${
K3S_IP
}
:
${
K3S_PORT
}
\
${
K3S_IMAGE
}
agent
echo
"Started
${
K3S_AGENT
}
"
# ---
fetch-kubeconfig
()
{
fetch-kubeconfig
()
{
docker
exec
${
K3S_SERVER
}
cat
/etc/rancher/k3s/k3s.yaml 2>/dev/null
\
docker
cp
${
K3S_SERVER
}
:/etc/rancher/k3s/k3s.yaml
${
KUBECONFIG
}
2>/dev/null
|
tee
${
KUBECONFIG
}
}
}
export
-f
fetch-kubeconfig
export
-f
fetch-kubeconfig
wait-for-kubeconfig
()
{
wait-for-kubeconfig
()
{
while
[[
-z
"
$(
fetch-kubeconfig
)
"
]]
;
do
while
!
fetch-kubeconfig
;
do
echo
"Waiting for kubeconfig to become available..."
echo
"Waiting for kubeconfig to become available..."
sleep
5
sleep
5
done
done
...
@@ -88,6 +83,15 @@ timeout --foreground 1m bash -c wait-for-kubeconfig
...
@@ -88,6 +83,15 @@ timeout --foreground 1m bash -c wait-for-kubeconfig
# ---
# ---
docker run
-d
--name
${
K3S_AGENT
}
--privileged
\
-e
K3S_CLUSTER_SECRET
=
${
SECRET
}
\
-e
K3S_URL
=
https://
${
K3S_IP
}
:
${
K3S_PORT
}
\
${
K3S_IMAGE
}
agent
echo
"Started
${
K3S_AGENT
}
"
# ---
count-ready-nodes
()
{
count-ready-nodes
()
{
kubectl get nodes
-o
json
\
kubectl get nodes
-o
json
\
| jq
'.items[].status.conditions[] | select(.type == "Ready" and .status == "True") | .type'
\
| jq
'.items[].status.conditions[] | select(.type == "Ready" and .status == "True") | .type'
\
...
@@ -143,7 +147,9 @@ sonobuoy retrieve ${OUTPUT}
...
@@ -143,7 +147,9 @@ sonobuoy retrieve ${OUTPUT}
tar
xzf
*
_sonobuoy_
*
.tar.gz
tar
xzf
*
_sonobuoy_
*
.tar.gz
results
=
"./plugins/e2e/results/e2e.log"
results
=
"./plugins/e2e/results/e2e.log"
[
-s
${
results
}
]
||
exit
1
[
-s
${
results
}
]
||
exit
1
tail
-20
${
results
}
status
=
$(
tail
-5
${
results
}
|
grep
'^SUCCESS!.*| 0 Failed |'
>
/dev/null
&&
echo
passed
||
echo
failed
)
if
[
-n
"
${
E2E_LOG_OUTPUT
}
"
]
;
then
if
[
-n
"
${
E2E_LOG_OUTPUT
}
"
]
;
then
cp
${
results
}
$
{
E2E_LOG_OUTPUT
}
cp
${
results
}
$
(
echo
${
E2E_LOG_OUTPUT
}
|
sed
-e
"s/-STATUS-/-
${
status
}
-/g"
)
fi
fi
)
)
scripts/sonobuoy-e2e-tests
View file @
be7acee3
...
@@ -23,24 +23,19 @@ run-sonobuoy() {
...
@@ -23,24 +23,19 @@ run-sonobuoy() {
pids+
=(
$!
)
pids+
=(
$!
)
}
}
log_output
=
${
OUTPUT
}
/e2e-
${
ARCH
}
-serial
.log
\
log_output
=
${
OUTPUT
}
/e2e-
STATUS-
${
ARCH
}
-serial
.log
\
run-sonobuoy
--e2e-focus
=
'\[Serial\].*\[Conformance\]'
run-sonobuoy
--e2e-focus
=
'\[Serial\].*\[Conformance\]'
log_output
=
${
OUTPUT
}
/e2e-
${
ARCH
}
-parallel
.log
\
log_output
=
${
OUTPUT
}
/e2e-
STATUS-
${
ARCH
}
-parallel
.log
\
run-sonobuoy
--e2e-focus
=
'\[Conformance\]'
--e2e-skip
=
'\[Serial\]'
--e2e-parallel
=
y
run-sonobuoy
--e2e-focus
=
'\[Conformance\]'
--e2e-skip
=
'\[Serial\]'
--e2e-parallel
=
y
cleanup
()
{
cleanup
()
{
exit_status
=
$?
exit_status
=
$?
set
+e
set
+e
echo
"Killing the tests!"
echo
"Waiting on the tests!"
kill
${
pids
[@]
}
wait
wait
${
pids
[@]
}
exit
${
exit_status
}
exit
${
exit_status
}
}
}
trap
cleanup EXIT
trap
cleanup EXIT
wait
${
pids
[@]
}
wait
${
pids
[@]
}
trap
- EXIT
trap
- EXIT
for
log
in
${
output
[@]
}
;
do
tail
-20
${
log
}
done
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