Skip to content

Commit

Permalink
Removes stable tests from quarantine (#10768)
Browse files Browse the repository at this point in the history
We've observed the tests for last couple of weeks and it seems
most of the tests marked with "quarantine" marker are succeeding
in a stable way (#10118)
The removed tests have success ratio of > 95% (20 runs without
problems) and this has been verified a week ago as well,
so it seems they are rather stable.

There are literally few that are either failing or causing
the Quarantined builds to hang. I manually reviewed the
master tests that failed for last few weeks and added the
tests that are causing the build to hang.

Seems that stability has improved - which might be casued
by some temporary problems when we marked the quarantined builds
or too "generous" way of marking test as quarantined, or
maybe improvement comes from the #10368 as the docker engine
and machines used to run the builds in GitHub experience far
less load (image builds are executed in separate builds) so
it might be that resource usage is decreased. Another reason
might be Github Actions stability improvements.

Or simply those tests are more stable when run isolation.

We might still add failing tests back as soon we see them behave
in a flaky way.

The remaining quarantined tests that need to be fixed:
 * test_local_run (often hangs the build)
 * test_retry_handling_job
 * test_clear_multiple_external_task_marker
 * test_should_force_kill_process
 * test_change_state_for_tis_without_dagrun
 * test_cli_webserver_background

We also move some of those tests to "heisentests" category
Those testst run fine in isolation but fail
the builds when run with all other tests:
 * TestImpersonation tests

We might find that those heisentest can be fixed but for
now we are going to run them in isolation.

Also - since those quarantined tests are failing more often
the "num runs" to track for those has been decreased to 10
to keep track of 10 last runs only.

(cherry picked from commit b746f33)
  • Loading branch information
potiuk authored and kaxil committed Nov 18, 2020
1 parent e2ec58c commit 0c5a73e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
12 changes: 12 additions & 0 deletions TESTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,18 @@ Those tests are marked with ``@pytest.mark.quarantined`` annotation.
Those tests are skipped by default. You can enable them with ``--include-quarantined`` flag. You
can also decide to only run tests with ``-m quarantined`` flag to run only those tests.

Heisen tests
------------

Some of our tests are Heisentests. This means that they run fine in isolation but when they run together with
others they might fail the tests (this is likely due to resource consumptions). Therefore we run those tests
in isolation.

Those tests are marked with ``@pytest.mark.heisentests`` annotation.
Those tests are skipped by default. You can enable them with ``--include-heisentests`` flag. You
can also decide to only run tests with ``-m heisentests`` flag to run only those tests.


Running Tests with Kubernetes
=============================

Expand Down
23 changes: 20 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
Expand Down Expand Up @@ -98,6 +97,11 @@ def pytest_addoption(parser):
action="store_true",
help="Includes quarantined tests (marked with quarantined marker). They are skipped by default.",
)
group.addoption(
"--include-heisentests",
action="store_true",
help="Includes heisentests (marked with heisentests marker). They are skipped by default.",
)


def initial_db_init():
Expand Down Expand Up @@ -171,11 +175,14 @@ def pytest_configure(config):
"markers", "system(name): mark test to run with named system"
)
config.addinivalue_line(
"markers", "long_running(name): mark test that run for a long time (many minutes)"
"markers", "long_running: mark test that run for a long time (many minutes)"
)
config.addinivalue_line(
"markers", "quarantined: mark test that are in quarantine (i.e. flaky, need to be isolated and fixed)"
)
config.addinivalue_line(
"markers", "heisentests: mark test that should be run in isolation due to resource consumption"
)
config.addinivalue_line(
"markers", "credential_file(name): mark tests that require credential file in CREDENTIALS_DIR"
)
Expand Down Expand Up @@ -217,7 +224,7 @@ def skip_if_not_marked_with_system(selected_systems, item):
def skip_system_test(item):
for marker in item.iter_markers(name="system"):
pytest.skip("The test is skipped because it has system marker. "
"System tests are only run when --systems flag "
"System tests are only run when --system flag "
"with the right system ({system}) is passed to pytest. {item}".
format(system=marker.args[0], item=item))

Expand All @@ -236,6 +243,13 @@ def skip_quarantined_test(item):
format(item=item))


def skip_heisen_test(item):
for _ in item.iter_markers(name="heisentests"):
pytest.skip("The test is skipped because it has heisentests marker. "
"And --include-heisentests flag is passed to pytest. {item}".
format(item=item))


def skip_if_integration_disabled(marker, item):
integration_name = marker.args[0]
environment_variable_name = "INTEGRATION_" + integration_name.upper()
Expand Down Expand Up @@ -277,6 +291,7 @@ def pytest_runtest_setup(item):

include_long_running = item.config.getoption("--include-long-running")
include_quarantined = item.config.getoption("--include-quarantined")
include_heisentests = item.config.getoption("--include-heisentests")

for marker in item.iter_markers(name="integration"):
skip_if_integration_disabled(marker, item)
Expand All @@ -295,4 +310,6 @@ def pytest_runtest_setup(item):
skip_long_running_test(item)
if not include_quarantined:
skip_quarantined_test(item)
if not include_heisentests:
skip_heisen_test(item)
skip_if_credential_file_missing(item)
2 changes: 1 addition & 1 deletion tests/core/test_impersonation_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def create_user():
)


@pytest.mark.quarantined
@pytest.mark.heisentests
class TestImpersonation(unittest.TestCase):

def setUp(self):
Expand Down

0 comments on commit 0c5a73e

Please sign in to comment.