Skip to content

Commit

Permalink
Copy the latest test data from master and stop downloading the test d…
Browse files Browse the repository at this point in the history
…ata during the test action.

This was confusing as there were multiple sources of truth for the test data, one of which was not used.
There is only one now.
  • Loading branch information
Octogonapus committed Jun 15, 2023
1 parent 8907843 commit 1f567e3
Show file tree
Hide file tree
Showing 4 changed files with 243 additions and 57 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ jobs:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
- name: Download test data
run: curl -L https://raw.githubusercontent.com/package-url/purl-spec/master/test-suite-data.json -o testdata/test-suite-data.json
- name: Test go fmt
run: test -z $(go fmt ./...)
- name: Golangci-lint
Expand All @@ -30,4 +28,4 @@ jobs:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
GO111MODULE=off go get github.com/mattn/goveralls
$(go env GOPATH)/bin/goveralls -coverprofile=profile.cov -service=github
$(go env GOPATH)/bin/goveralls -coverprofile=profile.cov -service=github
4 changes: 0 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
.PHONY: test clean lint

test:
curl -L https://raw.githubusercontent.com/package-url/purl-spec/master/test-suite-data.json -o testdata/test-suite-data.json
go test -v -cover ./...

clean:
find . -name "test-suite-data.json" | xargs rm -f

lint:
go get -u golang.org/x/lint/golint
golint -set_exit_status
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,16 @@ Testing using the normal ``go test`` command. Using ``make test`` will pull the

```
$ make test
curl -L https://raw.githubusercontent.com/package-url/purl-test-suite/master/test-suite-data.json -o testdata/test-suite-data.json
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 7181 100 7181 0 0 1202 0 0:00:05 0:00:05 --:--:-- 1611
go test -v -cover ./...
=== RUN TestFromStringExamples
--- PASS: TestFromStringExamples (0.00s)
=== RUN TestToStringExamples
--- PASS: TestToStringExamples (0.00s)
=== RUN TestStringer
--- PASS: TestStringer (0.00s)
=== RUN TestQualifiersMapConversion
--- PASS: TestQualifiersMapConversion (0.00s)
PASS
coverage: 94.7% of statements
ok github.com/package-url/packageurl-go 0.002s
coverage: 90.7% of statements
ok github.com/package-url/packageurl-go 0.004s coverage: 90.7% of statements
```
280 changes: 236 additions & 44 deletions testdata/test-suite-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,6 @@
"subpath": "googleapis/api/annotations",
"is_invalid": false
},
{
"description": "valid go purl with namespace that has a forward slash",
"purl": "pkg:golang/github.com/etcd-io/etcd@v2.4.0",
"canonical_purl": "pkg:golang/github.com/etcd-io/etcd@v2.4.0",
"type": "golang",
"namespace": "github.com/etcd-io",
"name": "etcd",
"version": "v2.4.0",
"qualifiers": null,
"subpath": null,
"is_invalid": false
},
{
"description": "bitbucket namespace and name should be lowercased",
"purl": "pkg:bitbucket/birKenfeld/pyGments-main@244fd47e07d1014f0aed9c",
Expand Down Expand Up @@ -91,7 +79,7 @@
"namespace": "debian",
"name": "curl",
"version": "7.50.3-1",
"qualifiers": {"arch": "i386","distro": "jessie"},
"qualifiers": {"arch": "i386", "distro": "jessie"},
"subpath": null,
"is_invalid": false
},
Expand Down Expand Up @@ -127,7 +115,7 @@
"namespace": "org.apache.xmlgraphics",
"name": "batik-anim",
"version": "1.9.1",
"qualifiers": {"classifier": "sources","repository_url": "repo.spring.io/release"},
"qualifiers": {"classifier": "sources", "repository_url": "repo.spring.io/release"},
"subpath": null,
"is_invalid": false
},
Expand All @@ -139,7 +127,7 @@
"namespace": "org.apache.xmlgraphics",
"name": "batik-anim",
"version": "1.9.1",
"qualifiers": {"extension": "pom","repository_url": "repo.spring.io/release"},
"qualifiers": {"extension": "pom", "repository_url": "repo.spring.io/release"},
"subpath": null,
"is_invalid": false
},
Expand All @@ -151,7 +139,7 @@
"namespace": "net.sf.jacob-project",
"name": "jacob",
"version": "1.14.3",
"qualifiers": {"classifier": "x86","type": "dll"},
"qualifiers": {"classifier": "x86", "type": "dll"},
"subpath": null,
"is_invalid": false
},
Expand Down Expand Up @@ -199,7 +187,7 @@
"namespace": "fedora",
"name": "curl",
"version": "7.50.3-1.fc25",
"qualifiers": {"arch": "i386","distro": "fedora-25"},
"qualifiers": {"arch": "i386", "distro": "fedora-25"},
"subpath": null,
"is_invalid": false
},
Expand Down Expand Up @@ -312,49 +300,253 @@
"is_invalid": true
},
{
"description": "namespace can contain special characters",
"purl": "pkg:npm/%40foo%40%3F%23/bar@1.0.0",
"canonical_purl": "pkg:npm/%40foo%40%3F%23/bar@1.0.0",
"type": "npm",
"namespace": "@foo@?#",
"name": "bar",
"version": "1.0.0",
"description": "valid conan purl",
"purl": "pkg:conan/cctz@2.3",
"canonical_purl": "pkg:conan/cctz@2.3",
"type": "conan",
"namespace": null,
"name": "cctz",
"version": "2.3",
"qualifiers": null,
"subpath": null,
"is_invalid": false
},
{
"description": "name can contain special characters (with namespace)",
"purl": "pkg:npm/%40foo/bar%40%3F%23@1.0.0",
"canonical_purl": "pkg:npm/%40foo/bar%40%3F%23@1.0.0",
"type": "npm",
"namespace": "@foo",
"name": "bar@?#",
"version": "1.0.0",
"description": "valid conan purl with namespace and qualifier channel",
"purl": "pkg:conan/bincrafters/cctz@2.3?channel=stable",
"canonical_purl": "pkg:conan/bincrafters/cctz@2.3?channel=stable",
"type": "conan",
"namespace": "bincrafters",
"name": "cctz",
"version": "2.3",
"qualifiers": {"channel": "stable"},
"subpath": null,
"is_invalid": false
},
{
"description": "invalid conan purl only namespace",
"purl": "pkg:conan/bincrafters/cctz@2.3",
"canonical_purl": "pkg:conan/bincrafters/cctz@2.3",
"type": "conan",
"namespace": "bincrafters",
"name": "cctz",
"version": "2.3",
"qualifiers": null,
"subpath": null,
"is_invalid": true
},
{
"description": "invalid conan purl only channel qualifier",
"purl": "pkg:conan/cctz@2.3?channel=stable",
"canonical_purl": "pkg:conan/cctz@2.3?channel=stable",
"type": "conan",
"namespace": null,
"name": "cctz",
"version": "2.3",
"qualifiers": {"channel": "stable"},
"subpath": null,
"is_invalid": true
},
{
"description": "valid conda purl with qualifiers",
"purl": "pkg:conda/absl-py@0.4.1?build=py36h06a4308_0&channel=main&subdir=linux-64&type=tar.bz2",
"canonical_purl": "pkg:conda/absl-py@0.4.1?build=py36h06a4308_0&channel=main&subdir=linux-64&type=tar.bz2",
"type": "conda",
"namespace": null,
"name": "absl-py",
"version": "0.4.1",
"qualifiers": {"build": "py36h06a4308_0", "channel": "main", "subdir": "linux-64", "type": "tar.bz2"},
"subpath": null,
"is_invalid": false
},
{
"description": "name can contain special characters (without namespace)",
"purl": "pkg:npm/bar%40%3F%23@1.0.0",
"canonical_purl": "pkg:npm/bar%40%3F%23@1.0.0",
"type": "npm",
"description": "valid cran purl",
"purl": "pkg:cran/A3@0.9.1",
"canonical_purl": "pkg:cran/A3@0.9.1",
"type": "cran",
"namespace": null,
"name": "bar@?#",
"version": "1.0.0",
"name": "A3",
"version": "0.9.1",
"qualifiers": null,
"subpath": null,
"is_invalid": false
},
{
"description": "version can contain special characters",
"purl": "pkg:npm/%40foo/bar@1.0.0-%40%3F%23",
"canonical_purl": "pkg:npm/%40foo/bar@1.0.0-%40%3F%23",
"type": "npm",
"namespace": "@foo",
"name": "bar",
"version": "1.0.0-@?#",
"description": "invalid cran purl without name",
"purl": "pkg:cran/@0.9.1",
"canonical_purl": "pkg:cran/@0.9.1",
"type": "cran",
"namespace": null,
"name": null,
"version": "0.9.1",
"qualifiers": null,
"subpath": null,
"is_invalid": true
},
{
"description": "invalid cran purl without version",
"purl": "pkg:cran/A3",
"canonical_purl": "pkg:cran/A3",
"type": "cran",
"namespace": null,
"name": "A3",
"version": null,
"qualifiers": null,
"subpath": null,
"is_invalid": true
},
{
"description": "valid swift purl",
"purl": "pkg:swift/github.com/Alamofire/Alamofire@5.4.3",
"canonical_purl": "pkg:swift/github.com/Alamofire/Alamofire@5.4.3",
"type": "swift",
"namespace": "github.com/Alamofire",
"name": "Alamofire",
"version": "5.4.3",
"qualifiers": null,
"subpath": null,
"is_invalid": false
},
{
"description": "invalid swift purl without namespace",
"purl": "pkg:swift/Alamofire@5.4.3",
"canonical_purl": "pkg:swift/Alamofire@5.4.3",
"type": "swift",
"namespace": null,
"name": "Alamofire",
"version": "5.4.3",
"qualifiers": null,
"subpath": null,
"is_invalid": true
},
{
"description": "invalid swift purl without name",
"purl": "pkg:swift/github.com/Alamofire/@5.4.3",
"canonical_purl": "pkg:swift/github.com/Alamofire/@5.4.3",
"type": "swift",
"namespace": "github.com/Alamofire",
"name": null,
"version": "5.4.3",
"qualifiers": null,
"subpath": null,
"is_invalid": true
},
{
"description": "invalid swift purl without version",
"purl": "pkg:swift/github.com/Alamofire/Alamofire",
"canonical_purl": "pkg:swift/github.com/Alamofire/Alamofire",
"type": "swift",
"namespace": "github.com/Alamofire",
"name": "Alamofire",
"version": null,
"qualifiers": null,
"subpath": null,
"is_invalid": true
},
{
"description": "valid hackage purl",
"purl": "pkg:hackage/AC-HalfInteger@1.2.1",
"canonical_purl": "pkg:hackage/AC-HalfInteger@1.2.1",
"type": "hackage",
"namespace": null,
"name": "AC-HalfInteger",
"version": "1.2.1",
"qualifiers": null,
"subpath": null,
"is_invalid": false
},
{
"description": "name and version are always required",
"purl": "pkg:hackage",
"canonical_purl": "pkg:hackage",
"type": "hackage",
"namespace": null,
"name": null,
"version": null,
"qualifiers": null,
"subpath": null,
"is_invalid": true
},
{
"description": "minimal Hugging Face model",
"purl": "pkg:huggingface/distilbert-base-uncased@043235d6088ecd3dd5fb5ca3592b6913fd516027",
"canonical_purl": "pkg:huggingface/distilbert-base-uncased@043235d6088ecd3dd5fb5ca3592b6913fd516027",
"type": "huggingface",
"namespace": null,
"name": "distilbert-base-uncased",
"version": "043235d6088ecd3dd5fb5ca3592b6913fd516027",
"qualifiers": null,
"subpath": null,
"is_invalid": false
},
{
"description": "Hugging Face model with staging endpoint",
"purl": "pkg:huggingface/microsoft/deberta-v3-base@559062ad13d311b87b2c455e67dcd5f1c8f65111?repository_url=https://hub-ci.huggingface.co",
"canonical_purl": "pkg:huggingface/microsoft/deberta-v3-base@559062ad13d311b87b2c455e67dcd5f1c8f65111?repository_url=https://hub-ci.huggingface.co",
"type": "huggingface",
"namespace": "microsoft",
"name": "deberta-v3-base",
"version": "559062ad13d311b87b2c455e67dcd5f1c8f65111",
"qualifiers": {"repository_url": "https://hub-ci.huggingface.co"},
"subpath": null,
"is_invalid": false
},
{
"description": "Hugging Face model with various cases",
"purl": "pkg:huggingface/EleutherAI/gpt-neo-1.3B@797174552AE47F449AB70B684CABCB6603E5E85E",
"canonical_purl": "pkg:huggingface/EleutherAI/gpt-neo-1.3B@797174552ae47f449ab70b684cabcb6603e5e85e",
"type": "huggingface",
"namespace": "EleutherAI",
"name": "gpt-neo-1.3B",
"version": "797174552ae47f449ab70b684cabcb6603e5e85e",
"qualifiers": null,
"subpath": null,
"is_invalid": false
},
{
"description": "MLflow model tracked in Azure Databricks (case insensitive)",
"purl": "pkg:mlflow/CreditFraud@3?repository_url=https://adb-5245952564735461.0.azuredatabricks.net/api/2.0/mlflow",
"canonical_purl": "pkg:mlflow/creditfraud@3?repository_url=https://adb-5245952564735461.0.azuredatabricks.net/api/2.0/mlflow",
"type": "mlflow",
"namespace": null,
"name": "creditfraud",
"version": "3",
"qualifiers": {"repository_url": "https://adb-5245952564735461.0.azuredatabricks.net/api/2.0/mlflow"},
"subpath": null,
"is_invalid": false
},
{
"description": "MLflow model tracked in Azure ML (case sensitive)",
"purl": "pkg:mlflow/CreditFraud@3?repository_url=https://westus2.api.azureml.ms/mlflow/v1.0/subscriptions/a50f2011-fab8-4164-af23-c62881ef8c95/resourceGroups/TestResourceGroup/providers/Microsoft.MachineLearningServices/workspaces/TestWorkspace",
"canonical_purl": "pkg:mlflow/CreditFraud@3?repository_url=https://westus2.api.azureml.ms/mlflow/v1.0/subscriptions/a50f2011-fab8-4164-af23-c62881ef8c95/resourceGroups/TestResourceGroup/providers/Microsoft.MachineLearningServices/workspaces/TestWorkspace",
"type": "mlflow",
"namespace": null,
"name": "CreditFraud",
"version": "3",
"qualifiers": {"repository_url": "https://westus2.api.azureml.ms/mlflow/v1.0/subscriptions/a50f2011-fab8-4164-af23-c62881ef8c95/resourceGroups/TestResourceGroup/providers/Microsoft.MachineLearningServices/workspaces/TestWorkspace"},
"subpath": null,
"is_invalid": false
},
{
"description": "MLflow model with unique identifiers",
"purl": "pkg:mlflow/trafficsigns@10?model_uuid=36233173b22f4c89b451f1228d700d49&run_id=410a3121-2709-4f88-98dd-dba0ef056b0a&repository_url=https://adb-5245952564735461.0.azuredatabricks.net/api/2.0/mlflow",
"canonical_purl": "pkg:mlflow/trafficsigns@10?model_uuid=36233173b22f4c89b451f1228d700d49&repository_url=https://adb-5245952564735461.0.azuredatabricks.net/api/2.0/mlflow&run_id=410a3121-2709-4f88-98dd-dba0ef056b0a",
"type": "mlflow",
"namespace": null,
"name": "trafficsigns",
"version": "10",
"qualifiers": {"model_uuid": "36233173b22f4c89b451f1228d700d49", "run_id": "410a3121-2709-4f88-98dd-dba0ef056b0a", "repository_url": "https://adb-5245952564735461.0.azuredatabricks.net/api/2.0/mlflow"},
"subpath": null,
"is_invalid": false
},
{
"description": "composer names are not case sensitive",
"purl": "pkg:composer/Laravel/Laravel@5.5.0",
"canonical_purl": "pkg:composer/laravel/laravel@5.5.0",
"type": "composer",
"namespace": "laravel",
"name": "laravel",
"version": "5.5.0",
"qualifiers": null,
"subpath": null,
"is_invalid": false
Expand Down

0 comments on commit 1f567e3

Please sign in to comment.