Skip to content

Commit

Permalink
ci: [Bug] Web based karma tests are no longer running open-telemetry#…
Browse files Browse the repository at this point in the history
…1135

ci: [Bug] DNS Lookup and Promise Lookup test for error NOT_FOUND failing open-telemetry#1136
  • Loading branch information
MSNev committed Aug 30, 2022
1 parent d84cb36 commit 47e107f
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 35 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,4 @@ package.json.lerna_backup

# version.ts file is automatically generated at compile time
version.ts
/.vs
2 changes: 1 addition & 1 deletion karma.webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = {
exclude: /(node_modules|\.test\.[tj]sx?$)/,
test: /\.ts$/,
use: {
loader: 'istanbul-instrumenter-loader',
loader: '@jsdevtools/coverage-istanbul-loader',
options: { esModules: true }
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,24 +98,30 @@ describe('dns.lookup()', () => {
});
});

it('should export a valid span with error NOT_FOUND', done => {
const hostname = 'ᚕ';
dns.lookup(hostname, (err, address, family) => {
assert.ok(err);
describe("extended timeout", function () {
// Extending the default timeout as some environments are taking longer than 2 seconds to fail
// So rather than fail the test -- just take a little longer
this.timeout(10000);

const spans = memoryExporter.getFinishedSpans();
const [span] = spans;
it('should export a valid span with error NOT_FOUND', done => {
const hostname = 'ᚕ';
dns.lookup(hostname, (err, address, family) => {
assert.ok(err);

assert.strictEqual(spans.length, 1);
assertSpan(span, {
addresses: [{ address, family }],
hostname,
forceStatus: {
code: SpanStatusCode.ERROR,
message: err!.message,
},
const spans = memoryExporter.getFinishedSpans();
const [span] = spans;

assert.strictEqual(spans.length, 1);
assertSpan(span, {
addresses: [{ address, family }],
hostname,
forceStatus: {
code: SpanStatusCode.ERROR,
message: err!.message,
},
});
done();
});
done();
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,25 +111,31 @@ describe('dns.promises.lookup()', () => {
assertSpan(span, { addresses: [{ address, family }], hostname });
});

it('should export a valid span with error NOT_FOUND', async () => {
const hostname = 'ᚕ';
try {
await lookupPromise(hostname);
assert.fail();
} catch (error) {
const spans = memoryExporter.getFinishedSpans();
const [span] = spans;

assert.strictEqual(spans.length, 1);
assertSpan(span, {
addresses: [],
hostname,
forceStatus: {
code: SpanStatusCode.ERROR,
message: error!.message,
},
});
}
describe("extended timeout", function () {
// Extending the default timeout as some environments are taking longer than 2 seconds to fail
// So rather than fail the test -- just take a little longer
this.timeout(10000);

it('should export a valid span with error NOT_FOUND', async () => {
const hostname = 'ᚕ';
try {
await lookupPromise(hostname);
assert.fail();
} catch (error) {
const spans = memoryExporter.getFinishedSpans();
const [span] = spans;

assert.strictEqual(spans.length, 1);
assertSpan(span, {
addresses: [],
hostname,
forceStatus: {
code: SpanStatusCode.ERROR,
message: error!.message,
},
});
}
});
});

it('should export a valid span with error INVALID_ARGUMENT when "family" param is equal to -1', async () => {
Expand Down

0 comments on commit 47e107f

Please sign in to comment.