From 648265af72801a26d07ea925c407f58aa4f6296f Mon Sep 17 00:00:00 2001 From: Justin Date: Sun, 24 Jan 2021 13:07:35 -0500 Subject: [PATCH 1/5] Adding artifact logs for failures --- .gitlab-ci.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 19c65c62..067b72f1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -98,9 +98,13 @@ test:unit:utils: - export PERSONAL_ACCESS_TOKEN=$(docker exec -i gitlab sh -c 'gitlab-rails r /mnt/init.rb') - cd .. - - echo $PERSONAL_ACCESS_TOKEN - - echo $GITLAB_URL - - echo $CODECOV_TOKEN + after_script: + - docker cp gitlab:/var/log/gitlab runner_logs + - echo $(docker exec -i gitlab sh -c "grep -v -e '^#' -e '^$' /etc/gitlab/gitlab.rb") > runner_logs/gitlab.rb + artifacts: + when: on_failure + paths: + - runner_logs test:integration:browser: image: buildkite/puppeteer From 6c55e5944ceb4bfe6aa3ae2d9000392a0071ba24 Mon Sep 17 00:00:00 2001 From: Justin Date: Sun, 24 Jan 2021 13:16:44 -0500 Subject: [PATCH 2/5] Add unique test id and add retry to integration builds --- .gitlab-ci.yml | 16 ++++++---------- package.json | 3 ++- .../test/integration/services/Issues.ts | 3 ++- .../test/integration/services/Projects.ts | 11 +++++++---- yarn.lock | 2 +- 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 067b72f1..2b81393c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -83,6 +83,7 @@ test:unit:utils: services: - docker:dind stage: test + retry: 2 before_script: # Install docker compose - apk add --no-cache nodejs yarn git @@ -111,17 +112,12 @@ test:integration:browser: stage: test script: yarn jest browser/test/integration -test:integration:node:src: +test:integration:node: <<: *integration - script: yarn jest node/test/integration && yarn codecov -F node - -test:integration:node:dist-cjs: - <<: *integration - script: yarn jest node/test/integration --moduleNameMapper='{"src":"/dist/index.js"}' - -test:integration:node:dist-es: - <<: *integration - script: yarn jest node/test/integration --moduleNameMapper='{"src":"/dist/index.js"}' + script: + - TEST_ID=$(uuid) yarn jest node/test/integration && yarn codecov -F node + - TEST_ID=$(uuid) yarn jest node/test/integration --moduleNameMapper='{"src":"/dist/index.js"}' + - TEST_ID=$(uuid) yarn jest node/test/integration --moduleNameMapper='{"src":"/dist/index.es.js"}' # Canary canary: diff --git a/package.json b/package.json index 49845077..4570a864 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,8 @@ "lint-staged": "^10.4.2", "prettier": "^2.1.2", "ts-jest": "^26.4.1", - "typescript": "^4.0.3" + "typescript": "^4.0.3", + "uuid": "^8.3.2" }, "private": true, "workspaces": [ diff --git a/packages/gitbeaker-node/test/integration/services/Issues.ts b/packages/gitbeaker-node/test/integration/services/Issues.ts index 3b65c548..0c0a507f 100644 --- a/packages/gitbeaker-node/test/integration/services/Issues.ts +++ b/packages/gitbeaker-node/test/integration/services/Issues.ts @@ -1,5 +1,6 @@ import { Issues, Projects } from '../../../src'; +const { TEST_ID } = process.env; let issueAPI: InstanceType; let projectAPI: InstanceType; @@ -16,7 +17,7 @@ beforeAll(async () => { describe.skip('Issues.all', () => { beforeAll(async () => { - const project = await projectAPI.create({ name: 'Issues All Integration Test' }); + const project = await projectAPI.create({ name: `Issues All Integration Test ${TEST_ID}` }); const newIssues: any[] = []; for (let i = 0; i < 100; i += 1) { diff --git a/packages/gitbeaker-node/test/integration/services/Projects.ts b/packages/gitbeaker-node/test/integration/services/Projects.ts index c76c871b..d4547fd2 100644 --- a/packages/gitbeaker-node/test/integration/services/Projects.ts +++ b/packages/gitbeaker-node/test/integration/services/Projects.ts @@ -1,5 +1,6 @@ import { Projects } from '../../../src'; +const { TEST_ID } = process.env; let service: InstanceType; beforeEach(() => { @@ -11,10 +12,10 @@ beforeEach(() => { describe('Projects.create', () => { it('should create a valid project', async () => { - const p = await service.create({ name: 'Project Creation Integration Test' }); + const p = await service.create({ name: `Project Creation Integration Test ${TEST_ID}` }); expect(p).toBeInstanceOf(Object); - expect(p.name).toEqual('Project Creation Integration Test'); + expect(p.name).toEqual(`Project Creation Integration Test ${TEST_ID}`); }); }); @@ -23,7 +24,7 @@ describe.skip('Projects.all', () => { const newProjects: any[] = []; for (let i = 0; i < 100; i += 1) { - newProjects.push(service.create({ name: `Project All Integration Test${i}` })); + newProjects.push(service.create({ name: `Project All Integration Test ${TEST_ID} ${i}` })); } await Promise.all(newProjects); @@ -40,7 +41,9 @@ describe.skip('Projects.all', () => { describe('Projects.upload', () => { it('should upload a text file', async () => { try { - const project = await service.create({ name: 'Project Upload Integration Test Text File' }); + const project = await service.create({ + name: `Project Upload Integration Test Text File ${TEST_ID}`, + }); const results = await service.upload(project.id as number, 'TESTING FILE UPLOAD :D', { metadata: { filename: 'testfile.txt', diff --git a/yarn.lock b/yarn.lock index 70d5764e..b5139740 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10312,7 +10312,7 @@ uuid@^3.0.1, uuid@^3.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== -uuid@^8.3.0: +uuid@^8.3.0, uuid@^8.3.2: version "8.3.2" resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== From 673ad2c60ebe9495a9b1d51f06e7e05e76611949 Mon Sep 17 00:00:00 2001 From: Justin Date: Sun, 24 Jan 2021 13:21:09 -0500 Subject: [PATCH 3/5] Updating image being used --- .gitlab-ci.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2b81393c..690f000d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -75,7 +75,7 @@ test:unit:utils: #Integration Tests .test:integration: &integration image: - name: docker/compose:latest + name: jdalrymple/docker-compose-with-node entrypoint: ['/bin/sh', '-c'] variables: DOCKER_HOST: tcp://docker:2375 @@ -85,9 +85,6 @@ test:unit:utils: stage: test retry: 2 before_script: - # Install docker compose - - apk add --no-cache nodejs yarn git - # Spin up container - cd scripts - docker-compose -f docker-compose.yml up -d From 81aab87a542fd8b07a9bf5e2a14f025c49e5eff3 Mon Sep 17 00:00:00 2001 From: Justin Date: Sun, 24 Jan 2021 13:43:26 -0500 Subject: [PATCH 4/5] Move into pkg script --- .gitlab-ci.yml | 6 +++--- package.json | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 690f000d..b8ba9c2a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -112,9 +112,9 @@ test:integration:browser: test:integration:node: <<: *integration script: - - TEST_ID=$(uuid) yarn jest node/test/integration && yarn codecov -F node - - TEST_ID=$(uuid) yarn jest node/test/integration --moduleNameMapper='{"src":"/dist/index.js"}' - - TEST_ID=$(uuid) yarn jest node/test/integration --moduleNameMapper='{"src":"/dist/index.es.js"}' + - yarn test:integration:node && yarn codecov -F node + - yarn test:integration:node --moduleNameMapper='{"src":"/dist/index.js"}' + - yarn test:integration:node --moduleNameMapper='{"src":"/dist/index.es.js"}' # Canary canary: diff --git a/package.json b/package.json index 4570a864..9dcc6dad 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "lint:doc:fix": "prettier --write './*.json' './*.yml' './*.md' './*.js'", "lint:fix": "prettier --write 'packages/**/{src,test}/**/*.ts' && eslint 'packages/**/{src,test}/**/*/*.ts' --fix", "test:integration": "jest test/integration", + "test:integration:node": "TEST_ID=$(uuid) yarn jest node/test/integration", "test:unit": "jest test/unit", "release": "auto shipit --verbose --verbose" }, From 544ce83e5120e3f55a2a33e135722df70022e2d5 Mon Sep 17 00:00:00 2001 From: Justin Date: Sun, 24 Jan 2021 14:34:47 -0500 Subject: [PATCH 5/5] Remove module test --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b8ba9c2a..5cfc7f58 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -114,7 +114,7 @@ test:integration:node: script: - yarn test:integration:node && yarn codecov -F node - yarn test:integration:node --moduleNameMapper='{"src":"/dist/index.js"}' - - yarn test:integration:node --moduleNameMapper='{"src":"/dist/index.es.js"}' + # - yarn test:integration:node --moduleNameMapper='{"src":"/dist/index.es.js"}' Requires module identifier # Canary canary: