Move docker tests into tests folder (#9555)

* 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>
This commit is contained in:
Derek Nola 2024-03-04 09:15:40 -08:00 committed by GitHub
parent 138a107f4c
commit 935ad1dbac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
19 changed files with 26 additions and 93 deletions

View File

@ -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
@ -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 $?"
# ---

View File

@ -1,72 +0,0 @@
# db OpenSSL configuration file.
SAN = "IP:127.0.0.1, IP:172.17.0.1, DNS:host.docker.internal"
dir = .
[ ca ]
default_ca = db_ca
[ db_ca ]
certs = $dir/certs
certificate = $dir/certs/ca.crt
crl = $dir/crl.pem
crl_dir = $dir/crl
crlnumber = $dir/crlnumber
database = $dir/index.txt
email_in_dn = no
new_certs_dir = $dir/newcerts
private_key = $dir/private/ca.key
serial = $dir/serial
RANDFILE = $dir/private/.rand
name_opt = ca_default
cert_opt = ca_default
default_days = 3650
default_crl_days = 30
default_md = sha512
preserve = no
policy = policy_db
[ policy_db ]
organizationName = optional
commonName = supplied
[ req ]
default_bits = 1024
default_keyfile = privkey.pem
distinguished_name = req_distinguished_name
attributes = req_attributes
x509_extensions = v3_ca
string_mask = utf8only
req_extensions = db_client
[ req_distinguished_name ]
countryName = Country Name (2 letter code)
countryName_default = US
countryName_min = 2
countryName_max = 2
commonName = Common Name (FQDN)
0.organizationName = Organization Name (eg, company)
0.organizationName_default = db-ca
[ req_attributes ]
[ v3_ca ]
basicConstraints = CA:true
keyUsage = keyCertSign,cRLSign
subjectKeyIdentifier = hash
[ db_client ]
basicConstraints = CA:FALSE
extendedKeyUsage = clientAuth
keyUsage = digitalSignature, keyEncipherment
[ db_peer ]
basicConstraints = CA:FALSE
extendedKeyUsage = clientAuth, serverAuth
keyUsage = digitalSignature, keyEncipherment
subjectAltName = ${ENV::SAN}
[ db_server ]
basicConstraints = CA:FALSE
extendedKeyUsage = clientAuth, serverAuth
keyUsage = digitalSignature, keyEncipherment
subjectAltName = ${ENV::SAN}

View File

@ -1,2 +0,0 @@
#!/bin/bash
go test -v ./pkg/... -run Unit

View File

@ -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)
@ -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:

View File

@ -511,7 +511,7 @@ run-test() {
)
export PROVISION_LOCK=$(mktemp)
./scripts/test-runner "$@" &
./tests/docker/test-runner "$@" &
pids+=($!)
(
@ -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 \

View File

@ -1,6 +1,6 @@
#!/bin/bash
set -x -e
cd $(dirname $0)/..
cd $(dirname $0)/../..
# ---

View File

@ -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" ]
}

View File

@ -1,6 +1,6 @@
#!/bin/bash
. ./scripts/test-setup-sonobuoy
. ./tests/docker/test-setup-sonobuoy
export NUM_SERVERS=1
export NUM_AGENTS=1
@ -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" ]
}

View File

@ -1,6 +1,6 @@
#!/bin/bash
. ./scripts/test-setup-sonobuoy
. ./tests/docker/test-setup-sonobuoy
# ---
@ -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" ]
}

View File

@ -1,6 +1,6 @@
#!/bin/bash
. ./scripts/test-setup-sonobuoy
. ./tests/docker/test-setup-sonobuoy
# ---
@ -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" ]
}