Add test for model packs in MRVA to test plan

This commit is contained in:
Koen Vlaswinkel 2024-02-16 13:45:35 +01:00
Родитель d2f4cd12a1
Коммит abda1baca7
2 изменённых файлов: 42 добавлений и 0 удалений

Двоичные данные
docs/images/model-pack-results-table.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 10 KiB

Просмотреть файл

@ -145,6 +145,48 @@ Run one of the above MRVAs, but cancel it from within VS Code:
- Check that the workflow run is also canceled.
- Check that any available results are visible in VS Code.
#### Test Case 6: Using model packs in MRVA
1. Create a model pack with mock data
1. Create a new directory `test-model-pack`
2. Create a `qlpack.yml` file in that directory with the following contents:
```yaml
name: github/test-model-pack
version: 0.0.0
library: true
extensionTargets:
codeql/python-all: '*'
dataExtensions:
- extension.yml
```
3. Create an `extension.yml` in the same directory with the following contents:
```yaml
extensions:
- addsTo:
pack: codeql/python-all
extensible: sinkModel
data:
- ["vscode-codeql","Member[initialize].Argument[0]","code-injection"]
```
2. In a Python query pack, create the following query (e.g. `sinks.ql`):
```ql
import python
import semmle.python.frameworks.data.internal.ApiGraphModelsExtensions
from string path, string kind
where sinkModel("vscode-codeql", path, kind)
select path, kind
```
3. Run a MRVA against a Python repository (e.g. `psf/requests`) with this query.
4. Check that the results view contains 1 result with the values corresponding to the `extension.yml` file:
![Model packs results table for `psf/requests`](images/model-pack-results-table.png)
### CodeQL Model Editor
#### Test Case 1: Opening the model editor