diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 93eea81c3f..8ea713372b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -123,8 +123,14 @@ jobs: echo Skipping unstable tests echo "mark_expression=and not unstable" >> "$GITHUB_OUTPUT" fi + - name: Select test secret usage + id: select-test-secrets + if: ${{ github.event.pull_request.head.repo.full_name != 'canonical/postgresql-operator' }} + run: | + echo Skipping tests using secrets + echo "mark_secrets=and not uses_secrets" >> "$GITHUB_OUTPUT" - name: Run integration tests - run: tox run -e ${{ matrix.tox-environment }} -- -m 'not ${{ matrix.exclude-mark }} ${{ steps.select-test-stability.outputs.mark_expression }}' --keep-models + run: tox run -e ${{ matrix.tox-environment }} -- -m 'not ${{ matrix.exclude-mark }} ${{ steps.select-test-secrets.outputs.mark_secrets }} ${{ steps.select-test-stability.outputs.mark_expression }}' --keep-models env: SECRETS_FROM_GITHUB: | { diff --git a/tests/integration/test_backups.py b/tests/integration/test_backups.py index 07ee7a218a..e028b481dd 100644 --- a/tests/integration/test_backups.py +++ b/tests/integration/test_backups.py @@ -79,6 +79,12 @@ async def cloud_configs(ops_test: OpsTest, github_secrets) -> None: bucket_object.delete() +async def test_none() -> None: + """Empty test so that the suite will not fail if all tests are skippedi.""" + pass + + +@pytest.mark.uses_secrets @pytest.mark.abort_on_fail async def test_backup(ops_test: OpsTest, cloud_configs: Tuple[Dict, Dict]) -> None: """Build and deploy two units of PostgreSQL and then test the backup and restore actions.""" @@ -216,6 +222,7 @@ async def test_backup(ops_test: OpsTest, cloud_configs: Tuple[Dict, Dict]) -> No await ops_test.model.remove_application(TLS_CERTIFICATES_APP_NAME, block_until_done=True) +@pytest.mark.uses_secrets async def test_restore_on_new_cluster(ops_test: OpsTest) -> None: """Test that is possible to restore a backup to another PostgreSQL cluster.""" charm = await ops_test.build_charm(".") @@ -293,6 +300,7 @@ async def test_restore_on_new_cluster(ops_test: OpsTest) -> None: connection.close() +@pytest.mark.uses_secrets async def test_invalid_config_and_recovery_after_fixing_it( ops_test: OpsTest, cloud_configs: Tuple[Dict, Dict] ) -> None: