| 1 | { |
| 2 | "$schema": "https://packageurl.org/schemas/purl-test.schema-0.1.json", |
| 3 | "tests": [ |
| 4 | { |
| 5 | "description": "docker uses qualifiers and hash image id as versions. Roundtrip an input purl wrongly percent encoded to canonical.", |
| 6 | "test_group": "advanced", |
| 7 | "test_type": "roundtrip", |
| 8 | "input": "pkg:docker/customer/dockerimage@sha256%3A244fd47e07d1004f0aed9c?repository_url=gcr.io", |
| 9 | "expected_output": "pkg:docker/customer/dockerimage@sha256:244fd47e07d1004f0aed9c?repository_url=gcr.io", |
| 10 | "expected_failure": false, |
| 11 | "expected_failure_reason": null |
| 12 | }, |
| 13 | { |
| 14 | "description": "docker uses qualifiers and hash image id as versions", |
| 15 | "test_group": "base", |
| 16 | "test_type": "parse", |
| 17 | "input": "pkg:docker/customer/dockerimage@sha256:244fd47e07d1004f0aed9c?repository_url=gcr.io", |
| 18 | "expected_output": { |
| 19 | "type": "docker", |
| 20 | "namespace": "customer", |
| 21 | "name": "dockerimage", |
| 22 | "version": "sha256:244fd47e07d1004f0aed9c", |
| 23 | "qualifiers": { |
| 24 | "repository_url": "gcr.io" |
| 25 | }, |
| 26 | "subpath": null |
| 27 | }, |
| 28 | "expected_failure": false, |
| 29 | "expected_failure_reason": null |
| 30 | }, |
| 31 | { |
| 32 | "description": "docker uses qualifiers and hash image id as versions. Roundtrip a canonical input to canonical output.", |
| 33 | "test_group": "base", |
| 34 | "test_type": "roundtrip", |
| 35 | "input": "pkg:docker/customer/dockerimage@sha256:244fd47e07d1004f0aed9c?repository_url=gcr.io", |
| 36 | "expected_output": "pkg:docker/customer/dockerimage@sha256:244fd47e07d1004f0aed9c?repository_url=gcr.io", |
| 37 | "expected_failure": false, |
| 38 | "expected_failure_reason": null |
| 39 | }, |
| 40 | { |
| 41 | "description": "docker uses qualifiers and hash image id as versions", |
| 42 | "test_group": "base", |
| 43 | "test_type": "build", |
| 44 | "input": { |
| 45 | "type": "docker", |
| 46 | "namespace": "customer", |
| 47 | "name": "dockerimage", |
| 48 | "version": "sha256:244fd47e07d1004f0aed9c", |
| 49 | "qualifiers": { |
| 50 | "repository_url": "gcr.io" |
| 51 | }, |
| 52 | "subpath": null |
| 53 | }, |
| 54 | "expected_output": "pkg:docker/customer/dockerimage@sha256:244fd47e07d1004f0aed9c?repository_url=gcr.io", |
| 55 | "expected_failure": false, |
| 56 | "expected_failure_reason": null |
| 57 | }, |
| 58 | { |
| 59 | "description": "Parse test for PURL type: docker", |
| 60 | "test_group": "base", |
| 61 | "test_type": "parse", |
| 62 | "input": "pkg:docker/cassandra@latest", |
| 63 | "expected_output": { |
| 64 | "type": "docker", |
| 65 | "namespace": null, |
| 66 | "name": "cassandra", |
| 67 | "version": "latest", |
| 68 | "qualifiers": null, |
| 69 | "subpath": null |
| 70 | }, |
| 71 | "expected_failure": false, |
| 72 | "expected_failure_reason": null |
| 73 | }, |
| 74 | { |
| 75 | "description": "Roundtrip test for PURL type: docker", |
| 76 | "test_group": "base", |
| 77 | "test_type": "roundtrip", |
| 78 | "input": "pkg:docker/cassandra@latest", |
| 79 | "expected_output": "pkg:docker/cassandra@latest", |
| 80 | "expected_failure": false, |
| 81 | "expected_failure_reason": null |
| 82 | }, |
| 83 | { |
| 84 | "description": "Build test for PURL type: docker", |
| 85 | "test_group": "base", |
| 86 | "test_type": "build", |
| 87 | "input": { |
| 88 | "type": "docker", |
| 89 | "namespace": null, |
| 90 | "name": "cassandra", |
| 91 | "version": "latest", |
| 92 | "qualifiers": null, |
| 93 | "subpath": null |
| 94 | }, |
| 95 | "expected_output": "pkg:docker/cassandra@latest", |
| 96 | "expected_failure": false, |
| 97 | "expected_failure_reason": null |
| 98 | }, |
| 99 | { |
| 100 | "description": "Parse test for PURL type: docker", |
| 101 | "test_group": "base", |
| 102 | "test_type": "parse", |
| 103 | "input": "pkg:docker/smartentry/debian@dc437cc87d10", |
| 104 | "expected_output": { |
| 105 | "type": "docker", |
| 106 | "namespace": "smartentry", |
| 107 | "name": "debian", |
| 108 | "version": "dc437cc87d10", |
| 109 | "qualifiers": null, |
| 110 | "subpath": null |
| 111 | }, |
| 112 | "expected_failure": false, |
| 113 | "expected_failure_reason": null |
| 114 | }, |
| 115 | { |
| 116 | "description": "Roundtrip test for PURL type: docker", |
| 117 | "test_group": "base", |
| 118 | "test_type": "roundtrip", |
| 119 | "input": "pkg:docker/smartentry/debian@dc437cc87d10", |
| 120 | "expected_output": "pkg:docker/smartentry/debian@dc437cc87d10", |
| 121 | "expected_failure": false, |
| 122 | "expected_failure_reason": null |
| 123 | }, |
| 124 | { |
| 125 | "description": "Build test for PURL type: docker", |
| 126 | "test_group": "base", |
| 127 | "test_type": "build", |
| 128 | "input": { |
| 129 | "type": "docker", |
| 130 | "namespace": "smartentry", |
| 131 | "name": "debian", |
| 132 | "version": "dc437cc87d10", |
| 133 | "qualifiers": null, |
| 134 | "subpath": null |
| 135 | }, |
| 136 | "expected_output": "pkg:docker/smartentry/debian@dc437cc87d10", |
| 137 | "expected_failure": false, |
| 138 | "expected_failure_reason": null |
| 139 | }, |
| 140 | { |
| 141 | "description": "Parse test for PURL type: docker", |
| 142 | "test_group": "base", |
| 143 | "test_type": "parse", |
| 144 | "input": "pkg:docker/customer/dockerimage@sha256:244fd47e07d10?repository_url=gcr.io", |
| 145 | "expected_output": { |
| 146 | "type": "docker", |
| 147 | "namespace": "customer", |
| 148 | "name": "dockerimage", |
| 149 | "version": "sha256:244fd47e07d10", |
| 150 | "qualifiers": { |
| 151 | "repository_url": "gcr.io" |
| 152 | }, |
| 153 | "subpath": null |
| 154 | }, |
| 155 | "expected_failure": false, |
| 156 | "expected_failure_reason": null |
| 157 | }, |
| 158 | { |
| 159 | "description": "Roundtrip test for PURL type: docker", |
| 160 | "test_group": "base", |
| 161 | "test_type": "roundtrip", |
| 162 | "input": "pkg:docker/customer/dockerimage@sha256:244fd47e07d10?repository_url=gcr.io", |
| 163 | "expected_output": "pkg:docker/customer/dockerimage@sha256:244fd47e07d10?repository_url=gcr.io", |
| 164 | "expected_failure": false, |
| 165 | "expected_failure_reason": null |
| 166 | }, |
| 167 | { |
| 168 | "description": "Build test for PURL type: docker", |
| 169 | "test_group": "base", |
| 170 | "test_type": "build", |
| 171 | "input": { |
| 172 | "type": "docker", |
| 173 | "namespace": "customer", |
| 174 | "name": "dockerimage", |
| 175 | "version": "sha256:244fd47e07d10", |
| 176 | "qualifiers": { |
| 177 | "repository_url": "gcr.io" |
| 178 | }, |
| 179 | "subpath": null |
| 180 | }, |
| 181 | "expected_output": "pkg:docker/customer/dockerimage@sha256:244fd47e07d10?repository_url=gcr.io", |
| 182 | "expected_failure": false, |
| 183 | "expected_failure_reason": null |
| 184 | } |
| 185 | ] |
| 186 | } |