mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-01-11 15:39:33 -05:00
Invoke tests through ctest (#230)
Currently we define how tests should be executed in two places: CMakeLists.txt and the CI related files. With this commit the CI will invoke tests by calling ctest, thus making it necessary to add and define testcases in cmake first. As all tests starting with "integration-" or "unit-" are run, new tests don't have to added to the CI, unless you want to define a new category of test. Also remove the etcd store test workflow as it's part of test-integration now. Co-authored-by: Fabian Kammel <fk@edgelss.systems>
This commit is contained in:
parent
5d293e355d
commit
6949678ead
21
.github/workflows/test-integration.yml
vendored
21
.github/workflows/test-integration.yml
vendored
@ -17,6 +17,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GOPRIVATE: github.com/edgelesssys/*
|
||||
CTEST_OUTPUT_ON_FAILURE: True
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup Go environment
|
||||
@ -25,22 +26,14 @@ jobs:
|
||||
go-version: "1.18"
|
||||
|
||||
- name: Install Dependencies
|
||||
run: sudo apt-get update && sudo apt-get install -y pkg-config libcryptsetup12 libcryptsetup-dev
|
||||
run: sudo apt-get update && sudo apt-get install -y pkg-config libcryptsetup12 libcryptsetup-dev cmake
|
||||
|
||||
- name: Integration Test Coordinator
|
||||
run: go test -v -tags integration ./test/
|
||||
- name: Create and populate build folder
|
||||
run: mkdir build && cd build && cmake ..
|
||||
|
||||
- name: Integration Test mount
|
||||
run: |
|
||||
go test -tags integration -c ./test/
|
||||
sudo ./test.test -test.v -v 9
|
||||
working-directory: mount
|
||||
|
||||
- name: Integration Test disk-mapper
|
||||
run: |
|
||||
go test -tags integration -c ./test/
|
||||
sudo ./test.test -test.v
|
||||
working-directory: state
|
||||
# Runs all test targets starting with "integration-"
|
||||
- name: Integration Tests
|
||||
run: ctest -R integration-
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: failure()
|
||||
|
14
.github/workflows/test-unittest.yml
vendored
14
.github/workflows/test-unittest.yml
vendored
@ -17,6 +17,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GOPRIVATE: github.com/edgelesssys/*
|
||||
CTEST_OUTPUT_ON_FAILURE: True
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
@ -26,11 +27,12 @@ jobs:
|
||||
go-version: 1.18
|
||||
|
||||
- name: Install Dependencies
|
||||
run: sudo apt-get update && sudo apt-get install -y pkg-config libcryptsetup12 libcryptsetup-dev libvirt-dev
|
||||
run: sudo apt-get update && sudo apt-get install -y pkg-config libcryptsetup12 libcryptsetup-dev cmake libvirt-dev
|
||||
|
||||
- name: Test main module
|
||||
run: go test -race -count=3 ./...
|
||||
- name: Create and populate build folder
|
||||
run: mkdir build && cd build && cmake ..
|
||||
|
||||
- name: Test hack module
|
||||
run: go test -race -count=3 ./...
|
||||
working-directory: hack
|
||||
# Runs all test targets starting with "unit-"
|
||||
- name: Unit Tests
|
||||
run: ctest -R unit-
|
||||
working-directory: build
|
||||
|
@ -63,7 +63,9 @@ add_custom_target(cdbg ALL
|
||||
BYPRODUCTS cdbg
|
||||
)
|
||||
|
||||
add_test(NAME unittest COMMAND go test -race -count=3 ./... WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||
add_test(NAME unittest-hack COMMAND go test -race -count=3 ./... WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/hack)
|
||||
add_test(NAME integrationtest COMMAND go test -v -tags integration ./test/ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||
add_test(NAME etcd-unittest COMMAND go test -v --race -cover -count=3 -tags integration WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/coordinator/store/)
|
||||
add_test(NAME unit-main COMMAND go test -race -count=3 ./... WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||
add_test(NAME unit-hack COMMAND go test -race -count=3 ./... WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/hack)
|
||||
add_test(NAME integration-coord COMMAND go test -v -tags integration ./test/ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||
add_test(NAME integration-mount COMMAND bash -c "go test -tags integration -c ./test/ && sudo ./test.test -test.v -v 9" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/mount)
|
||||
add_test(NAME integration-dm COMMAND bash -c "go test -tags integration -c ./test/ && sudo ./test.test -test.v" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/state)
|
||||
add_test(NAME integration-etcd COMMAND go test -v --race -cover -count=3 -tags integration WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/coordinator/store/)
|
||||
|
@ -55,6 +55,14 @@ cmake ..
|
||||
make -j`nproc`
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
You can run all integration and unitttests like this:
|
||||
|
||||
```sh
|
||||
ctest -j `nproc`
|
||||
```
|
||||
|
||||
## Cloud credentials
|
||||
|
||||
Using the CLI requires the user to make authorized API calls to the CSP API. See the [docs](https://constellation-docs.edgeless.systems/6c320851-bdd2-41d5-bf10-e27427398692/#/getting-started/install?id=cloud-credentials) for configuration.
|
||||
|
Loading…
Reference in New Issue
Block a user