From 22918b2099262673f4a07072fa3b9b5d710c3f24 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Wed, 18 Nov 2020 00:50:35 +0100 Subject: [PATCH 1/4] Let pytest report test run duration info --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ee6ac88ae..4933fa7ad 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -143,16 +143,16 @@ jobs: - name: Run main tests if: matrix.test == 'main' # running the "main" tests means "all tests that aren't auth" - run: pytest -m "not auth" -vx --cov binderhub + run: pytest -m "not auth" -vx --cov binderhub --durations=0 - name: Run auth tests if: matrix.test == 'auth' # running the "auth" tests means "all tests that are marked as auth" - run: pytest -m "auth" -vx --cov binderhub + run: pytest -m "auth" -vx --cov binderhub --durations=0 - name: Run helm tests if: matrix.test == 'helm' run: | export BINDER_URL=http://localhost:30901 - pytest -m "remote" -vx --cov binderhub + pytest -m "remote" -vx --cov binderhub --durations=0 - name: Kubernetes namespace report if: ${{ failure() }} run: | From 413247b39baf6849c120f384349ffe2f92bc85a9 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Wed, 18 Nov 2020 00:55:26 +0100 Subject: [PATCH 2/4] Test with a build optimized repo --- binderhub/tests/test_build.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/binderhub/tests/test_build.py b/binderhub/tests/test_build.py index 42a7ecd76..2e9039f6c 100644 --- a/binderhub/tests/test_build.py +++ b/binderhub/tests/test_build.py @@ -15,19 +15,29 @@ from .utils import async_requests +# We have optimized this slow test, for more information, see the README of +# https://github.com/binderhub-ci-repos/minimal-dockerfile. @pytest.mark.asyncio(timeout=900) @pytest.mark.parametrize("slug", [ - "gh/binderhub-ci-repos/requirements/d687a7f9e6946ab01ef2baa7bd6d5b73c6e904fd", - "git/{}/d687a7f9e6946ab01ef2baa7bd6d5b73c6e904fd".format( - quote("https://github.com/binderhub-ci-repos/requirements", safe='') + # git/ Git repo provider + "git/{}/HEAD".format( + quote("https://github.com/consideratio/cached-minimal-dockerfile", safe='') ), - "git/{}/master".format( - quote("https://github.com/binderhub-ci-repos/requirements", safe='') + "git/{}/596b52f10efb0c9befc0c4ae850cc5175297d71c".format( + quote("https://github.com/consideratio/cached-minimal-dockerfile", safe='') ), - "gl/minrk%2Fbinderhub-ci/0d4a217d40660efaa58761d8c6084e7cf5453cca", + # gh/ GitHub repo provider + "gh/consideratio/cached-minimal-dockerfile/HEAD", + "gh/consideratio/cached-minimal-dockerfile/596b52f10efb0c9befc0c4ae850cc5175297d71c", + # gl/ GitLab repo provider + "gl/binderhub-ci-repos%2Fcached-minimal-dockerfile/HEAD", + "gl/binderhub-ci-repos%2Fcached-minimal-dockerfile/596b52f10efb0c9befc0c4ae850cc5175297d71c", ]) @pytest.mark.remote async def test_build(app, needs_build, needs_launch, always_build, slug, pytestconfig): + """ + Test build a repo that is very quick and easy to build. + """ # can't use mark.github_api since only some tests here use GitHub if slug.startswith('gh/') and "not github_api" in pytestconfig.getoption('markexpr'): pytest.skip("Skipping GitHub API test") From 772e0f02d6aeeac949186fb0370be8270de83e67 Mon Sep 17 00:00:00 2001 From: Tim Head Date: Thu, 3 Dec 2020 09:14:19 +0100 Subject: [PATCH 3/4] Show runtime for ten slowest tests --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4933fa7ad..1b81234b4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -143,16 +143,16 @@ jobs: - name: Run main tests if: matrix.test == 'main' # running the "main" tests means "all tests that aren't auth" - run: pytest -m "not auth" -vx --cov binderhub --durations=0 + run: pytest -m "not auth" -vx --cov binderhub --durations=10 - name: Run auth tests if: matrix.test == 'auth' # running the "auth" tests means "all tests that are marked as auth" - run: pytest -m "auth" -vx --cov binderhub --durations=0 + run: pytest -m "auth" -vx --cov binderhub --durations=10 - name: Run helm tests if: matrix.test == 'helm' run: | export BINDER_URL=http://localhost:30901 - pytest -m "remote" -vx --cov binderhub --durations=0 + pytest -m "remote" -vx --cov binderhub --durations=10 - name: Kubernetes namespace report if: ${{ failure() }} run: | From 189a70e4dffc9d2d6be452f78ed49dedd431b73b Mon Sep 17 00:00:00 2001 From: Tim Head Date: Thu, 3 Dec 2020 09:15:34 +0100 Subject: [PATCH 4/4] Switch to using repos from the binderhub-ci-repos organisation --- binderhub/tests/test_build.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/binderhub/tests/test_build.py b/binderhub/tests/test_build.py index 2e9039f6c..f3229026e 100644 --- a/binderhub/tests/test_build.py +++ b/binderhub/tests/test_build.py @@ -24,11 +24,11 @@ quote("https://github.com/consideratio/cached-minimal-dockerfile", safe='') ), "git/{}/596b52f10efb0c9befc0c4ae850cc5175297d71c".format( - quote("https://github.com/consideratio/cached-minimal-dockerfile", safe='') + quote("https://github.com/binderhub-ci-repos/cached-minimal-dockerfile", safe='') ), # gh/ GitHub repo provider - "gh/consideratio/cached-minimal-dockerfile/HEAD", - "gh/consideratio/cached-minimal-dockerfile/596b52f10efb0c9befc0c4ae850cc5175297d71c", + "gh/binderhub-ci-repos/cached-minimal-dockerfile/HEAD", + "gh/binderhub-ci-repos/cached-minimal-dockerfile/596b52f10efb0c9befc0c4ae850cc5175297d71c", # gl/ GitLab repo provider "gl/binderhub-ci-repos%2Fcached-minimal-dockerfile/HEAD", "gl/binderhub-ci-repos%2Fcached-minimal-dockerfile/596b52f10efb0c9befc0c4ae850cc5175297d71c",