run multi-server e2e tests for multiple k3s versions

This commit is contained in:
iwilltry42 2021-01-29 09:21:38 +01:00
parent 1c61130fdf
commit 504fd3ad31
No known key found for this signature in database
GPG Key ID: 7BA57AD1CFF16110
5 changed files with 19 additions and 3 deletions

View File

@ -32,7 +32,7 @@ steps:
commands: commands:
- apk add git bash curl sudo jq make - apk add git bash curl sudo jq make
- sleep 5 # give docker enough time to start - sleep 5 # give docker enough time to start
- make e2e - make e2e -e E2E_EXTRA=true # E2E_EXTRA=true enables tests with multiple k3s versions
when: when:
event: event:
- push - push

View File

@ -244,6 +244,9 @@ func NodeStart(ctx context.Context, runtime runtimes.Runtime, node *k3d.Node, no
return nil return nil
} }
startTime := time.Now()
log.Debugf("Node %s Start Time: %+v", node.Name, startTime)
// execute lifecycle hook actions // execute lifecycle hook actions
for _, hook := range nodeStartOpts.NodeHooks { for _, hook := range nodeStartOpts.NodeHooks {
if hook.Stage == k3d.LifecycleStagePreStart { if hook.Stage == k3d.LifecycleStagePreStart {
@ -257,7 +260,6 @@ func NodeStart(ctx context.Context, runtime runtimes.Runtime, node *k3d.Node, no
// start the node // start the node
log.Tracef("Starting node '%s'", node.Name) log.Tracef("Starting node '%s'", node.Name)
startTime := time.Now()
if err := runtime.StartNode(ctx, node); err != nil { if err := runtime.StartNode(ctx, node); err != nil {
log.Errorf("Failed to start node '%s'", node.Name) log.Errorf("Failed to start node '%s'", node.Name)
return err return err

View File

@ -50,6 +50,7 @@ done
if [ -z "$E2E_HELPER_IMAGE_TAG" ]; then if [ -z "$E2E_HELPER_IMAGE_TAG" ]; then
docker exec --workdir /src "$k3de2e" make build-helper-images docker exec --workdir /src "$k3de2e" make build-helper-images
# execute tests # execute tests
echo "Start time outside runner: $(date)"
docker exec "$k3de2e" /src/tests/runner.sh docker exec "$k3de2e" /src/tests/runner.sh
else else
# execute tests # execute tests

View File

@ -3,7 +3,7 @@
CURR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" CURR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
[ -d "$CURR_DIR" ] || { echo "FATAL: no current dir (maybe running in zsh?)"; exit 1; } [ -d "$CURR_DIR" ] || { echo "FATAL: no current dir (maybe running in zsh?)"; exit 1; }
K3S_VERSIONS=("v1.17.14-k3s2" "v1.18.12-k3s1" "v1.19.2-k3s1" "v1.19.4-k3s1") K3S_VERSIONS=("v1.17.17-k3s1" "v1.18.15-k3s1" "v1.19.7-k3s1" "v1.20.2-k3s1")
FAILED_TESTS=() FAILED_TESTS=()
# shellcheck source=./common.sh # shellcheck source=./common.sh
@ -25,11 +25,22 @@ for version in "${K3S_VERSIONS[@]}"; do
FAILED_TESTS+=("full_lifecycle: $version") FAILED_TESTS+=("full_lifecycle: $version")
fi fi
$EXE cluster rm -a || failed "failed to delete clusters"
K3S_IMAGE_TAG="$version" $CURR_DIR/test_multi_master.sh K3S_IMAGE_TAG="$version" $CURR_DIR/test_multi_master.sh
if [[ $? -eq 1 ]]; then if [[ $? -eq 1 ]]; then
FAILED_TESTS+=("multi_master: $version") FAILED_TESTS+=("multi_master: $version")
fi fi
$EXE cluster rm -a || failed "failed to delete clusters"
K3S_IMAGE_TAG="$version" $CURR_DIR/test_multi_master_start_stop.sh
if [[ $? -eq 1 ]]; then
FAILED_TESTS+=("multi_master_start_stop: $version")
fi
$EXE cluster rm -a || failed "failed to delete clusters"
done done
if [[ ${#FAILED_TESTS[@]} -gt 0 ]]; then if [[ ${#FAILED_TESTS[@]} -gt 0 ]]; then

View File

@ -18,6 +18,8 @@ info "Preparing filesystem and environment..."
mkdir -p $HOME/.kube mkdir -p $HOME/.kube
echo "Start time inside runner: $(date)"
section "BASIC TESTS" section "BASIC TESTS"
for i in $CURR_DIR/test_*.sh ; do for i in $CURR_DIR/test_*.sh ; do