Skip to content

Commit

Permalink
No shared exporterConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
dyladan authored Jun 24, 2022
1 parent 29272fd commit d87fb24
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions experimental/packages/otlp-exporter-base/test/node/util.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ describe('configureCompression', () => {
});

describe('sendWithHttp', () => {
let exporterConfig: ExporterConfig;
let exporter: Exporter;
let httpRequestStub: sinon.SinonStub;
let mockRequest: HttpRequest;
Expand All @@ -177,11 +176,6 @@ describe('sendWithHttp', () => {
};

beforeEach(() => {
// Setup exporter config
exporterConfig = {
url: 'http://foobar.com',
compression: CompressionAlgorithm.NONE,
};

// Create stub of http.request (used by sendWithHttp)
httpRequestStub = sinon.stub(http, 'request');
Expand All @@ -207,7 +201,10 @@ describe('sendWithHttp', () => {
});

it('should send with no compression if configured to do so', () => {
exporter = new Exporter(exporterConfig);
exporter = new Exporter({
url: 'http://foobar.com',
compression: CompressionAlgorithm.NONE,
});
const data = JSON.stringify(spanData);

// Show that data is written to the request stream
Expand All @@ -226,11 +223,10 @@ describe('sendWithHttp', () => {
});

it('should send with gzip compression if configured to do so', () => {
exporterConfig = {
exporter = new Exporter({
url: 'http://foobar.com',
compression: CompressionAlgorithm.GZIP,
};
exporter = new Exporter(exporterConfig);
});

const data = JSON.stringify(spanData);
const compressedData = zlib.gzipSync(Buffer.from(data));
Expand All @@ -251,11 +247,10 @@ describe('sendWithHttp', () => {
});

it('should work with gzip compression enabled even after multiple requests', () => {
exporterConfig = {
exporter = new Exporter({
url: 'http://foobar.com',
compression: CompressionAlgorithm.GZIP,
};
exporter = new Exporter(exporterConfig);
});

const data = JSON.stringify(spanData);
const compressedData = zlib.gzipSync(Buffer.from(data));
Expand Down

0 comments on commit d87fb24

Please sign in to comment.