Skip to content

Commit 0021770

Browse files
committed
Refactor test workflows and update test configurations
- Removed redundant test environment file creation and integration test steps from the CI workflows. - Consolidated unit and integration tests into a single comprehensive test job, improving efficiency. - Updated the pytest configuration to reflect new test markers for database-dependent tests. - Introduced new integration tests for graph templates and health API, enhancing test coverage. - Adjusted coverage report uploads to streamline reporting and improve clarity.
1 parent e542b56 commit 0021770

10 files changed

Lines changed: 40 additions & 540 deletions

.github/workflows/publish-state-mangaer.yml

Lines changed: 3 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -51,49 +51,19 @@ jobs:
5151
run: |
5252
uv sync --group dev
5353
54-
- name: Create test environment file
55-
working-directory: state-manager
56-
run: |
57-
cat > .env.test << EOF
58-
# Test Environment Configuration
59-
ENVIRONMENT=testing
60-
61-
# MongoDB Configuration
62-
MONGO_URI=mongodb://admin:password@localhost:27017
63-
MONGO_DATABASE_NAME=test_exosphere_state_manager
64-
65-
# API Configuration
66-
STATE_MANAGER_SECRET=test-secret-key
67-
EOF
68-
6954
- name: Wait for MongoDB to be ready
7055
run: |
7156
echo "Waiting for MongoDB to be ready..."
7257
timeout 60 bash -c 'until mongosh --host localhost:27017 --username admin --password password --authenticationDatabase admin --eval "db.runCommand(\"ping\")" > /dev/null 2>&1; do sleep 2; done'
7358
echo "MongoDB is ready!"
7459
75-
- name: Run unit tests
76-
working-directory: state-manager
77-
run: |
78-
uv run pytest tests/unit/ --cov=app --cov-report=xml --cov-report=term-missing -v --junitxml=unit-pytest-report.xml
79-
80-
- name: Run integration tests
81-
working-directory: state-manager
82-
env:
83-
MONGO_URI: mongodb://admin:password@localhost:27017
84-
MONGO_DATABASE_NAME: test_exosphere_state_manager
85-
STATE_MANAGER_SECRET: test-secret-key
86-
ENVIRONMENT: testing
87-
run: |
88-
uv run pytest tests/integration/ --cov=app --cov-append --cov-report=xml --cov-report=term-missing -v --junitxml=integration-pytest-report.xml
89-
9060
- name: Run full test suite with coverage
9161
working-directory: state-manager
9262
env:
9363
MONGO_URI: mongodb://admin:password@localhost:27017
9464
MONGO_DATABASE_NAME: test_exosphere_state_manager
9565
STATE_MANAGER_SECRET: test-secret-key
96-
ENVIRONMENT: testing
66+
SECRETS_ENCRYPTION_KEY: YTzpUlBGLSwm-3yKJRJTZnb0_aQuQQHyz64s8qAERVU=
9767
run: |
9868
uv run pytest tests/ --cov=app --cov-report=xml --cov-report=term-missing --cov-report=html -v --junitxml=full-pytest-report.xml
9969
@@ -103,29 +73,10 @@ jobs:
10373
token: ${{ secrets.CODECOV_TOKEN }}
10474
slug: exospherehost/exospherehost
10575
files: state-manager/coverage.xml
106-
flags: state-manager-publish
107-
name: state-manager-publish-coverage-report
76+
flags: unit-tests
77+
name: state-manager-coverage-report
10878
fail_ci_if_error: true
10979

110-
- name: Upload test results
111-
uses: actions/upload-artifact@v4
112-
if: always()
113-
with:
114-
name: state-manager-publish-test-results
115-
path: |
116-
state-manager/unit-pytest-report.xml
117-
state-manager/integration-pytest-report.xml
118-
state-manager/full-pytest-report.xml
119-
retention-days: 30
120-
121-
- name: Upload coverage HTML report
122-
uses: actions/upload-artifact@v4
123-
if: always()
124-
with:
125-
name: state-manager-publish-coverage-html
126-
path: state-manager/htmlcov/
127-
retention-days: 30
128-
12980
publish-image:
13081
runs-on: ubuntu-latest
13182
needs: test

.github/workflows/release-state-manager.yml

Lines changed: 3 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -51,49 +51,19 @@ jobs:
5151
run: |
5252
uv sync --group dev
5353
54-
- name: Create test environment file
55-
working-directory: state-manager
56-
run: |
57-
cat > .env.test << EOF
58-
# Test Environment Configuration
59-
ENVIRONMENT=testing
60-
61-
# MongoDB Configuration
62-
MONGO_URI=mongodb://admin:password@localhost:27017
63-
MONGO_DATABASE_NAME=test_exosphere_state_manager
64-
65-
# API Configuration
66-
STATE_MANAGER_SECRET=test-secret-key
67-
EOF
68-
6954
- name: Wait for MongoDB to be ready
7055
run: |
7156
echo "Waiting for MongoDB to be ready..."
7257
timeout 60 bash -c 'until mongosh --host localhost:27017 --username admin --password password --authenticationDatabase admin --eval "db.runCommand(\"ping\")" > /dev/null 2>&1; do sleep 2; done'
7358
echo "MongoDB is ready!"
7459
75-
- name: Run unit tests
76-
working-directory: state-manager
77-
run: |
78-
uv run pytest tests/unit/ --cov=app --cov-report=xml --cov-report=term-missing -v --junitxml=unit-pytest-report.xml
79-
80-
- name: Run integration tests
81-
working-directory: state-manager
82-
env:
83-
MONGO_URI: mongodb://admin:password@localhost:27017
84-
MONGO_DATABASE_NAME: test_exosphere_state_manager
85-
STATE_MANAGER_SECRET: test-secret-key
86-
ENVIRONMENT: testing
87-
run: |
88-
uv run pytest tests/integration/ --cov=app --cov-append --cov-report=xml --cov-report=term-missing -v --junitxml=integration-pytest-report.xml
89-
9060
- name: Run full test suite with coverage
9161
working-directory: state-manager
9262
env:
9363
MONGO_URI: mongodb://admin:password@localhost:27017
9464
MONGO_DATABASE_NAME: test_exosphere_state_manager
9565
STATE_MANAGER_SECRET: test-secret-key
96-
ENVIRONMENT: testing
66+
SECRETS_ENCRYPTION_KEY: YTzpUlBGLSwm-3yKJRJTZnb0_aQuQQHyz64s8qAERVU=
9767
run: |
9868
uv run pytest tests/ --cov=app --cov-report=xml --cov-report=term-missing --cov-report=html -v --junitxml=full-pytest-report.xml
9969
@@ -103,29 +73,10 @@ jobs:
10373
token: ${{ secrets.CODECOV_TOKEN }}
10474
slug: exospherehost/exospherehost
10575
files: state-manager/coverage.xml
106-
flags: state-manager-release
107-
name: state-manager-release-coverage-report
76+
flags: unit-tests
77+
name: state-manager-coverage-report
10878
fail_ci_if_error: true
10979

110-
- name: Upload test results
111-
uses: actions/upload-artifact@v4
112-
if: always()
113-
with:
114-
name: state-manager-release-test-results
115-
path: |
116-
state-manager/unit-pytest-report.xml
117-
state-manager/integration-pytest-report.xml
118-
state-manager/full-pytest-report.xml
119-
retention-days: 30
120-
121-
- name: Upload coverage HTML report
122-
uses: actions/upload-artifact@v4
123-
if: always()
124-
with:
125-
name: state-manager-release-coverage-html
126-
path: state-manager/htmlcov/
127-
retention-days: 30
128-
12980
publish-image:
13081
runs-on: ubuntu-latest
13182
needs: test

0 commit comments

Comments
 (0)