From 29272fd8e69352033980c2850f067c201cd184ec Mon Sep 17 00:00:00 2001 From: Matt Olson Date: Fri, 17 Jun 2022 10:27:12 -0700 Subject: [PATCH] Fix lint errors and add changelog entry --- experimental/CHANGELOG.md | 1 + .../otlp-exporter-base/test/node/util.test.ts | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/experimental/CHANGELOG.md b/experimental/CHANGELOG.md index b2bb38c924..9483c55149 100644 --- a/experimental/CHANGELOG.md +++ b/experimental/CHANGELOG.md @@ -18,6 +18,7 @@ All notable changes to experimental packages in this project will be documented * fix(otlp-transformer): remove type dependency on Long #3022 @legendecas * fix(grpc-exporter): use non-normalized URL to determine channel security #3019 @pichlermarc +* fix(otlp-exporter-base): fix gzip output stream in http otlp export #3046 @mattolson ### :books: (Refine Doc) diff --git a/experimental/packages/otlp-exporter-base/test/node/util.test.ts b/experimental/packages/otlp-exporter-base/test/node/util.test.ts index d3acf39946..c790e87592 100644 --- a/experimental/packages/otlp-exporter-base/test/node/util.test.ts +++ b/experimental/packages/otlp-exporter-base/test/node/util.test.ts @@ -35,7 +35,7 @@ class HttpResponse extends PassThrough { statusCode: number; statusMessage: string; - constructor(statusCode: number = 200, statusMessage: string = 'OK') { + constructor(statusCode = 200, statusMessage = 'OK') { super(); this.statusCode = statusCode; this.statusMessage = statusMessage; @@ -171,7 +171,7 @@ describe('sendWithHttp', () => { let mockRequest: HttpRequest; let setHeaderSpy: sinon.SinonSpy; - let spanData: object = { + const spanData: object = { 'foo': 'bar', 'bar': 'baz', }; @@ -193,18 +193,18 @@ describe('sendWithHttp', () => { // Mock out response const response = new HttpResponse(); response.end('OK'); - + // Stub out http.request so it calls our callback with the mocked response // and also so it returns our mocked request stream so we can observe. We don't // really care about the response for the purpose of this test, but we do want // to observe the request compression behavior. - httpRequestStub.returns(mockRequest).callsArgWith(1, response); + httpRequestStub.returns(mockRequest).callsArgWith(1, response); }); afterEach(function() { - httpRequestStub.restore(); + httpRequestStub.restore(); setHeaderSpy.restore(); - }); + }); it('should send with no compression if configured to do so', () => { exporter = new Exporter(exporterConfig); @@ -219,7 +219,7 @@ describe('sendWithHttp', () => { sendWithHttp(exporter, data, 'application/json', () => { // Show that we aren't setting the gzip encoding header - assert(setHeaderSpy.withArgs('Content-Encoding', 'gzip').notCalled) + assert(setHeaderSpy.withArgs('Content-Encoding', 'gzip').notCalled); }, (err: OTLPExporterError) => { assert.fail(err); }); @@ -267,7 +267,7 @@ describe('sendWithHttp', () => { const response = new HttpResponse(); response.end('OK'); - + httpRequestStub.restore(); httpRequestStub = sinon.stub(http, 'request'); httpRequestStub.returns(mockRequest).callsArgWith(1, response); @@ -287,4 +287,4 @@ describe('sendWithHttp', () => { }); } }); -}); \ No newline at end of file +});