Skip to content
This repository was archived by the owner on Jan 13, 2026. It is now read-only.

Commit bd48a5f

Browse files
authored
Split integration tests' main test group into multiple subgroups (#7913)
<!-- Before you open the request please review the following guidelines and tips to help it be more easily integrated: - Describe the scope of your change - i.e. what the change does. - Describe any known limitations with your change. - Please run any tests or examples that can exercise your modified code. Thank you for contributing! --> The `main` group of the integration tests takes quite a while to complete, which makes the feedback loop of the CI fairly slow. To improve that situation a little bit, we could split the `main` group of tests into several subgroups that run in parallel. ### Description of the change The `main` group of the integration tests is split into several (three) subgroups that run in parallel. <!-- Describe the scope of your change - i.e. what the change does. --> ### Benefits Reduce the time the `test_e2e_local` job takes to complete. <!-- What benefits will be realized by the code change? --> ### Possible drawbacks Increase the resources required by the CI as we need to spin up more k8s clusters in parallel. <!-- Describe any known limitations with your change --> --------- Signed-off-by: Jesús Benito Calzada <jesus.benito@broadcom.com>
1 parent bdf18b5 commit bd48a5f

10 files changed

Lines changed: 65 additions & 87 deletions

.github/workflows/kubeapps-general.yaml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -436,10 +436,12 @@ jobs:
436436
tests_group:
437437
- carvel
438438
- flux
439-
- main
439+
- main-group-1
440+
- main-group-2
441+
- main-group-3
440442
- multicluster
441443
- multicluster-nokubeapps
442-
- operator
444+
- operators
443445
env:
444446
DEFAULT_DEX_IP: "172.18.0.2"
445447
IMG_PREFIX: ${{ needs.setup.outputs.img_prefix }}
@@ -522,11 +524,6 @@ jobs:
522524
- name: "Install multicluster deps"
523525
run: |
524526
./script/install-multicluster-deps.sh
525-
# - name: Setup upterm session
526-
# uses: lhotari/action-upterm@v1
527-
# with:
528-
# limit-access-to-actor: true
529-
# limit-access-to-users: beni0888
530527
- name: "Run e2e tests script"
531528
run: ./script/run_e2e_tests.sh
532529
- name: "Print k8s KubeappsAPIs logs if the tests fail"
File renamed without changes.

integration/tests/main/01-missing-permissions.spec.js renamed to integration/tests/main-group-1/01-missing-permissions.spec.js

File renamed without changes.

integration/tests/main/02-create-package-repository.spec.js renamed to integration/tests/main-group-1/02-create-package-repository.spec.js

File renamed without changes.

integration/tests/main/03-create-private-package-repository.spec.js renamed to integration/tests/main-group-2/03-create-private-package-repository.spec.js

File renamed without changes.

integration/tests/main/04-default-deployment.spec.js renamed to integration/tests/main-group-2/04-default-deployment.spec.js

File renamed without changes.
File renamed without changes.
File renamed without changes.

integration/tests/main/09-user-positive-installation.spec.js renamed to integration/tests/main-group-3/09-user-positive-installation.spec.js

File renamed without changes.

script/e2e-test.sh

Lines changed: 61 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
# Copyright 2018-2024 the Kubeapps contributors.
44
# SPDX-License-Identifier: Apache-2.0
55

6-
set -o errexit
7-
set -o nounset
8-
set -o pipefail
6+
set -euo pipefail
97

108
startTime=$(date +%s)
119

1210
# Constants
1311
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." >/dev/null && pwd)"
1412
ALL_TESTS="all"
1513
MAIN_TESTS="main"
14+
MAIN_TESTS_SUBGROUP="main-group-"
15+
EXISTENT_MAIN_TESTS_SUBGROUPS=3
1616
MULTICLUSTER_TESTS="multicluster"
1717
MULTICLUSTER_NOKUBEAPPS_TESTS="multicluster-nokubeapps"
1818
CARVEL_TESTS="carvel"
1919
FLUX_TESTS="flux"
20-
OPERATOR_TESTS="operator"
20+
OPERATOR_TESTS="operators"
2121
SUPPORTED_TESTS_GROUPS=("${ALL_TESTS}" "${MAIN_TESTS}" "${MULTICLUSTER_TESTS}" "${CARVEL_TESTS}" "${FLUX_TESTS}" "${OPERATOR_TESTS}" "${MULTICLUSTER_NOKUBEAPPS_TESTS}")
2222
INTEGRATION_HOST=kubeapps-ci.kubeapps
2323
INTEGRATION_ENTRYPOINT="http://${INTEGRATION_HOST}"
@@ -40,9 +40,9 @@ DEBUG_MODE=${DEBUG_MODE:-false}
4040
TEST_LATEST_RELEASE=${TEST_LATEST_RELEASE:-false}
4141

4242
# shellcheck disable=SC2076
43-
if [[ ! " ${SUPPORTED_TESTS_GROUPS[*]} " =~ " ${TESTS_GROUP} " ]]; then
43+
if [[ ! " ${SUPPORTED_TESTS_GROUPS[*]} " =~ " ${TESTS_GROUP} " && ! "${TESTS_GROUP}" == "${MAIN_TESTS_SUBGROUP}"* ]]; then
4444
# shellcheck disable=SC2046
45-
echo $(IFS=','; echo "The provided TEST_GROUP [${TESTS_GROUP}] is not supported. Supported groups are: ${SUPPORTED_TESTS_GROUPS[*]}")
45+
echo $(IFS=','; echo "The provided TESTS_GROUP [${TESTS_GROUP}] is not supported. Supported groups are: ${SUPPORTED_TESTS_GROUPS[*]}. Subgroups of the main group are also supported: ${MAIN_TESTS_SUBGROUP}*")
4646
exit 1
4747
fi
4848

@@ -576,14 +576,18 @@ edit_token="$(kubectl get -n kubeapps secret kubeapps-edit-token -o go-template=
576576

577577
info "Bootstrap time: $(elapsedTimeSince "$startTime")"
578578

579-
##################################
580-
######## Main tests group ########
581-
##################################
582-
if [[ "${TESTS_GROUP}" == "${ALL_TESTS}" || "${TESTS_GROUP}" == "${MAIN_TESTS}" ]]; then
583-
sectionStartTime=$(date +%s)
584-
info "Running main Integration tests without k8s API access..."
585-
test_command="
586-
CI_TIMEOUT_MINUTES=40 \
579+
########################################################################################################################
580+
# Returns the test command to be executed to run the e2e tests in the e2e runner image.
581+
# Arguments:
582+
# $1: Test group to be executed (eg. main)
583+
# $2: Timeout in minutes. Optional, default: 20
584+
# Returns: the command to be executed (a yarn command at the time of this writing).
585+
########################################################################################################################
586+
getTestCommand() {
587+
local tests_group=${1:?Missing test group}
588+
local timeout=${2:-20}
589+
echo "
590+
CI_TIMEOUT_MINUTES=${timeout} \
587591
DOCKER_USERNAME=${DOCKER_USERNAME} \
588592
DOCKER_PASSWORD=${DOCKER_PASSWORD} \
589593
DOCKER_REGISTRY_URL=${DOCKER_REGISTRY_URL} \
@@ -593,18 +597,47 @@ if [[ "${TESTS_GROUP}" == "${ALL_TESTS}" || "${TESTS_GROUP}" == "${MAIN_TESTS}"
593597
ADMIN_TOKEN=${admin_token} \
594598
VIEW_TOKEN=${view_token} \
595599
EDIT_TOKEN=${edit_token} \
596-
yarn test \"tests/main/\"
600+
yarn test \"tests/${tests_group}/\"
597601
"
602+
}
603+
604+
########################################################################################################################
605+
# Run a subgroup of the Main tests group.
606+
# Arguments:
607+
# $1: Subgroup to run (eg. main-group-1)
608+
# Returns: None
609+
########################################################################################################################
610+
runMainTestsSubgroup() {
611+
local subgroup=${1:?Missing main tests subgroup to run}
612+
local test_command=$(getTestCommand "${subgroup}" "20")
613+
614+
sectionStartTime=$(date +%s)
615+
info "Running Main Integration tests subgroup [${subgroup}] without k8s API access..."
598616
info "${test_command}"
599617
if ! kubectl exec -it "$pod" -- /bin/sh -c "${test_command}"; then
600618
## Integration tests failed, get report screenshot
601619
warn "PODS status on failure"
602620
kubectl cp "${pod}:/app/reports" ./reports
603621
exit 1
604622
fi
605-
info "Main integration tests succeeded!!"
623+
info "Main integration tests subgroup [${subgroup}] succeeded!!"
624+
info "Execution time: $(elapsedTimeSince "$sectionStartTime")"
625+
}
606626

607-
info "Main tests execution time: $(elapsedTimeSince "$sectionStartTime")"
627+
######################################
628+
######## Main tests SUBGROUPS ########
629+
######################################
630+
if [[ "${TESTS_GROUP}" == "${ALL_TESTS}" || "${TESTS_GROUP}" == "${MAIN_TESTS_SUBGROUP}"* ]]; then
631+
if [[ "${TESTS_GROUP}" == "${ALL_TESTS}" ]]; then
632+
# Run all subgroups
633+
for group in $(seq 1 "${EXISTENT_MAIN_TESTS_SUBGROUPS}"); do
634+
subgroup="${MAIN_TESTS_SUBGROUP}${group}"
635+
runMainTestsSubgroup "${subgroup}"
636+
done
637+
else
638+
# Run a specific subgroup
639+
runMainTestsSubgroup "${TESTS_GROUP}"
640+
fi
608641
fi
609642

610643
###########################################
@@ -613,19 +646,7 @@ fi
613646
if [[ -z "${GKE_VERSION-}" && ("${TESTS_GROUP}" == "${ALL_TESTS}" || "${TESTS_GROUP}" == "${MULTICLUSTER_TESTS}") ]]; then
614647
sectionStartTime=$(date +%s)
615648
info "Running multi-cluster integration tests..."
616-
test_command="
617-
CI_TIMEOUT_MINUTES=40 \
618-
DOCKER_USERNAME=${DOCKER_USERNAME} \
619-
DOCKER_PASSWORD=${DOCKER_PASSWORD} \
620-
DOCKER_REGISTRY_URL=${DOCKER_REGISTRY_URL} \
621-
TEST_TIMEOUT_MINUTES=${TEST_TIMEOUT_MINUTES} \
622-
INTEGRATION_ENTRYPOINT=${INTEGRATION_ENTRYPOINT} \
623-
USE_MULTICLUSTER_OIDC_ENV=${USE_MULTICLUSTER_OIDC_ENV} \
624-
ADMIN_TOKEN=${admin_token} \
625-
VIEW_TOKEN=${view_token} \
626-
EDIT_TOKEN=${edit_token} \
627-
yarn test \"tests/multicluster/\"
628-
"
649+
test_command=$(getTestCommand "${TESTS_GROUP}" "40")
629650
info "${test_command}"
630651
if ! kubectl exec -it "$pod" -- /bin/sh -c "${test_command}"; then
631652
## Integration tests failed, get report screenshot
@@ -654,16 +675,7 @@ if [[ "${TESTS_GROUP}" == "${ALL_TESTS}" || "${TESTS_GROUP}" == "${CARVEL_TESTS}
654675
k8s_wait_for_deployment kubeapps kubeapps-ci
655676

656677
info "Running carvel integration test..."
657-
test_command="
658-
CI_TIMEOUT_MINUTES=20 \
659-
TEST_TIMEOUT_MINUTES=${TEST_TIMEOUT_MINUTES} \
660-
INTEGRATION_ENTRYPOINT=${INTEGRATION_ENTRYPOINT} \
661-
USE_MULTICLUSTER_OIDC_ENV=${USE_MULTICLUSTER_OIDC_ENV} \
662-
ADMIN_TOKEN=${admin_token} \
663-
VIEW_TOKEN=${view_token} \
664-
EDIT_TOKEN=${edit_token} \
665-
yarn test \"tests/carvel/\"
666-
"
678+
test_command=$(getTestCommand "${TESTS_GROUP}" "20")
667679
info "${test_command}"
668680
if ! kubectl exec -it "$pod" -- /bin/sh -c "${test_command}"; then
669681
## Integration tests failed, get report screenshot
@@ -693,16 +705,7 @@ if [[ "${TESTS_GROUP}" == "${ALL_TESTS}" || "${TESTS_GROUP}" == "${FLUX_TESTS}"
693705
k8s_wait_for_deployment kubeapps kubeapps-ci
694706

695707
info "Running flux integration test..."
696-
test_command="
697-
CI_TIMEOUT_MINUTES=20 \
698-
TEST_TIMEOUT_MINUTES=${TEST_TIMEOUT_MINUTES} \
699-
INTEGRATION_ENTRYPOINT=${INTEGRATION_ENTRYPOINT} \
700-
USE_MULTICLUSTER_OIDC_ENV=${USE_MULTICLUSTER_OIDC_ENV} \
701-
ADMIN_TOKEN=${admin_token} \
702-
VIEW_TOKEN=${view_token} \
703-
EDIT_TOKEN=${edit_token} \
704-
yarn test \"tests/flux/\"
705-
"
708+
test_command=$(getTestCommand "${TESTS_GROUP}" "20")
706709
info "${test_command}"
707710

708711
if ! kubectl exec -it "$pod" -- /bin/sh -c "${test_command}"; then
@@ -720,7 +723,7 @@ fi
720723
#######################################
721724
if [[ "${TESTS_GROUP}" == "${ALL_TESTS}" || "${TESTS_GROUP}" == "${OPERATOR_TESTS}" ]]; then
722725
sectionStartTime=$(date +%s)
723-
## Upgrade and run operator test
726+
## Upgrade and run operators test
724727
# Operators are not supported in GKE 1.14 and flaky in 1.15, skipping test
725728
if [[ -z "${GKE_VERSION-}" ]] && [[ -n "${TEST_OPERATORS-}" ]]; then
726729
installOLM "${OLM_VERSION}"
@@ -741,25 +744,17 @@ if [[ "${TESTS_GROUP}" == "${ALL_TESTS}" || "${TESTS_GROUP}" == "${OPERATOR_TEST
741744
info "Waiting for the OperatorHub Catalog to be ready ..."
742745
retry_while isOperatorHubCatalogRunning 24
743746

744-
info "Running operator integration test with k8s API access..."
745-
test_command="
746-
CI_TIMEOUT_MINUTES=20 \
747-
TEST_TIMEOUT_MINUTES=${TEST_TIMEOUT_MINUTES} \
748-
INTEGRATION_ENTRYPOINT=${INTEGRATION_ENTRYPOINT} \
749-
USE_MULTICLUSTER_OIDC_ENV=${USE_MULTICLUSTER_OIDC_ENV} \
750-
ADMIN_TOKEN=${admin_token} \
751-
VIEW_TOKEN=${view_token} \
752-
EDIT_TOKEN=${edit_token} \
753-
yarn test \"tests/operators/\"
754-
"
747+
info "Running operators integration test with k8s API access..."
748+
test_command=$(getTestCommand "${TESTS_GROUP}" "20")
749+
info "${test_command}"
755750
if ! kubectl exec -it "$pod" -- /bin/sh -c "${test_command}"; then
756751
## Integration tests failed, get report screenshot
757752
warn "PODS status on failure"
758753
kubectl cp "${pod}:/app/reports" ./reports
759754
exit 1
760755
fi
761-
info "Operator integration tests (with k8s API access) succeeded!!"
762-
info "Operator tests execution time: $(elapsedTimeSince "$sectionStartTime")"
756+
info "Operators integration tests (with k8s API access) succeeded!!"
757+
info "Operators tests execution time: $(elapsedTimeSince "$sectionStartTime")"
763758
fi
764759
fi
765760

@@ -806,19 +801,7 @@ if [[ -z "${GKE_VERSION-}" && ("${TESTS_GROUP}" == "${ALL_TESTS}" || "${TESTS_GR
806801
info "Waiting for updated Kubeapps components to be ready..."
807802
k8s_wait_for_deployment kubeapps kubeapps-ci
808803

809-
test_command="
810-
CI_TIMEOUT_MINUTES=40 \
811-
DOCKER_USERNAME=${DOCKER_USERNAME} \
812-
DOCKER_PASSWORD=${DOCKER_PASSWORD} \
813-
DOCKER_REGISTRY_URL=${DOCKER_REGISTRY_URL} \
814-
TEST_TIMEOUT_MINUTES=${TEST_TIMEOUT_MINUTES} \
815-
INTEGRATION_ENTRYPOINT=${INTEGRATION_ENTRYPOINT} \
816-
USE_MULTICLUSTER_OIDC_ENV=${USE_MULTICLUSTER_OIDC_ENV} \
817-
ADMIN_TOKEN=${admin_token} \
818-
VIEW_TOKEN=${view_token} \
819-
EDIT_TOKEN=${edit_token} \
820-
yarn test \"tests/multicluster-nokubeapps/\"
821-
"
804+
test_command=$(getTestCommand "${TESTS_GROUP}" "40")
822805
info "${test_command}"
823806

824807
if ! kubectl exec -it "$pod" -- /bin/sh -c "${test_command}"; then
@@ -828,9 +811,7 @@ if [[ -z "${GKE_VERSION-}" && ("${TESTS_GROUP}" == "${ALL_TESTS}" || "${TESTS_GR
828811
exit 1
829812
fi
830813
info "Multi-cluster integration tests succeeded!!"
831-
832-
sectionEndTime=$(date +%s)
833-
info "Multi-cluster tests execution time: $(formattedElapsedTime sectionEndTime-sectionStartTime)"
814+
info "Multi-cluster tests execution time:$(elapsedTimeSince "$sectionStartTime")"
834815
fi
835816

836817
info "Integration tests succeeded!"

0 commit comments

Comments
 (0)