From 6f8d21620bb50755a1d86b256e0cf0e5052ca426 Mon Sep 17 00:00:00 2001 From: Jens L Date: Tue, 21 Nov 2023 23:50:43 +0100 Subject: [PATCH] tests: fix flaky tests (#7676) * tests: fix flaky tests Signed-off-by: Jens Langhammer * make test-from-stable use actual latest version Signed-off-by: Jens Langhammer * fix checkout Signed-off-by: Jens Langhammer * remove hardcoded seed Signed-off-by: Jens Langhammer * ignore tests for now i guess idk Signed-off-by: Jens Langhammer --------- Signed-off-by: Jens Langhammer --- .github/workflows/ci-main.yml | 4 ++-- pyproject.toml | 2 +- tests/e2e/test_provider_oauth2_github.py | 4 ++-- tests/e2e/test_provider_oauth2_grafana.py | 4 ++-- tests/e2e/test_source_oauth.py | 4 ++-- tests/e2e/test_source_saml.py | 4 ++-- tests/integration/test_outpost_docker.py | 4 ++-- tests/integration/test_proxy_docker.py | 4 ++-- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci-main.yml b/.github/workflows/ci-main.yml index 2eebe378f..9fa00800b 100644 --- a/.github/workflows/ci-main.yml +++ b/.github/workflows/ci-main.yml @@ -62,7 +62,7 @@ jobs: cp authentik/lib/default.yml local.env.yml cp -R .github .. cp -R scripts .. - git checkout $(git describe --tags $(git rev-list --tags --max-count=1)) + git checkout version/$(python -c "from authentik import __version__; print(__version__)") rm -rf .github/ scripts/ mv ../.github ../scripts . - name: Setup authentik env (ensure stable deps are installed) @@ -117,7 +117,7 @@ jobs: uses: helm/kind-action@v1.8.0 - name: run integration run: | - poetry run coverage run manage.py test --randomly-seed=2100196988 tests/integration + poetry run coverage run manage.py test tests/integration poetry run coverage xml - if: ${{ always() }} uses: codecov/codecov-action@v3 diff --git a/pyproject.toml b/pyproject.toml index da0423827..ff8230e70 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -97,7 +97,7 @@ const-rgx = "[a-zA-Z0-9_]{1,40}$" ignored-modules = ["binascii", "socket", "zlib"] generated-members = ["xmlsec.constants.*", "xmlsec.tree.*", "xmlsec.template.*"] -ignore = "migrations" +ignore = ["migrations", "tests"] max-attributes = 12 max-branches = 20 diff --git a/tests/e2e/test_provider_oauth2_github.py b/tests/e2e/test_provider_oauth2_github.py index 49f640093..7df12137b 100644 --- a/tests/e2e/test_provider_oauth2_github.py +++ b/tests/e2e/test_provider_oauth2_github.py @@ -36,8 +36,8 @@ class TestProviderOAuth2Github(SeleniumTestCase): "auto_remove": True, "healthcheck": Healthcheck( test=["CMD", "wget", "--spider", "http://localhost:3000"], - interval=5 * 100 * 1000000, - start_period=1 * 100 * 1000000, + interval=5 * 1_000 * 1_000_000, + start_period=1 * 1_000 * 1_000_000, ), "environment": { "GF_AUTH_GITHUB_ENABLED": "true", diff --git a/tests/e2e/test_provider_oauth2_grafana.py b/tests/e2e/test_provider_oauth2_grafana.py index d096a3483..fdb75e1b9 100644 --- a/tests/e2e/test_provider_oauth2_grafana.py +++ b/tests/e2e/test_provider_oauth2_grafana.py @@ -42,8 +42,8 @@ class TestProviderOAuth2OAuth(SeleniumTestCase): "auto_remove": True, "healthcheck": Healthcheck( test=["CMD", "wget", "--spider", "http://localhost:3000"], - interval=5 * 100 * 1000000, - start_period=1 * 100 * 1000000, + interval=5 * 1_000 * 1_000_000, + start_period=1 * 1_000 * 1_000_000, ), "environment": { "GF_AUTH_GENERIC_OAUTH_ENABLED": "true", diff --git a/tests/e2e/test_source_oauth.py b/tests/e2e/test_source_oauth.py index 40f7e1ce7..c7f0fd881 100644 --- a/tests/e2e/test_source_oauth.py +++ b/tests/e2e/test_source_oauth.py @@ -113,8 +113,8 @@ class TestSourceOAuth2(SeleniumTestCase): "command": "dex serve /config.yml", "healthcheck": Healthcheck( test=["CMD", "wget", "--spider", "http://localhost:5556/dex/healthz"], - interval=5 * 100 * 1000000, - start_period=1 * 100 * 1000000, + interval=5 * 1_000 * 1_000_000, + start_period=1 * 1_000 * 1_000_000, ), "volumes": {str(Path(CONFIG_PATH).absolute()): {"bind": "/config.yml", "mode": "ro"}}, } diff --git a/tests/e2e/test_source_saml.py b/tests/e2e/test_source_saml.py index 2d5a7efa9..0921335b7 100644 --- a/tests/e2e/test_source_saml.py +++ b/tests/e2e/test_source_saml.py @@ -83,8 +83,8 @@ class TestSourceSAML(SeleniumTestCase): "auto_remove": True, "healthcheck": Healthcheck( test=["CMD", "curl", "http://localhost:8080"], - interval=5 * 100 * 1000000, - start_period=1 * 100 * 1000000, + interval=5 * 1_000 * 1_000_000, + start_period=1 * 1_000 * 1_000_000, ), "environment": { "SIMPLESAMLPHP_SP_ENTITY_ID": "entity-id", diff --git a/tests/integration/test_outpost_docker.py b/tests/integration/test_outpost_docker.py index 19b00b333..99daf1915 100644 --- a/tests/integration/test_outpost_docker.py +++ b/tests/integration/test_outpost_docker.py @@ -35,8 +35,8 @@ class OutpostDockerTests(DockerTestCase, ChannelsLiveServerTestCase): privileged=True, healthcheck=Healthcheck( test=["CMD", "docker", "info"], - interval=5 * 100 * 1000000, - start_period=5 * 100 * 1000000, + interval=5 * 1_000 * 1_000_000, + start_period=5 * 1_000 * 1_000_000, ), environment={"DOCKER_TLS_CERTDIR": "/ssl"}, volumes={ diff --git a/tests/integration/test_proxy_docker.py b/tests/integration/test_proxy_docker.py index 7b4e11ba8..7ba027cdd 100644 --- a/tests/integration/test_proxy_docker.py +++ b/tests/integration/test_proxy_docker.py @@ -35,8 +35,8 @@ class TestProxyDocker(DockerTestCase, ChannelsLiveServerTestCase): privileged=True, healthcheck=Healthcheck( test=["CMD", "docker", "info"], - interval=5 * 100 * 1000000, - start_period=5 * 100 * 1000000, + interval=5 * 1_000 * 1_000_000, + start_period=5 * 1_000 * 1_000_000, ), environment={"DOCKER_TLS_CERTDIR": "/ssl"}, volumes={