Skip to content

Commit

Permalink
CI: Simplify 'acceptancetest' script
Browse files Browse the repository at this point in the history
Now that we skip tests that require optional features or extensions, we
can use standard module discovery rather than a glob of bash to run our
tests.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
  • Loading branch information
stephenfin committed Mar 21, 2024
1 parent 94e5b07 commit 65d6f84
Show file tree
Hide file tree
Showing 19 changed files with 19 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/functional-baremetal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
run: ./script/acceptancetest
env:
DEVSTACK_PATH: ${{ github.workspace }}/devstack
ACCEPTANCE_TESTS_FILTER: '^.*baremetal(.(?!noauth).*)?$'
PACKAGE: "./internal/acceptance/openstack/baremetal/..."
OS_BRANCH: ${{ matrix.openstack_version }}
# TODO(dtantsur): default to "all" when no longer supporting versions before 2024.1
OS_SYSTEM_SCOPE: ${{ matrix.os_system_scope }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/functional-basic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
run: ./script/acceptancetest
env:
DEVSTACK_PATH: ${{ github.workspace }}/devstack
ACCEPTANCE_TESTS_FILTER: '^internal/acceptance/openstack$'
PACKAGE: './internal/acceptance/openstack'
OS_BRANCH: ${{ matrix.openstack_version }}
- name: Generate logs on failure
run: ./script/collectlogs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/functional-blockstorage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
run: ./script/acceptancetest
env:
DEVSTACK_PATH: ${{ github.workspace }}/devstack
ACCEPTANCE_TESTS_FILTER: ^.*blockstorage(.(?!noauth).*)?$
PACKAGE: "./internal/acceptance/openstack/blockstorage/..."
OS_BRANCH: ${{ matrix.openstack_version }}
- name: Generate logs on failure
run: ./script/collectlogs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/functional-clustering.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
run: ./script/acceptancetest
env:
DEVSTACK_PATH: ${{ github.workspace }}/devstack
ACCEPTANCE_TESTS_FILTER: "^.*clustering.*$"
PACKAGE: "./internal/acceptance/openstack/clustering/..."
OS_BRANCH: ${{ matrix.openstack_version }}
- name: Generate logs on failure
run: ./script/collectlogs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/functional-compute.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
run: ./script/acceptancetest
env:
DEVSTACK_PATH: ${{ github.workspace }}/devstack
ACCEPTANCE_TESTS_FILTER: "^.*compute.*$"
PACKAGE: "./internal/acceptance/openstack/compute/..."
OS_BRANCH: ${{ matrix.openstack_version }}
- name: Generate logs on failure
run: ./script/collectlogs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/functional-containerinfra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
run: ./script/acceptancetest
env:
DEVSTACK_PATH: ${{ github.workspace }}/devstack
ACCEPTANCE_TESTS_FILTER: "^.*containerinfra.*$"
PACKAGE: "./internal/acceptance/openstack/containerinfra/..."
OS_BRANCH: ${{ matrix.openstack_version }}
- name: Generate logs on failure
run: ./script/collectlogs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/functional-dns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
run: ./script/acceptancetest
env:
DEVSTACK_PATH: ${{ github.workspace }}/devstack
ACCEPTANCE_TESTS_FILTER: "^acceptance/openstack/dns.*$"
PACKAGE: "./internal/acceptance/openstack/dns/..."
OS_BRANCH: ${{ matrix.openstack_version }}
- name: Generate logs on failure
run: ./script/collectlogs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/functional-fwaas_v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
run: ./script/acceptancetest
env:
DEVSTACK_PATH: ${{ github.workspace }}/devstack
ACCEPTANCE_TESTS_FILTER: "^.*fwaas_v2.*$"
PACKAGE: "./internal/acceptance/openstack/networking/extensions/fwaas_v2/..."
OS_BRANCH: ${{ matrix.openstack_version }}
- name: Generate logs on failure
run: ./script/collectlogs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/functional-identity.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
run: ./script/acceptancetest
env:
DEVSTACK_PATH: ${{ github.workspace }}/devstack
ACCEPTANCE_TESTS_FILTER: "^.*identity.*$"
PACKAGE: "./internal/acceptance/openstack/identity/..."
OS_BRANCH: ${{ matrix.openstack_version }}
- name: Generate logs on failure
run: ./script/collectlogs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/functional-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
run: ./script/acceptancetest
env:
DEVSTACK_PATH: ${{ github.workspace }}/devstack
ACCEPTANCE_TESTS_FILTER: "^.*image.*$"
PACKAGE: "./internal/acceptance/openstack/image/..."
OS_BRANCH: ${{ matrix.openstack_version }}
- name: Generate logs on failure
run: ./script/collectlogs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/functional-keymanager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
run: ./script/acceptancetest
env:
DEVSTACK_PATH: ${{ github.workspace }}/devstack
ACCEPTANCE_TESTS_FILTER: "^.*keymanager.*$"
PACKAGE: "./internal/acceptance/openstack/keymanager/..."
OS_BRANCH: ${{ matrix.openstack_version }}
- name: Generate logs on failure
run: ./script/collectlogs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/functional-loadbalancer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
run: ./script/acceptancetest
env:
DEVSTACK_PATH: ${{ github.workspace }}/devstack
ACCEPTANCE_TESTS_FILTER: "^.*loadbalancer.*$"
PACKAGE: "./internal/acceptance/openstack/loadbalancer/..."
OS_BRANCH: ${{ matrix.openstack_version }}
- name: Generate logs on failure
run: ./script/collectlogs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/functional-messaging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
run: ./script/acceptancetest
env:
DEVSTACK_PATH: ${{ github.workspace }}/devstack
ACCEPTANCE_TESTS_FILTER: "^.*messaging.*$"
PACKAGE: "./internal/acceptance/openstack/messaging/..."
OS_BRANCH: ${{ matrix.openstack_version }}
- name: Generate logs on failure
run: ./script/collectlogs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/functional-networking.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
run: ./script/acceptancetest
env:
DEVSTACK_PATH: ${{ github.workspace }}/devstack
ACCEPTANCE_TESTS_FILTER: "^(?!.*fwaas_v2.*).*networking.*$"
PACKAGE: "./internal/acceptance/openstack/networking/..."
OS_BRANCH: ${{ matrix.openstack_version }}
- name: Generate logs on failure
run: ./script/collectlogs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/functional-objectstorage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
run: ./script/acceptancetest
env:
DEVSTACK_PATH: ${{ github.workspace }}/devstack
ACCEPTANCE_TESTS_FILTER: '^.*objectstorage.*$'
PACKAGE: "./internal/acceptance/openstack/objectstorage/..."
OS_BRANCH: ${{ matrix.openstack_version }}
- name: Generate logs on failure
run: ./script/collectlogs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/functional-orchestration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
run: ./script/acceptancetest
env:
DEVSTACK_PATH: ${{ github.workspace }}/devstack
ACCEPTANCE_TESTS_FILTER: ^.*orchestration.*$
PACKAGE: "./internal/acceptance/openstack/orchestration/..."
OS_BRANCH: ${{ matrix.openstack_version }}
- name: Generate logs on failure
run: ./script/collectlogs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/functional-placement.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
run: ./script/acceptancetest
env:
DEVSTACK_PATH: ${{ github.workspace }}/devstack
ACCEPTANCE_TESTS_FILTER: ^.*placement.*$
PACKAGE: "./internal/acceptance/openstack/placement/..."
OS_BRANCH: ${{ matrix.openstack_version }}
- name: Generate logs on failure
run: ./script/collectlogs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/functional-sharedfilesystems.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
run: ./script/acceptancetest
env:
DEVSTACK_PATH: ${{ github.workspace }}/devstack
ACCEPTANCE_TESTS_FILTER: "^.*sharedfilesystems.*$"
PACKAGE: "./internal/acceptance/openstack/sharedfilesystems/..."
OS_BRANCH: ${{ matrix.openstack_version }}
- name: Generate logs on failure
run: ./script/collectlogs
Expand Down
27 changes: 1 addition & 26 deletions script/acceptancetest
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,4 @@ if [[ -z "${LOG_DIR}" ]]; then
fi
mkdir -p ${LOG_DIR}

if [[ -z "${ACCEPTANCE_TESTS_FILTER}" ]]; then
ACCEPTANCE_TESTS=$(find internal/acceptance/openstack -name '*_test.go' -exec dirname {} \; | sort -n | uniq)
else
ACCEPTANCE_TESTS=$(find internal/acceptance/openstack -name '*_test.go' -exec dirname {} \; | sort -n | uniq | grep -P "$ACCEPTANCE_TESTS_FILTER")
fi
ACCEPTANCE_TESTS=($ACCEPTANCE_TESTS)

if [[ -z $ACCEPTANCE_TESTS ]]; then
echo "No acceptance tests to run"
exit 0
fi

for acceptance_test in "${ACCEPTANCE_TESTS[@]}"; do
go test -v -timeout $timeout -tags "fixtures acceptance" ./${acceptance_test} |& tee -a ${LOG_DIR}/acceptance_tests.log
# Check the error code after each suite, but do not exit early if a suite failed.
if [[ $? != 0 ]]; then
failed=1
fi
done

# If any of the test suites failed, exit 1
if [[ -n $failed ]]; then
exit 1
fi

exit 0
go test -v -timeout $timeout -tags "fixtures acceptance" ${PACKAGE:-./internal/acceptance/openstack/...} $@ |& tee -a ${LOG_DIR}/acceptance_tests.log

0 comments on commit 65d6f84

Please sign in to comment.