Skip to content

Commit 3b60c56

Browse files
committed
Revert "REVERT ME: Add some extra logging to help diagnose github actions failure (patched in from #7088)"
The tests all passed with this patch. It would seem that running tests in parallel is problematic. Try to revert this commit and see if we get lucky. This reverts commit b224a4f.
1 parent b224a4f commit 3b60c56

File tree

5 files changed

+12
-229
lines changed

5 files changed

+12
-229
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
"repl": "node tools/repl.js",
3131
"release": "ts-node-script scripts/release/cli.ts",
3232
"pretest": "node tools/pretest.js",
33-
"test": "lerna run --ignore firebase-messaging-integration-test --stream test",
34-
"test:ci": "lerna run --ignore firebase-messaging-integration-test test:ci",
33+
"test": "lerna run --ignore firebase-messaging-integration-test --concurrency 4 --stream test",
34+
"test:ci": "lerna run --ignore firebase-messaging-integration-test --concurrency 4 test:ci",
3535
"pretest:coverage": "mkdirp coverage",
3636
"ci:coverage": "lcov-result-merger 'packages/**/lcov.info' 'lcov-all.info'",
3737
"test:coverage": "lcov-result-merger 'packages/**/lcov.info' | coveralls",

packages/firestore/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
"test:lite:browser:debug": "karma start --browsers=Chrome --lite --auto-watch",
2828
"test": "run-s lint test:all",
2929
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test:all:ci",
30-
"test:all:ci": "run-s test:browser test:lite:browser test:travis",
31-
"test:all": "run-s test:browser test:lite:browser test:travis test:minified",
30+
"test:all:ci": "run-p test:browser test:lite:browser test:travis",
31+
"test:all": "run-p test:browser test:lite:browser test:travis test:minified",
3232
"test:browser": "karma start --single-run",
3333
"test:browser:emulator:debug": "karma start --browsers=Chrome --targetBackend=emulator",
3434
"test:browser:emulator": "karma start --single-run --targetBackend=emulator",

packages/firestore/scripts/run-tests.ts

Lines changed: 3 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -20,70 +20,6 @@ import { resolve } from 'path';
2020
import { spawn } from 'child-process-promise';
2121
import * as yargs from 'yargs';
2222

23-
24-
/**
25-
* Creates and returns a "timestamp" string for the elapsed time.
26-
*
27-
* The given timestamp is taken as an offset from the first time that this
28-
* function is invoked. This allows log messages to start at "time 0" and make
29-
* it easy for humans to calculate the elapsed time.
30-
*
31-
* @returns The timestamp string with which to prefix log lines, created from
32-
* the elapsed time since this function's first invocation.
33-
*/
34-
function elapsedTimeStr(): string {
35-
const milliseconds = getElapsedMilliseconds();
36-
const minutes = Math.floor(milliseconds / (1000 * 60));
37-
const seconds = (milliseconds - minutes * 1000 * 60) / 1000;
38-
return (
39-
(minutes < 10 ? '0' : '') +
40-
minutes +
41-
':' +
42-
(seconds < 10 ? '0' : '') +
43-
seconds.toFixed(3)
44-
);
45-
}
46-
47-
/**
48-
* The "start time", which is set to a non-null value upon the first invocation
49-
* of `getElapsedMilliseconds()`. All subsequent invocations calculate the
50-
* elapsed time using this value.
51-
*/
52-
let elapsedMillisecondsStartTime: number | null = null;
53-
54-
/**
55-
* Returns the number of nanoseconds that have elapsed since this function's
56-
* first invocation. Returns 0 on its first invocation.
57-
*/
58-
function getElapsedMilliseconds(): number {
59-
const currentTimeMilliseconds = getCurrentMonotonicTimeMilliseconds();
60-
if (elapsedMillisecondsStartTime === null) {
61-
elapsedMillisecondsStartTime = currentTimeMilliseconds;
62-
return 0;
63-
}
64-
return currentTimeMilliseconds - elapsedMillisecondsStartTime;
65-
}
66-
67-
/**
68-
* Returns the current time, in milliseconds, from a monotonic clock.
69-
*/
70-
function getCurrentMonotonicTimeMilliseconds(): number {
71-
const currentTime: [number, number] = process.hrtime();
72-
return currentTime[0] * 1000 + currentTime[1] / 1_000_000;
73-
}
74-
75-
function debugLog(...args: any[]): void {
76-
// eslint-disable-next-line no-console
77-
console.log(__filename, elapsedTimeStr(), ...args);
78-
}
79-
80-
function errorLog(...args: any[]): void {
81-
// eslint-disable-next-line no-console
82-
console.error(__filename, elapsedTimeStr(), ...args);
83-
}
84-
85-
debugLog(`command-line arguments: ${process.argv.join(' ')}`);
86-
8723
const argv = yargs.options({
8824
main: {
8925
type: 'string',
@@ -122,34 +58,21 @@ let args = [
12258
];
12359

12460
if (argv.emulator) {
125-
debugLog("setting FIRESTORE_TARGET_BACKEND=emulator");
12661
process.env.FIRESTORE_TARGET_BACKEND = 'emulator';
12762
}
12863

12964
if (argv.persistence) {
130-
debugLog("setting USE_MOCK_PERSISTENCE=YES");
13165
process.env.USE_MOCK_PERSISTENCE = 'YES';
13266
args.push('--require', 'test/util/node_persistence.ts');
13367
}
13468

13569
args = args.concat(argv._ as string[]);
13670

137-
debugLog(`spawning child process: ${nyc} ${args.join(' ')}`);
138-
13971
const childProcess = spawn(nyc, args, {
14072
stdio: 'inherit',
14173
cwd: process.cwd()
14274
}).childProcess;
14375

144-
process.once('exit', () => {
145-
errorLog("WARNING: received 'exit' event; killing child process");
146-
childProcess.kill();
147-
});
148-
process.once('SIGINT', () => {
149-
errorLog("WARNING: received 'SIGINT' event; sending it to child process");
150-
childProcess.kill('SIGINT');
151-
});
152-
process.once('SIGTERM', () => {
153-
errorLog("WARNING: received 'SIGTERM' event; sending it to child process");
154-
childProcess.kill('SIGTERM');
155-
});
76+
process.once('exit', () => childProcess.kill());
77+
process.once('SIGINT', () => childProcess.kill('SIGINT'));
78+
process.once('SIGTERM', () => childProcess.kill('SIGTERM'));

scripts/ci-test/test_changed.ts

Lines changed: 1 addition & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -23,69 +23,6 @@ import * as yargs from 'yargs';
2323
import { TestConfig, testConfig } from './testConfig';
2424
const root = resolve(__dirname, '../..');
2525

26-
/**
27-
* Creates and returns a "timestamp" string for the elapsed time.
28-
*
29-
* The given timestamp is taken as an offset from the first time that this
30-
* function is invoked. This allows log messages to start at "time 0" and make
31-
* it easy for humans to calculate the elapsed time.
32-
*
33-
* @returns The timestamp string with which to prefix log lines, created from
34-
* the elapsed time since this function's first invocation.
35-
*/
36-
function elapsedTimeStr(): string {
37-
const milliseconds = getElapsedMilliseconds();
38-
const minutes = Math.floor(milliseconds / (1000 * 60));
39-
const seconds = (milliseconds - minutes * 1000 * 60) / 1000;
40-
return (
41-
(minutes < 10 ? '0' : '') +
42-
minutes +
43-
':' +
44-
(seconds < 10 ? '0' : '') +
45-
seconds.toFixed(3)
46-
);
47-
}
48-
49-
/**
50-
* The "start time", which is set to a non-null value upon the first invocation
51-
* of `getElapsedMilliseconds()`. All subsequent invocations calculate the
52-
* elapsed time using this value.
53-
*/
54-
let elapsedMillisecondsStartTime: number | null = null;
55-
56-
/**
57-
* Returns the number of milliseconds that have elapsed since this function's
58-
* first invocation. Returns 0 on its first invocation.
59-
*/
60-
function getElapsedMilliseconds(): number {
61-
const currentTimeMilliseconds = getCurrentMonotonicTimeMilliseconds();
62-
if (elapsedMillisecondsStartTime === null) {
63-
elapsedMillisecondsStartTime = currentTimeMilliseconds;
64-
return 0;
65-
}
66-
return currentTimeMilliseconds - elapsedMillisecondsStartTime;
67-
}
68-
69-
/**
70-
* Returns the current time, in milliseconds, from a monotonic clock.
71-
*/
72-
function getCurrentMonotonicTimeMilliseconds(): number {
73-
const currentTime: [number, number] = process.hrtime();
74-
return currentTime[0] * 1000 + currentTime[1] / 1_000_000;
75-
}
76-
77-
function debugLog(...args: any[]): void {
78-
// eslint-disable-next-line no-console
79-
console.log(__filename, elapsedTimeStr(), ...args);
80-
}
81-
82-
function errorLog(...args: any[]): void {
83-
// eslint-disable-next-line no-console
84-
console.error(__filename, elapsedTimeStr(), ...args);
85-
}
86-
87-
debugLog(`command-line arguments: ${process.argv.join(' ')}`);
88-
8926
const argv = yargs.parseSync();
9027
const inputTestConfigName = argv._[0].toString();
9128
const testCommand = 'test:ci';
@@ -139,14 +76,10 @@ async function runTests(config: TestConfig) {
13976
}
14077

14178
lernaCmd.push(testCommand);
142-
debugLog(`spawning process: npx ${lernaCmd.join(' ')}`);
14379
await spawn('npx', lernaCmd, { stdio: 'inherit', cwd: root });
144-
debugLog(`process completed successfully: npx ${lernaCmd.join(' ')}`);
14580
process.exit(0);
14681
} catch (e) {
147-
errorLog('process failed');
14882
console.error(chalk`{red ${e}}`);
149-
errorLog('terminating with exit code 65');
150-
process.exit(65);
83+
process.exit(1);
15184
}
15285
}

scripts/run_tests_in_ci.js

Lines changed: 4 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -20,69 +20,6 @@ const path = require('path');
2020
const { spawn } = require('child-process-promise');
2121
const { writeFileSync } = require('fs');
2222

23-
/**
24-
* Creates and returns a "timestamp" string for the elapsed time.
25-
*
26-
* The given timestamp is taken as an offset from the first time that this
27-
* function is invoked. This allows log messages to start at "time 0" and make
28-
* it easy for humans to calculate the elapsed time.
29-
*
30-
* @returns The timestamp string with which to prefix log lines, created from
31-
* the elapsed time since this function's first invocation.
32-
*/
33-
function elapsedTimeStr() {
34-
const milliseconds = getElapsedMilliseconds();
35-
const minutes = Math.floor(milliseconds / (1000 * 60));
36-
const seconds = (milliseconds - minutes * 1000 * 60) / 1000;
37-
return (
38-
(minutes < 10 ? '0' : '') +
39-
minutes +
40-
':' +
41-
(seconds < 10 ? '0' : '') +
42-
seconds.toFixed(3)
43-
);
44-
}
45-
46-
/**
47-
* The "start time", which is set to a non-null value upon the first invocation
48-
* of `getElapsedMilliseconds()`. All subsequent invocations calculate the
49-
* elapsed time using this value.
50-
*/
51-
let elapsedMillisecondsStartTime = null;
52-
53-
/**
54-
* Returns the number of nanoseconds that have elapsed since this function's
55-
* first invocation. Returns 0 on its first invocation.
56-
*/
57-
function getElapsedMilliseconds() {
58-
const currentTimeMilliseconds = getCurrentMonotonicTimeMilliseconds();
59-
if (elapsedMillisecondsStartTime === null) {
60-
elapsedMillisecondsStartTime = currentTimeMilliseconds;
61-
return 0;
62-
}
63-
return currentTimeMilliseconds - elapsedMillisecondsStartTime;
64-
}
65-
66-
/**
67-
* Returns the current time, in milliseconds, from a monotonic clock.
68-
*/
69-
function getCurrentMonotonicTimeMilliseconds() {
70-
const currentTime = process.hrtime();
71-
return currentTime[0] * 1000 + currentTime[1] / 1_000_000;
72-
}
73-
74-
function debugLog(...args) {
75-
// eslint-disable-next-line no-console
76-
console.log(__filename, elapsedTimeStr(), ...args);
77-
}
78-
79-
function errorLog(...args) {
80-
// eslint-disable-next-line no-console
81-
console.error(__filename, elapsedTimeStr(), ...args);
82-
}
83-
84-
debugLog(`command-line arguments: ${process.argv.join(' ')}`);
85-
8623
const LOGDIR = process.env.CI ? process.env.HOME : '/tmp';
8724
// Maps the packages where we should not run `test:all` and instead isolate the cross-browser tests.
8825
// TODO(dwyfrequency): Update object with `storage` and `firestore` packages.
@@ -132,10 +69,7 @@ const argv = yargs.options({
13269
}
13370
}
13471
}
135-
136-
const yarnArgs = ['--cwd', dir, scriptName];
137-
debugLog(`spawning '${name}' process: yarn ${yarnArgs.join(' ')}`);
138-
const testProcess = spawn('yarn', yarnArgs);
72+
const testProcess = spawn('yarn', ['--cwd', dir, scriptName]);
13973

14074
testProcess.childProcess.stdout.on('data', data => {
14175
stdout += data.toString();
@@ -145,20 +79,13 @@ const argv = yargs.options({
14579
});
14680

14781
await testProcess;
148-
debugLog(
149-
`'${name}' process completed successfully: yarn ${yarnArgs.join(' ')}`
150-
);
82+
console.log('Success: ' + name);
15183
writeLogs('Success', name, stdout + '\n' + stderr);
15284
} catch (e) {
153-
errorLog(`${name} process FAILED`);
154-
errorLog(`${name} process ==== STDOUT BEGIN ====`);
85+
console.error('Failure: ' + name);
15586
console.log(stdout);
156-
errorLog(`${name} process ==== STDOUT END ====`);
157-
errorLog(`${name} process ==== STDERR BEGIN ====`);
15887
console.error(stderr);
159-
errorLog(`${name} process ==== STDERR END ====`);
16088
writeLogs('Failure', name, stdout + '\n' + stderr);
161-
errorLog('Completing with failure exit code 76');
162-
process.exit(76);
89+
process.exit(1);
16390
}
16491
})();

0 commit comments

Comments
 (0)