[7.x] Split CI into Jenkins and GitHub Actions

This commit is contained in:
Seth Michael Larson
2020-05-27 16:42:40 -05:00
committed by GitHub
parent 1773bd17be
commit 1bfb1113d3
5 changed files with 66 additions and 20 deletions
+27 -4
View File
@@ -63,8 +63,9 @@ def fetch_es_repo():
def run_all(argv=None):
sys.exitfunc = lambda: sys.stderr.write("Shutting down....\n")
# fetch yaml tests
fetch_es_repo()
# fetch yaml tests anywhere that's not GitHub Actions
if "GITHUB_ACTION" not in environ:
fetch_es_repo()
# always insert coverage when running tests
if argv is None:
@@ -80,10 +81,32 @@ def run_all(argv=None):
"-vv",
]
ignores = []
# Python 3.6+ is required for async
if sys.version_info < (3, 6):
argv.append("--ignore=test_elasticsearch/test_async/")
ignores.append("test_elasticsearch/test_async/")
argv.append(abspath(dirname(__file__)),)
# GitHub Actions, run non-server tests
if "GITHUB_ACTION" in environ:
ignores.extend(
[
"test_elasticsearch/test_server/",
"test_elasticsearch/test_async/test_server/",
]
)
if ignores:
argv.extend(["--ignore=%s" % ignore for ignore in ignores])
# Jenkins, only run server tests
if environ.get("TEST_TYPE") == "server":
test_dir = abspath(dirname(__file__))
argv.append(join(test_dir, "test_server"))
if sys.version_info >= (3, 6):
argv.append(join(test_dir, "test_async/test_server"))
# Not in CI, run all tests specified.
else:
argv.append(abspath(dirname(__file__)))
exit_code = 0
try:
@@ -200,11 +200,11 @@ def async_runner(async_client):
return AsyncYamlRunner(async_client)
@pytest.mark.parametrize("test_spec", YAML_TEST_SPECS)
async def test_rest_api_spec(test_spec, async_runner):
if not RUN_ASYNC_REST_API_TESTS:
pytest.skip("Skipped running async REST API tests")
if test_spec.get("skip", False):
pytest.skip("Manually skipped in 'SKIP_TESTS'")
async_runner.use_spec(test_spec)
await async_runner.run()
if RUN_ASYNC_REST_API_TESTS:
@pytest.mark.parametrize("test_spec", YAML_TEST_SPECS)
async def test_rest_api_spec(test_spec, async_runner):
if test_spec.get("skip", False):
pytest.skip("Manually skipped in 'SKIP_TESTS'")
async_runner.use_spec(test_spec)
await async_runner.run()
@@ -424,11 +424,11 @@ def sync_runner(sync_client):
return YamlRunner(sync_client)
@pytest.mark.parametrize("test_spec", YAML_TEST_SPECS)
def test_rest_api_spec(test_spec, sync_runner):
if RUN_ASYNC_REST_API_TESTS:
pytest.skip("Skipped running sync REST API tests")
if test_spec.get("skip", False):
pytest.skip("Manually skipped in 'SKIP_TESTS'")
sync_runner.use_spec(test_spec)
sync_runner.run()
if not RUN_ASYNC_REST_API_TESTS:
@pytest.mark.parametrize("test_spec", YAML_TEST_SPECS)
def test_rest_api_spec(test_spec, sync_runner):
if test_spec.get("skip", False):
pytest.skip("Manually skipped in 'SKIP_TESTS'")
sync_runner.use_spec(test_spec)
sync_runner.run()