3aa97a4b7d
* 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
63 lines
1.6 KiB
Python
63 lines
1.6 KiB
Python
"""
|
|
Wraps `go test`.
|
|
"""
|
|
|
|
from test_subsets import TEST_SUBSETS
|
|
import os
|
|
import pathlib
|
|
import shutil
|
|
import subprocess as sp
|
|
import sys
|
|
import uuid
|
|
|
|
|
|
def options(options_and_packages):
|
|
return [o for o in options_and_packages if '/' not in o]
|
|
|
|
|
|
def packages(options_and_packages):
|
|
return [o for o in options_and_packages if '/' in o]
|
|
|
|
|
|
def filter_packages(packages, test_subset=None):
|
|
if test_subset is None:
|
|
return packages
|
|
|
|
if test_subset == 'etc':
|
|
s = set([])
|
|
for k in TEST_SUBSETS:
|
|
s = s | set(TEST_SUBSETS[k])
|
|
return [p for p in packages if p not in s]
|
|
|
|
s = set(TEST_SUBSETS[test_subset])
|
|
return [p for p in packages if p in s]
|
|
|
|
|
|
root = pathlib.Path(__file__).absolute().parent.parent
|
|
test_subset = os.environ.get('PULUMI_TEST_SUBSET', None)
|
|
options_and_packages = sys.argv[1:]
|
|
packages = filter_packages(packages(options_and_packages), test_subset=test_subset)
|
|
|
|
|
|
if not packages:
|
|
print(f'No packages matching PULUMI_TEST_SUBSET={test_subset}')
|
|
sys.exit(0)
|
|
|
|
|
|
options_and_packages = options(options_and_packages) + packages
|
|
|
|
|
|
if shutil.which('gotestsum') is not None:
|
|
test_run = str(uuid.uuid4())
|
|
|
|
test_results_dir = root.joinpath('test-results')
|
|
if not test_results_dir.is_dir():
|
|
os.mkdir(str(test_results_dir))
|
|
|
|
json_file = str(test_results_dir.joinpath(f'{test_run}.json'))
|
|
junit_file = str(test_results_dir.joinpath(f'{test_run}.xml'))
|
|
sp.check_call(['gotestsum', '--jsonfile', json_file, '--junitfile', junit_file, '--'] + \
|
|
options_and_packages, shell=False)
|
|
else:
|
|
sp.check_call(['go', 'test'] + options_and_packages, shell=False)
|