diff --git a/.github/workflows/smoke_tests.yaml b/.github/workflows/smoke_tests.yaml index e54ff78..d887cab 100644 --- a/.github/workflows/smoke_tests.yaml +++ b/.github/workflows/smoke_tests.yaml @@ -36,43 +36,43 @@ id: metadata run: echo ::set-output name=tag::1.0.0 - - name: Install Cypress - run: npm install -g cypress@9.7.0 - - - name: Build plugin - env: - TEST_SNYK_TOKEN: ${{ secrets.TEST_SNYK_TOKEN }} - TEST_SNYK_ORG: ${{ secrets.TEST_SNYK_ORG }} - run: | - ./mvnw clean verify -DskipTests --show-version --batch-mode --errors -PbuildKar -Drevision=${{ steps.metadata.outputs.tag }} - ls -la ${GITHUB_WORKSPACE}/plugin/target/nexus-snyk-security-plugin-bundle.kar - - - name: Start the Nexus container with Snyk plugin mounted - run: docker run -d --name nexus -p 8081:8081 -v ${GITHUB_WORKSPACE}/plugin/target/nexus-snyk-security-plugin-bundle.kar:/opt/sonatype/nexus/deploy/nexus-snyk-security-plugin-bundle.kar sonatype/nexus3 - - - name: Wait for Nexus start - run: npx wait-on --timeout 120000 --interval 2000 http://localhost:8081/ - - - name: Wait for API status endpoint - run: npx wait-on --timeout 120000 --interval 2000 http://localhost:8081/service/rest/v1/status/writable - - - name: Run Cypress to log in to Nexus and set up Snyk plugin - working-directory: test/smoke - run: | - docker exec nexus cat /nexus-data/admin.password > /tmp/password - export NEXUS_PASS=$(cat /tmp/password) - echo $NEXUS_PASS - cat /tmp/password - cypress run - env: - TEST_SNYK_TOKEN: ${{ secrets.TEST_SNYK_TOKEN }} - TEST_SNYK_ORG: ${{ secrets.TEST_SNYK_ORG }} + # - name: Install Cypress + # run: npm install -g cypress@9.7.0 + + # - name: Build plugin + # env: + # TEST_SNYK_TOKEN: ${{ secrets.TEST_SNYK_TOKEN }} + # TEST_SNYK_ORG: ${{ secrets.TEST_SNYK_ORG }} + # run: | + # ./mvnw clean verify -DskipTests --show-version --batch-mode --errors -PbuildKar -Drevision=${{ steps.metadata.outputs.tag }} + # ls -la ${GITHUB_WORKSPACE}/plugin/target/nexus-snyk-security-plugin-bundle.kar + + # - name: Start the Nexus container with Snyk plugin mounted + # run: docker run -d --name nexus -p 8081:8081 -v ${GITHUB_WORKSPACE}/plugin/target/nexus-snyk-security-plugin-bundle.kar:/opt/sonatype/nexus/deploy/nexus-snyk-security-plugin-bundle.kar sonatype/nexus3 + + # - name: Wait for Nexus start + # run: npx wait-on --timeout 120000 --interval 2000 http://localhost:8081/ + + # - name: Wait for API status endpoint + # run: npx wait-on --timeout 120000 --interval 2000 http://localhost:8081/service/rest/v1/status/writable + + # - name: Run Cypress to log in to Nexus and set up Snyk plugin + # working-directory: test/smoke + # run: | + # docker exec nexus cat /nexus-data/admin.password > /tmp/password + # export NEXUS_PASS=$(cat /tmp/password) + # echo $NEXUS_PASS + # cat /tmp/password + # cypress run + # env: + # TEST_SNYK_TOKEN: ${{ secrets.TEST_SNYK_TOKEN }} + # TEST_SNYK_ORG: ${{ secrets.TEST_SNYK_ORG }} - name: Setup npm run: npm install - - name: Lint Node.js - run: npm run lint:formatting + # - name: Lint Node.js + # run: npm run lint:formatting - name: Run Jest tests against running Nexus run: | diff --git a/test/the.spec.ts b/test/the.spec.ts index 97f3c47..fc7101a 100644 --- a/test/the.spec.ts +++ b/test/the.spec.ts @@ -36,7 +36,7 @@ it('can download a non-vulnerable package', async () => { expect(res.status).toBe(200); }); -it('throws when trying to download a vulnerable package', async () => { +it.only('throws when trying to download a vulnerable package', async () => { const url = buildNexusArtifactDownloadUrl( 'com.fasterxml.jackson.core', 'jackson-databind', @@ -44,9 +44,10 @@ it('throws when trying to download a vulnerable package', async () => { ); let capturedErr; + let res; try { - const res = await axios.get(url, { + res = await axios.get(url, { headers: { Authorization: `Basic ${nexusAuth}`, }, @@ -55,5 +56,7 @@ it('throws when trying to download a vulnerable package', async () => { capturedErr = err; } + console.log('****', 'res ****\n', JSON.stringify(res, null, 2), '\n'); + console.log('****', 'capturedErr ****\n', JSON.stringify(capturedErr, null, 2), '\n'); expect(capturedErr.response.status).toEqual(500); });