Skip to content
This repository was archived by the owner on Oct 3, 2023. It is now read-only.

Commit 38aea52

Browse files
chord: merge commit
2 parents 532819a + 8c9102d commit 38aea52

2 files changed

Lines changed: 65 additions & 44 deletions

File tree

packages/opencensus-core/scripts/index.ts

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,8 @@ const {
1414
TRACE_SYSTEM_TEST_ENCRYPTED_CREDENTIALS_IV
1515
} = process.env;
1616

17-
import { checkInstall } from './check-install';
1817
import { compile } from './compile';
19-
import { encryptCredentials, decryptCredentials } from './credentials';
20-
import { initTestFixtures } from './init-test-fixtures';
21-
import { reportCoverage } from './report-coverage';
2218
import { runTests } from './run-tests';
23-
import { testNonInterference } from './test-non-interference';
2419
import { BUILD_DIRECTORY, existsP, spawnP } from './utils';
2520

2621
// The identifying string in the service account credentials file path.
@@ -73,40 +68,6 @@ async function run(steps: string[]) {
7368
timeout: 4000
7469
});
7570
break;
76-
case 'run-unit-tests-with-coverage':
77-
await runTests({
78-
includeGlobs: [
79-
`${BUILD_DIRECTORY}/test/test-*.js`,
80-
`${BUILD_DIRECTORY}/test/plugins/test-*.js`
81-
],
82-
excludeGlobs: unitTestExcludeGlobs,
83-
rootDir: BUILD_DIRECTORY,
84-
coverage: true,
85-
timeout: 4000
86-
});
87-
break;
88-
case 'run-system-tests':
89-
await spawnP(
90-
'npm', ['install'], { cwd: 'system-test' }
91-
);
92-
if (CI_PULL_REQUEST && !(await existsP('node-team-test-d0b0be11c23d.json'))) {
93-
console.log('> Not running system tests in PRs');
94-
} else {
95-
await runTests({
96-
includeGlobs: [
97-
`system-test/*.js`,
98-
],
99-
rootDir: '.',
100-
coverage: false
101-
});
102-
}
103-
break;
104-
case 'report-coverage':
105-
await reportCoverage();
106-
break;
107-
case 'test-non-interference':
108-
await testNonInterference();
109-
break;
11071
default:
11172
console.log(`> ${step}: not found`);
11273
break;
Lines changed: 65 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,70 @@
11
import { Trace } from '../src/trace/trace';
2+
import { Span } from '../src/trace/span';
23

3-
var assert = require('assert');
4+
let assert = require('assert');
45

5-
describe('Trace', function() {
6-
it('should be a Trace instance', function() {
7-
var trace = new Trace();
8-
assert.ok(trace instanceof Trace);
6+
describe('Trace', function () {
7+
describe('new Trace()', function () {
8+
it('should be a Trace instance', function () {
9+
let trace = new Trace();
10+
assert.ok(trace instanceof Trace);
11+
});
912
});
13+
14+
describe('start()', function () {
15+
it('trace was started', function () {
16+
let trace = new Trace();
17+
trace.start();
18+
assert.ok(trace.started);
19+
});
20+
});
21+
22+
describe('startSpan()', function () {
23+
let trace = new Trace();
24+
trace.start()
25+
let span = trace.startSpan("spanName", "spanType");
26+
it('should be a Span instance', function () {
27+
assert.ok(span instanceof Span);
28+
});
29+
30+
it('span was started', function () {
31+
assert.ok(span.started);
32+
});
33+
});
34+
35+
describe('end()', function () {
36+
it('trace was ended', function () {
37+
let trace = new Trace();
38+
trace.start()
39+
trace.end();
40+
assert.ok(trace.ended);
41+
});
42+
});
43+
44+
describe('end() before trace started', function () {
45+
it('trace was not ended', function () {
46+
let trace = new Trace();
47+
trace.end();
48+
assert.ok(!trace.ended);
49+
});
50+
});
51+
52+
describe('startSpan() before trace started', function () {
53+
it('should return null', function () {
54+
let trace = new Trace();
55+
let span = trace.startSpan("spanName", "spanType");
56+
assert.ok(span == null);
57+
});
58+
});
59+
60+
describe('startSpan() after trace ended', function () {
61+
it('should return null', function () {
62+
let trace = new Trace();
63+
trace.start()
64+
trace.end();
65+
let span = trace.startSpan("spanName", "spanType");
66+
assert.ok(span == null);
67+
});
68+
});
69+
1070
});

0 commit comments

Comments
 (0)