-
Notifications
You must be signed in to change notification settings - Fork 213
Add validation tests #614
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
TG1999
wants to merge
12
commits into
package-url:main
Choose a base branch
from
TG1999:add_validation_tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add validation tests #614
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
fceb4ce
Add validation tests
TG1999 9f32657
Remove unknown qualifiers check
TG1999 d55e6a7
Add new schema
TG1999 4a6a643
Change input to purl string
TG1999 f01b357
Fix schema and bitbucket tests
TG1999 4970e5a
Fix tests according to new schema
TG1999 f3cc7ae
Update tests
TG1999 9edac14
Update tests
TG1999 5aee9f6
Update tests
TG1999 d474c72
Change test structure
TG1999 c398646
Change error to warning
TG1999 6bc1f30
Merge branch 'main' into add_validation_tests
TG1999 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -135,6 +135,58 @@ | |
| "expected_output": "pkg:alpm/arch/containers-common@1:0.47.4-4?arch=x86_64", | ||
| "expected_failure": false, | ||
| "expected_failure_reason": null | ||
| }, | ||
| { | ||
| "description": "Valid alpm package with arch qualifier", | ||
| "test_group": "base", | ||
| "test_type": "validation", | ||
| "input": "pkg:alpm/arch/[email protected]?arch=x86_64", | ||
| "expected_output": [] | ||
| }, | ||
| { | ||
| "description": "alpm package with uppercase nmamespace", | ||
| "test_group": "base", | ||
| "test_type": "validation", | ||
| "input": "pkg:alpm/Arch/[email protected]?arch=x86_64", | ||
| "expected_output": [ | ||
| { | ||
| "severity": "warning", | ||
| "message": "Namespace is not lowercased for purl type: 'alpm'" | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "description": "alpm package with uppercase nmamespace (advanced)", | ||
| "test_group": "advanced", | ||
| "test_type": "validation", | ||
| "input": "pkg:alpm/Arch/[email protected]?arch=x86_64", | ||
| "expected_output": [] | ||
| }, | ||
| { | ||
| "description": "Valid alpm package with 'any' arch", | ||
| "test_group": "base", | ||
| "test_type": "validation", | ||
| "input": "pkg:alpm/arch/[email protected]?arch=any", | ||
| "expected_output": [] | ||
| }, | ||
| { | ||
| "description": "Valid alpm package with epoch in version", | ||
| "test_group": "advanced", | ||
| "test_type": "validation", | ||
| "input": "pkg:alpm/arch/containers-common@1:0.47.4-4?arch=x86_64", | ||
| "expected_output": [] | ||
| }, | ||
| { | ||
| "description": "alpm package missing namespace", | ||
| "test_group": "base", | ||
| "test_type": "validation", | ||
| "input": "pkg:alpm/[email protected]?arch=x86_64", | ||
| "expected_output": [ | ||
| { | ||
| "severity": "error", | ||
| "message": "Namespace is required for purl type: 'alpm'" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -90,6 +90,62 @@ | |
| "expected_output": "pkg:apk/alpine/[email protected]?arch=x86", | ||
| "expected_failure": false, | ||
| "expected_failure_reason": null | ||
| }, | ||
| { | ||
| "description": "Valid apk package with arch qualifier", | ||
| "test_group": "base", | ||
| "test_type": "validation", | ||
| "input": "pkg:apk/alpine/[email protected]?arch=x86", | ||
| "expected_output": [] | ||
| }, | ||
| { | ||
| "description": "Valid apk package with higher version and arch qualifier", | ||
| "test_group": "base", | ||
| "test_type": "validation", | ||
| "input": "pkg:apk/alpine/[email protected]?arch=x86", | ||
| "expected_output": [] | ||
| }, | ||
| { | ||
| "description": "Valid apk package with openwrt vendor", | ||
| "test_group": "advanced", | ||
| "test_type": "validation", | ||
| "input": "pkg:apk/openwrt/[email protected]?arch=mips", | ||
| "expected_output": [] | ||
| }, | ||
| { | ||
| "description": "apk package missing namespace", | ||
| "test_group": "base", | ||
| "test_type": "validation", | ||
| "input": "pkg:apk/[email protected]?arch=x86", | ||
| "expected_output": [ | ||
| { | ||
| "severity": "error", | ||
| "message": "Namespace is required for purl type: 'apk'" | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "description": "apk package with uppercase namespace and name", | ||
| "test_group": "base", | ||
| "test_type": "validation", | ||
| "input": "pkg:apk/FOO/[email protected]?arch=x86", | ||
| "expected_output": [ | ||
| { | ||
| "severity": "warning", | ||
| "message": "Namespace is not lowercased for purl type: 'apk'" | ||
| }, | ||
| { | ||
| "severity": "warning", | ||
| "message": "Name is not lowercased for purl type: 'apk'" | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "description": "apk package with uppercase namespace and name (advanced)", | ||
| "test_group": "advanced", | ||
| "test_type": "validation", | ||
| "input": "pkg:apk/FOO/[email protected]?arch=x86", | ||
| "expected_output": [] | ||
| } | ||
| ] | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -91,6 +91,39 @@ | |
| "expected_output": "pkg:bitbucket/birkenfeld/pygments-main@244fd47e07d1014f0aed9c", | ||
| "expected_failure": false, | ||
| "expected_failure_reason": null | ||
| }, | ||
| { | ||
| "description": "Valid Bitbucket package with commit hash as version", | ||
| "test_group": "base", | ||
| "test_type": "validation", | ||
| "input": "pkg:bitbucket/birkenfeld/pygments-main@244fd47e07d1014f0aed9c", | ||
| "expected_output": [] | ||
| }, | ||
| { | ||
| "description": "Valid Bitbucket package with subpath", | ||
| "test_group": "base", | ||
| "test_type": "validation", | ||
| "input": "pkg:bitbucket/teamname/[email protected]#src/main", | ||
| "expected_output": [] | ||
| }, | ||
| { | ||
| "description": "Valid Bitbucket package with qualifiers", | ||
| "test_group": "base", | ||
| "test_type": "validation", | ||
| "input": "pkg:bitbucket/company/service@release-2024?arch=x86_64&os=linux", | ||
| "expected_output": [ | ||
| { | ||
| "severity": "info", | ||
| "message": "Invalid qualifiers found: arch, os. Allowed qualifiers are: repository_url" | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "description": "Valid Bitbucket package with qualifiers", | ||
| "test_group": "advanced", | ||
| "test_type": "validation", | ||
| "input": "pkg:bitbucket/company/service@release-2024?arch=x86_64&os=linux", | ||
| "expected_output": [] | ||
| } | ||
| ] | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -184,6 +184,34 @@ | |
| "expected_output": "pkg:bitnami/[email protected]?arch=arm64&distro=photon-4", | ||
| "expected_failure": false, | ||
| "expected_failure_reason": null | ||
| }, | ||
| { | ||
| "description": "Valid Bitnami package without version", | ||
| "test_group": "base", | ||
| "test_type": "validation", | ||
| "input": "pkg:bitnami/wordpress?distro=debian-12", | ||
| "expected_output": [] | ||
| }, | ||
| { | ||
| "description": "Valid Bitnami package with version and distro", | ||
| "test_group": "base", | ||
| "test_type": "validation", | ||
| "input": "pkg:bitnami/[email protected]?distro=debian-12", | ||
| "expected_output": [] | ||
| }, | ||
| { | ||
| "description": "Valid Bitnami package with arch and distro", | ||
| "test_group": "advanced", | ||
| "test_type": "validation", | ||
| "input": "pkg:bitnami/[email protected]?arch=arm64&distro=debian-12", | ||
| "expected_output": [] | ||
| }, | ||
| { | ||
| "description": "Valid Bitnami package with another distro", | ||
| "test_group": "advanced", | ||
| "test_type": "validation", | ||
| "input": "pkg:bitnami/[email protected]?arch=arm64&distro=photon-4", | ||
| "expected_output": [] | ||
| } | ||
| ] | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -123,6 +123,39 @@ | |
| "expected_output": "pkg:cargo/[email protected]", | ||
| "expected_failure": false, | ||
| "expected_failure_reason": null | ||
| }, | ||
| { | ||
| "description": "Valid Cargo package with name and version", | ||
| "test_group": "base", | ||
| "test_type": "validation", | ||
| "input": "pkg:cargo/[email protected]", | ||
| "expected_output": [] | ||
| }, | ||
| { | ||
| "description": "Valid Cargo package with another example", | ||
| "test_group": "base", | ||
| "test_type": "validation", | ||
| "input": "pkg:cargo/[email protected]", | ||
| "expected_output": [] | ||
| }, | ||
| { | ||
| "description": "Cargo package without version", | ||
| "test_group": "advanced", | ||
| "test_type": "validation", | ||
| "input": "pkg:cargo/structopt", | ||
| "expected_output": [] | ||
| }, | ||
| { | ||
| "description": "Cargo package with namespace (not allowed)", | ||
| "test_group": "advanced", | ||
| "test_type": "validation", | ||
| "input": "pkg:cargo/rustlang/[email protected]", | ||
| "expected_output": [ | ||
| { | ||
| "severity": "error", | ||
| "message": "Namespace is prohibited for purl type: 'cargo'" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -164,6 +164,39 @@ | |
| "expected_output": "pkg:cocoapods/[email protected]#NSData%2Bzlib", | ||
| "expected_failure": false, | ||
| "expected_failure_reason": null | ||
| }, | ||
| { | ||
| "description": "Valid CocoaPods package with name and version", | ||
| "test_group": "base", | ||
| "test_type": "validation", | ||
| "input": "pkg:cocoapods/[email protected]", | ||
| "expected_output": [] | ||
| }, | ||
| { | ||
| "description": "Valid CocoaPods package with subspec in subpath", | ||
| "test_group": "base", | ||
| "test_type": "validation", | ||
| "input": "pkg:cocoapods/[email protected]#NSData+zlib", | ||
| "expected_output": [] | ||
| }, | ||
| { | ||
| "description": "CocoaPods package without version", | ||
| "test_group": "advanced", | ||
| "test_type": "validation", | ||
| "input": "pkg:cocoapods/MapsIndoors", | ||
| "expected_output": [] | ||
| }, | ||
| { | ||
| "description": "CocoaPods package with namespace (not allowed)", | ||
| "test_group": "advanced", | ||
| "test_type": "validation", | ||
| "input": "pkg:cocoapods/apple/[email protected]#Twitter", | ||
| "expected_output": [ | ||
| { | ||
| "severity": "error", | ||
| "message": "Namespace is prohibited for purl type: 'cocoapods'" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The definition for the new validation test_type should be: ""A test to validate that an input PURL string complies with the rules for its PURL type."