[coverage] change worker, save json files in original path (#91683)

* [coverage] write data to original path

* [coverage] change worker size
This commit is contained in:
Dmitry 2021-02-17 19:45:06 +01:00 committed by GitHub
parent 88ac3bf541
commit 119199ef41
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 22 deletions

View file

@ -10,7 +10,7 @@ kibanaPipeline(timeoutMinutes: 300) {
"TIME_STAMP=${timestamp}",
'CODE_COVERAGE=1', // Enables coverage. Needed for multiple ci scripts, such as remote.ts, test/scripts/*.sh, schema.js, etc.
]) {
workers.base(name: 'coverage-worker', size: 'l', ramDisk: false, bootstrapped: false) {
workers.base(name: 'coverage-worker', size: 'xl', ramDisk: false, bootstrapped: false) {
catchError {
kibanaPipeline.bash("""

View file

@ -37,14 +37,21 @@ export async function RemoteProvider({ getService }: FtrProviderContext) {
};
const writeCoverage = (coverageJson: string) => {
if (!Fs.existsSync(coverageDir)) {
Fs.mkdirSync(coverageDir, { recursive: true });
// on CI we make hard link clone and run tests from kibana${process.env.CI_GROUP} root path
const re = new RegExp(`kibana${process.env.CI_GROUP}`, 'g');
const dir = process.env.CI ? coverageDir.replace(re, 'kibana') : coverageDir;
if (!Fs.existsSync(dir)) {
Fs.mkdirSync(dir, { recursive: true });
}
const id = coverageCounter++;
const timestamp = Date.now();
const path = resolve(coverageDir, `${id}.${timestamp}.coverage.json`);
const path = resolve(dir, `${id}.${timestamp}.coverage.json`);
log.info('writing coverage to', path);
Fs.writeFileSync(path, JSON.stringify(JSON.parse(coverageJson), null, 2));
const jsonString = process.env.CI ? coverageJson.replace(re, 'kibana') : coverageJson;
Fs.writeFileSync(path, JSON.stringify(JSON.parse(jsonString), null, 2));
};
const browserConfig: BrowserConfig = {

View file

@ -29,14 +29,6 @@ else
echo " -> running tests from the clone folder"
node scripts/functional_tests --debug --include-tag "ciGroup$CI_GROUP" --exclude-tag "skipCoverage" || true;
if [[ -d target/kibana-coverage/functional ]]; then
echo " -> replacing kibana${CI_GROUP} with kibana in json files"
sed -i "s|kibana${CI_GROUP}|kibana|g" target/kibana-coverage/functional/*.json
echo " -> copying coverage to the original folder"
mkdir -p ../kibana/target/kibana-coverage/functional
mv target/kibana-coverage/functional/* ../kibana/target/kibana-coverage/functional/
fi
echo " -> moving junit output, silently fail in case of no report"
mkdir -p ../kibana/target/junit
mv target/junit/* ../kibana/target/junit/ || echo "copying junit failed"

View file

@ -28,7 +28,7 @@ if [[ -z "$CODE_COVERAGE" ]] ; then
./test/scripts/checks/test_hardening.sh
else
echo " -> Running jest tests with coverage"
node scripts/jest --ci --verbose --maxWorkers=6 --coverage || true;
node scripts/jest --ci --verbose --maxWorkers=8 --coverage || true;
echo " -> Running jest integration tests with coverage"
node scripts/jest_integration --ci --verbose --coverage || true;

View file

@ -25,14 +25,6 @@ else
echo " -> running tests from the clone folder"
node scripts/functional_tests --debug --include-tag "ciGroup$CI_GROUP" --exclude-tag "skipCoverage" || true;
if [[ -d ../target/kibana-coverage/functional ]]; then
echo " -> replacing kibana${CI_GROUP} with kibana in json files"
sed -i "s|kibana${CI_GROUP}|kibana|g" ../target/kibana-coverage/functional/*.json
echo " -> copying coverage to the original folder"
mkdir -p ../../kibana/target/kibana-coverage/functional
mv ../target/kibana-coverage/functional/* ../../kibana/target/kibana-coverage/functional/
fi
echo " -> moving junit output, silently fail in case of no report"
mkdir -p ../../kibana/target/junit
mv ../target/junit/* ../../kibana/target/junit/ || echo "copying junit failed"