GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Refactor CodeQL setup tests and fix GHAE test by henrymercer · Pull Request #1474 · github/codeql-action

Conversation

@henrymercer

@henrymercer henrymercer commented Jan 10, 2023

Copy link
Copy Markdown
Contributor

This PR refactors the CodeQL setup tests and fixes a GHAE setup test.

Refactoring of CodeQL setup tests

  • I've split up mockApiAndSetupCodeQL into mockDownloadApi, installIntoToolcache, and setupCodeQL so it's a easier to understand the intent of the tests.
  • I've renamed the tests to include assertions about expected behavior.
  • I've also renamed the bundle tag name from version to tagName to prepare for the controlled rollout changes, which will involve keeping track of both a CLI version and a bundle tag name.

Fix to GHAE setup test

  • Previously we weren't actually testing GHAE setup.
    • The GHAE API URL was missing, so calling the GHAE endpoint failed.
    • However the test didn't fail because a mock for the fallback Dotcom endpoint was hanging around from a previous test.
  • I have added the missing GHAE API URL and added a call to the test infrastructure to clear all nock network request mocks after each test, just as we clear all sinon mocks.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.
  • Confirm the changelog has been updated if necessary.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
henrymercer added 3 commits January 10, 2023 19:35
@henrymercer
Improve CodeQL setup test structure and naming
9203e31
@henrymercer
Fix GHAE CodeQL setup test
9f8ddbd
@henrymercer
Add a note regarding the sinon workaround
28a9b2d
@henrymercer

henrymercer commented Jan 10, 2023

Copy link
Copy Markdown
Contributor Author

Checks are failing on main — merging in main once #1466 is merged should fix.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@henrymercer
Merge branch 'main' into henrymercer/fix-ghae-setup-test
70a288d
@henrymercer
henrymercer marked this pull request as ready for review January 10, 2023 21:10
@henrymercer
henrymercer requested a review from a team as a code owner January 10, 2023 21:10
angelapwen
angelapwen previously approved these changes Jan 10, 2023
View reviewed changes

@angelapwen angelapwen left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of small notes and there's a merge conflict with one of the source map files, but overall it looks great and clean! Thanks for doing all this refactoring ✨

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/codeql.test.ts
async function mockApiAndSetupCodeQL({
apiDetails,
bypassToolcache,
async function mockDownloadApi({

@angelapwen angelapwen Jan 10, 2023

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: it wasn't super clear to me what the Promise this function returned was, could we add a comment indicating it's returning the URL or rename the function?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@henrymercer henrymercer Jan 11, 2023

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, I've added some JSDoc.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/codeql.test.ts
const relativeUrl = apiDetails
? `/github/codeql-action/releases/download/${version}/codeql-bundle-${platform}.tar.gz`
: `/download/codeql-bundle-${version}/codeql-bundle.tar.gz`;
? `/github/codeql-action/releases/download/${tagName}/codeql-bundle-${platform}.tar.gz`

@angelapwen angelapwen Jan 10, 2023

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be clear — this is where you're renaming the bundle tag name in the tests from version to tagNamethat includes thecodeql-bundle-` prefix, right?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@henrymercer henrymercer Jan 11, 2023

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
henrymercer added 2 commits January 11, 2023 15:23
@henrymercer
Merge branch 'main' into henrymercer/fix-ghae-setup-test
4a91879
@henrymercer
Add JSDoc for mockDownloadApi
6ba0a36
@henrymercer
henrymercer dismissed angelapwen’s stale review via 6ba0a36 January 11, 2023 15:25
@henrymercer
henrymercer requested a review from angelapwen January 11, 2023 15:25
angelapwen
angelapwen approved these changes Jan 11, 2023
View reviewed changes

@angelapwen angelapwen left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@henrymercer
henrymercer merged commit 70fdddf into main Jan 11, 2023
@henrymercer
henrymercer deleted the henrymercer/fix-ghae-setup-test branch January 11, 2023 17:14
This was referenced Jan 12, 2023
Merge main into releases/v2 #1476
Merged
Merge releases/v2 into releases/v1 #1478
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@angelapwen angelapwen angelapwen approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@henrymercer @angelapwen
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.