Skip to content

Commit

Permalink
Merge branch 'main' into mongodb-ownership-request
Browse files Browse the repository at this point in the history
  • Loading branch information
osherv authored Sep 1, 2022
2 parents 472a499 + ff96b70 commit 2106b63
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 34 deletions.
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 2106b63

Please sign in to comment.