Skip to content

Commit

Permalink
Move docker tests into tests folder (#9555)
Browse files Browse the repository at this point in the history
* Move docker tests into tests folder
* Remove old test certs
* Update TESTING.md with docker test inf

Signed-off-by: Derek Nola <derek.nola@suse.com>
  • Loading branch information
dereknola committed Mar 8, 2024
1 parent 4761bef commit e1dcbf4
Show file tree
Hide file tree
Showing 19 changed files with 26 additions and 93 deletions.
18 changes: 9 additions & 9 deletions scripts/test
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -e -x
cd $(dirname $0)/..

. ./scripts/version.sh
. ./scripts/test-helpers
. ./tests/docker/test-helpers

# sysctl commands
sysctl -w fs.inotify.max_queued_events=16384
Expand All @@ -21,28 +21,28 @@ docker ps

# ---

. ./scripts/test-run-basics
. ./tests/docker/test-run-basics
echo "Did test-run-basics $?"

. ./scripts/test-run-compat
. ./tests/docker/test-run-compat
echo "Did test-run-compat $?"

. ./scripts/test-run-hardened
. ./tests/docker/test-run-hardened
echo "Did test-run-hardened $?"

. ./scripts/test-run-cacerts
. ./tests/docker/test-run-cacerts
echo "Did test-run-cacerts $?"

. ./scripts/test-run-bootstraptoken
. ./tests/docker/test-run-bootstraptoken
echo "Did test-run-bootstraptoken $?"

. ./scripts/test-run-upgrade
. ./tests/docker/test-run-upgrade
echo "Did test-run-upgrade $?"

. ./scripts/test-run-etcd
. ./tests/docker/test-run-etcd
echo "Did test-run-etcd $?"

. ./scripts/test-run-lazypull
. ./tests/docker/test-run-lazypull
echo "Did test-run-lazypull $?"

# ---
Expand Down
72 changes: 0 additions & 72 deletions scripts/test-certs-openssl.cnf

This file was deleted.

2 changes: 0 additions & 2 deletions scripts/test-unit

This file was deleted.

7 changes: 7 additions & 0 deletions tests/TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Testing in K3s comes in 5 forms:
- [Unit](#unit-tests)
- [Integration](#integration-tests)
- [Docker](#docker-tests)
- [Smoke](#smoke-tests)
- [Performance](#performance)
- [End-to-End (E2E)](#end-to-end-e2e-tests)
Expand Down Expand Up @@ -59,6 +60,12 @@ See [integration/README.md](./integration/README.md) for more info.

___

## Docker Tests

Docker tests run clusters of K3s nodes as containers and test basic functionality. These tests are run in the Drone CI pipeline `test` stage.

___

## Smoke Tests

Smoke tests are a collection of tests defined under the [tests](./tests) and fall into two categories: install and snapshotter. These tests are used to validate the installation and operation of K3s on a variety of operating systems. The sub-directories therein contain fixtures for running simple clusters to assert correct behavior for "happy path" scenarios. The test themses are Vagrantfiles describing single-node installations that are easily spun up with Vagrant for the `libvirt` and `virtualbox` providers:
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions scripts/test-helpers → tests/docker/test-helpers
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ run-test() {
)

export PROVISION_LOCK=$(mktemp)
./scripts/test-runner "$@" &
./tests/docker/test-runner "$@" &
pids+=($!)

(
Expand Down Expand Up @@ -585,7 +585,7 @@ test-run-sonobuoy() {
fi

cleanup-test-env
. ./scripts/test-setup-sonobuoy$suffix
. ./tests/docker/test-setup-sonobuoy$suffix

if [ "$1" = "parallel" ] || [ "$2" = "parallel" ]; then
label=PARALLEL \
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion scripts/test-runner → tests/docker/test-runner
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
set -x -e
cd $(dirname $0)/..
cd $(dirname $0)/../..

# ---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test-post-hook() {
fi
local failures=$(awk '/^Summarizing .* Failures?:$/,0' "$TEST_DIR/sonobuoy/plugins/e2e/results/global/e2e.log")
# Ignore sonobuoy failures if only these flaky tests have failed
flakyFails=$( grep -scF -f ./scripts/flaky-tests <<< "$failures" )
flakyFails=$( grep -scF -f ./tests/docker/flaky-tests <<< "$failures" )
totalFails=$( grep -scF -e "[Fail]" <<< "$failures" )
[ "$totalFails" -le "$flakyFails" ]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

. ./scripts/test-setup-sonobuoy
. ./tests/docker/test-setup-sonobuoy

export NUM_SERVERS=1
export NUM_AGENTS=1
Expand All @@ -20,7 +20,7 @@ test-post-hook() {
fi
local failures=$(awk '/^Summarizing .* Failures?:$/,0' "$TEST_DIR/sonobuoy/plugins/e2e/results/global/e2e.log")
# Ignore sonobuoy failures if only these flaky tests have failed
flakyFails=$( grep -scF -f ./scripts/flaky-tests <<< "$failures" )
flakyFails=$( grep -scF -f ./tests/docker/flaky-tests <<< "$failures" )
totalFails=$( grep -scF -e "[Fail]" <<< "$failures" )
[ "$totalFails" -le "$flakyFails" ]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

. ./scripts/test-setup-sonobuoy
. ./tests/docker/test-setup-sonobuoy

# ---

Expand Down Expand Up @@ -47,7 +47,7 @@ test-post-hook() {
fi
local failures=$(awk '/^Summarizing .* Failures?:$/,0' "$TEST_DIR/sonobuoy/plugins/e2e/results/global/e2e.log")
# Ignore sonobuoy failures if only these flaky tests have failed
flakyFails=$( grep -scF -f ./scripts/flaky-tests <<< "$failures" )
flakyFails=$( grep -scF -f ./tests/docker/flaky-tests <<< "$failures" )
totalFails=$( grep -scF -e "[Fail]" <<< "$failures" )
[ "$totalFails" -le "$flakyFails" ]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

. ./scripts/test-setup-sonobuoy
. ./tests/docker/test-setup-sonobuoy

# ---

Expand Down Expand Up @@ -47,7 +47,7 @@ test-post-hook() {
fi
local failures=$(awk '/^Summarizing .* Failures?:$/,0' "$TEST_DIR/sonobuoy/plugins/e2e/results/global/e2e.log")
# Ignore sonobuoy failures if only these flaky tests have failed
flakyFails=$( grep -scF -f ./scripts/flaky-tests <<< "$failures" )
flakyFails=$( grep -scF -f ./tests/docker/flaky-tests <<< "$failures" )
totalFails=$( grep -scF -e "[Fail]" <<< "$failures" )
[ "$totalFails" -le "$flakyFails" ]
}
Expand Down

0 comments on commit e1dcbf4

Please sign in to comment.