diff options
| author | Tatiana Bradley <tatianabradley@google.com> | 2023-03-27 13:58:29 -0400 |
|---|---|---|
| committer | Tatiana Bradley <tatianabradley@google.com> | 2023-03-31 15:58:35 +0000 |
| commit | 7cbedde7aaed16e0077ddb9734441c679df6bca0 (patch) | |
| tree | e9c8f6f8d29fb2ae20d59717020e857ad9f25318 /devtools | |
| parent | 01318bc789d263c017ceefc55febc4cef825c343 (diff) | |
| download | go-x-pkgsite-7cbedde7aaed16e0077ddb9734441c679df6bca0.tar.xz | |
devtools,tests/screentest: use vulndb v1 for screentests
Update screentests to run against the vulndb v1 schema instead of
the legacy schema by turning on the v1 experiment in the screentest
config.
Add a folder, vulndb-v1, containing test data for the v1 schema and
point to it for screentests. Also, add a script that can be used to
update this testdata.
Change-Id: Ia94ae4d125233e0c275b5abbfb22c2043e34f05f
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/479656
TryBot-Result: kokoro <noreply+kokoro@google.com>
Run-TryBot: Tatiana Bradley <tatianabradley@google.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
Diffstat (limited to 'devtools')
| -rwxr-xr-x | devtools/snapshot_vulndb_v1.sh | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/devtools/snapshot_vulndb_v1.sh b/devtools/snapshot_vulndb_v1.sh new file mode 100755 index 00000000..077d2c46 --- /dev/null +++ b/devtools/snapshot_vulndb_v1.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env -S bash -e + +# Copyright 2023 The Go Authors. All rights reserved. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. + +source devtools/lib.sh || { echo "Are you at repo root?"; exit 1; } + +# Script for copying the latest data from the v1 schema in +# vuln.go.dev for the tests in tests/screentest/testcases.ci.txt. + +origin="https://vuln.go.dev" + +copyFiles=( + "ID/GO-2021-0159.json" + "ID/GO-2022-0229.json" + "ID/GO-2022-0463.json" + "ID/GO-2022-0569.json" + "ID/GO-2022-0572.json" + "ID/GO-2021-0068.json" + "ID/GO-2022-0475.json" + "ID/GO-2022-0476.json" + "ID/GO-2021-0240.json" + "ID/GO-2021-0264.json" + "ID/GO-2022-0273.json" +) + +go install golang.org/x/vulndb/cmd/indexdb@latest + +OUT_DIR=$(pwd)/tests/screentest/testdata/vulndb-v1 + +for f in ${copyFiles[@]}; do + mkdir -p "$OUT_DIR/$(dirname $f)" && curl -L $origin/$f --output $OUT_DIR/$f +done + +vulns="$OUT_DIR/ID" +indexdb -out $OUT_DIR -vulns $vulns
\ No newline at end of file |
