You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+41Lines changed: 41 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -144,6 +144,47 @@ The CLI integration tests require the CodeQL standard libraries in order to run
144
144
145
145
3. Run the VSCode task from the "Run and Debug" view called _Launch Integration Tests - With CLI_.
146
146
147
+
#### Using a mock GitHub API server
148
+
149
+
Multi-Repo Variant Analyses (MRVA) rely on the GitHub API. In order to make development and testing easy, we have functionality that allows us to intercept requests to the GitHub API and provide mock responses.
150
+
151
+
##### Using a pre-recorded test scenario
152
+
153
+
To run a mock MRVA scenario, follow these steps:
154
+
1. Enable the mock GitHub API server by adding the following in your VS Code user settings (which can be found by running the `Preferences: Open User Settings (JSON)` VS Code command):
155
+
```json
156
+
"codeQL.mockGitHubApiServer": {
157
+
"enabled": true
158
+
}
159
+
```
160
+
161
+
1. Run the `CodeQL: Mock GitHub API Server: Load Scenario` command from the command pallet, and choose one of the scenarios to load.
162
+
1. Execute a normal MRVA. At this point you should see the scenario being played out, rather than an actual MRVA running.
163
+
1. Once you're done, you can stop using the mock scenario with `CodeQL: Mock GitHub API Server: Unload Scenario`
164
+
165
+
If you want to replay the same scenario you should unload and reload it so requests are replayed from the start.
166
+
167
+
##### Recording a new test scenario
168
+
To record a new mock MRVA scenario, follow these steps:
169
+
170
+
1. Enable the mock GitHub API server by adding the following in your VS Code user settings (which can be found by running the `Preferences: Open User Settings (JSON)` VS Code command):
171
+
```json
172
+
"codeQL.mockGitHubApiServer": {
173
+
"enabled": true
174
+
}
175
+
```
176
+
177
+
1. Run the `CodeQL: Mock GitHub API Server: Start Scenario Recording` VS Code command from the command pallet.
178
+
1. Execute a normal MRVA.
179
+
1. Once what you wanted to record is done (e.g. the MRVA has finished), then run the `CodeQL: Mock GitHub API Server: Save Scenario` command from the command pallet.
180
+
1. The scenario should then be available for replaying.
181
+
182
+
If you want to cancel recording, run the `CodeQL: Mock GitHub API Server: Cancel Scenario Recording` command.
183
+
184
+
#### Scenario data location
185
+
186
+
Pre-recorded scenarios are stored in `./src/mocks/scenarios`. However, it's possible to configure the location, by setting the `codeQL.mockGitHubApiServer.scenariosPath` configuration property in the VS Code user settings.
187
+
147
188
## Releasing (write access required)
148
189
149
190
1. Double-check the `CHANGELOG.md` contains all desired change comments and has the version to be released with date at the top.
0 commit comments