diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..e338f0b --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,53 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +name: Build + +on: + pull_request: + push: + branches: + - master + +jobs: + Build: + runs-on: ubuntu-18.04 + timeout-minutes: 30 + strategy: + matrix: + node-version: [ 12, 14 ] + steps: + - uses: actions/checkout@v2 + with: + submodules: true + + - uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Set Up NodeJS ${{ matrix.node-version }} + uses: actions/setup-node@v2-beta + with: + node-version: ${{ matrix.node-version }} + + - name: Build + run: | + npm i + npm run build diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..1175d3b --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,53 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +name: Test + +on: + pull_request: + push: + branches: + - master + +jobs: + Build: + runs-on: ubuntu-18.04 + timeout-minutes: 30 + strategy: + matrix: + node-version: [ 12, 14 ] + steps: + - uses: actions/checkout@v2 + with: + submodules: true + + - uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Set Up NodeJS ${{ matrix.node-version }} + uses: actions/setup-node@v2-beta + with: + node-version: ${{ matrix.node-version }} + + - name: Test + run: | + npm i + npm run test diff --git a/tests/plugins/http/expected.data.yaml b/tests/plugins/http/expected.data.yaml index 3588900..a0e03d3 100644 --- a/tests/plugins/http/expected.data.yaml +++ b/tests/plugins/http/expected.data.yaml @@ -21,21 +21,25 @@ segmentItems: segments: - segmentId: not null spans: - - operationName: /xml + - operationName: /test operationId: 0 - parentSpanId: 0 - spanId: 2 + parentSpanId: -1 + spanId: 0 spanLayer: Http startTime: gt 0 endTime: gt 0 - componentId: 2 + componentId: 49 isError: false - spanType: Exit - peer: httpbin.org + spanType: Entry + peer: '' skipAnalysis: false tags: - - { key: http.url, value: httpbin.org/xml } + - { key: http.url, value: /test } - { key: http.status.code, value: '200' } + refs: + - { parentEndpoint: '', networkAddress: 'server:5000', refType: CrossProcess, + parentSpanId: 1, parentTraceSegmentId: not null, parentServiceInstance: not null, + parentService: client, traceId: not null } - operationName: /json operationId: 0 parentSpanId: 0 @@ -51,25 +55,6 @@ segmentItems: tags: - { key: http.url, value: httpbin.org/json } - { key: http.status.code, value: '200' } - - operationName: /test - operationId: 0 - parentSpanId: -1 - spanId: 0 - spanLayer: Http - startTime: gt 0 - endTime: gt 0 - componentId: 49 - isError: false - spanType: Entry - peer: '' - skipAnalysis: false - tags: - - { key: http.url, value: /test } - - { key: http.status.code, value: '200' } - refs: - - { parentEndpoint: '', networkAddress: 'server:5000', refType: CrossProcess, - parentSpanId: 1, parentTraceSegmentId: not null, parentServiceInstance: not null, - parentService: client, traceId: not null } - serviceName: client segmentSize: 1 segments: diff --git a/tests/plugins/http/server.ts b/tests/plugins/http/server.ts index 2885c56..b9cbc2f 100644 --- a/tests/plugins/http/server.ts +++ b/tests/plugins/http/server.ts @@ -30,15 +30,7 @@ const server = http.createServer((req, res) => { .request('http://httpbin.org/json', (r) => { let data = ''; r.on('data', (chunk) => (data += chunk)); - r.on('end', () => setImmediate(() => res.write(data))); - }) - .end(); - - http - .request('http://httpbin.org/xml', async (r) => { - let data = ''; - r.on('data', (chunk) => (data += chunk)); - r.on('end', () => setTimeout(() => res.end(data), 1000)); + r.on('end', () => res.end(data)); }) .end(); });