Skip to content

Commit c216b52

Browse files
authored
Merge pull request #3370 from github/koesie10/model-pack-mrva-test
Add test for model packs in MRVA to test plan
2 parents 948c1e2 + abda1ba commit c216b52

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed
10.2 KB
Loading

docs/test-plan.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,48 @@ Run one of the above MRVAs, but cancel it from within VS Code:
145145
- Check that the workflow run is also canceled.
146146
- Check that any available results are visible in VS Code.
147147

148+
#### Test Case 6: Using model packs in MRVA
149+
150+
1. Create a model pack with mock data
151+
1. Create a new directory `test-model-pack`
152+
2. Create a `qlpack.yml` file in that directory with the following contents:
153+
154+
```yaml
155+
name: github/test-model-pack
156+
version: 0.0.0
157+
library: true
158+
extensionTargets:
159+
codeql/python-all: '*'
160+
dataExtensions:
161+
- extension.yml
162+
```
163+
164+
3. Create an `extension.yml` in the same directory with the following contents:
165+
166+
```yaml
167+
extensions:
168+
- addsTo:
169+
pack: codeql/python-all
170+
extensible: sinkModel
171+
data:
172+
- ["vscode-codeql","Member[initialize].Argument[0]","code-injection"]
173+
```
174+
175+
2. In a Python query pack, create the following query (e.g. `sinks.ql`):
176+
177+
```ql
178+
import python
179+
import semmle.python.frameworks.data.internal.ApiGraphModelsExtensions
180+
181+
from string path, string kind
182+
where sinkModel("vscode-codeql", path, kind)
183+
select path, kind
184+
```
185+
186+
3. Run a MRVA against a Python repository (e.g. `psf/requests`) with this query.
187+
4. Check that the results view contains 1 result with the values corresponding to the `extension.yml` file:
188+
![Model packs results table for `psf/requests`](images/model-pack-results-table.png)
189+
148190
### CodeQL Model Editor
149191

150192
#### Test Case 1: Opening the model editor

0 commit comments

Comments
 (0)