pulumi/scripts/run-testsuite.py
Anton Tayanovskyy 3aa97a4b7d
Fanout build experiment (#7628)
* Experiment with gotestsum and test timings

* Fix to locating the helper script

* Fix the code for installing gotestsum

* Try alternative installation method

* Use go to compute test stats; Python fails parsing time values

* Try version without v

* Try with fixed gorelaser config

* Fix test time correlation

* Try a stable test stat sort finally

* Use more accurate test duration aggregation

* Include python and auto-api tests in the Go timing counts

* Bring back TESTPARALLELISM

* Fix test compilation

* Only top 100 slow tests

* Try to fracture build matrix to fan out tests

* Do not run Publish Test Results on unsuppored Mac

* Auto-create test-results-dir

* Fix new flaky test by polling for logs

* Try to move native tests to their own config

* Actually skip

* Do not fail on empty test-results folder

* Try again

* Try once more

* Integration test config is the crit path - make it smaller

* Squash underutilized test configurations

* Remove the test result summary box from PR - counts now incorrec

* Remove debugging step
2021-07-27 10:07:15 -04:00

46 lines
992 B
Python

"""
Wraps test suite invocation shell commands to measure time and
provide awareness of test configurations set by PULUMI_TEST_SUBSET.
"""
from test_subsets import TEST_SUBSETS
import os
import subprocess as sp
import sys
import timeit
testsuite_name = sys.argv[1]
testsuite_command = sys.argv[2:]
test_subset = os.environ.get('PULUMI_TEST_SUBSET', None)
def should_run():
if test_subset is None:
return True
if test_subset == 'etc':
s = set([])
for k in TEST_SUBSETS:
s = s | set(TEST_SUBSETS[k])
return testsuite_name not in s
s = set(TEST_SUBSETS[test_subset])
return testsuite_name in s
if not should_run():
print(f'TESTSUITE {testsuite_name} skipped according to PULUMI_TEST_SUBSET={test_subset}')
sys.exit(0)
t0 = timeit.timeit()
try:
sp.check_call(testsuite_command, shell=False)
finally:
t1 = timeit.timeit()
elapsed = t1 - t0
print(f'TESTSUITE {testsuite_name} completed in {elapsed}')