|
7 | 7 | "io" |
8 | 8 | "os" |
9 | 9 | "path/filepath" |
| 10 | + "regexp" |
10 | 11 | "testing" |
11 | 12 |
|
12 | 13 | "github.com/paketo-buildpacks/packit/v2" |
@@ -173,34 +174,42 @@ func testBuild(t *testing.T, context spec.G, it spec.S) { |
173 | 174 | Expect(spdx.Extension).To(Equal("spdx.json")) |
174 | 175 | content, err = io.ReadAll(spdx.Content) |
175 | 176 | Expect(err).NotTo(HaveOccurred()) |
176 | | - Expect(string(content)).To(MatchJSON(`{ |
| 177 | + |
| 178 | + versionPattern := regexp.MustCompile(`"licenseListVersion": "\d+\.\d+"`) |
| 179 | + contentReplaced := versionPattern.ReplaceAllString(string(content), `"licenseListVersion": "x.x"`) |
| 180 | + |
| 181 | + uuidRegex := regexp.MustCompile(`[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}`) |
| 182 | + |
| 183 | + contentReplaced = uuidRegex.ReplaceAllString(contentReplaced, "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx") |
| 184 | + |
| 185 | + Expect(string(contentReplaced)).To(MatchJSON(`{ |
177 | 186 | "SPDXID": "SPDXRef-DOCUMENT", |
178 | 187 | "creationInfo": { |
179 | 188 | "created": "0001-01-01T00:00:00Z", |
180 | 189 | "creators": [ |
181 | 190 | "Organization: Anchore, Inc", |
182 | 191 | "Tool: -" |
183 | 192 | ], |
184 | | - "licenseListVersion": "3.27" |
| 193 | + "licenseListVersion": "x.x" |
185 | 194 | }, |
186 | | - "packages": [ |
187 | | - { |
188 | | - "SPDXID": "SPDXRef-DocumentRoot-Unknown-", |
189 | | - "copyrightText": "NOASSERTION", |
190 | | - "downloadLocation": "NOASSERTION", |
191 | | - "filesAnalyzed": false, |
192 | | - "licenseConcluded": "NOASSERTION", |
193 | | - "licenseDeclared": "NOASSERTION", |
194 | | - "name": "", |
195 | | - "supplier": "NOASSERTION" |
196 | | - } |
197 | | - ], |
198 | 195 | "dataLicense": "CC0-1.0", |
199 | | - "documentNamespace": "https://paketo.io/unknown-source-type/unknown-33ef57ff-45c2-53a8-8899-1c2b7e94d0dd", |
| 196 | + "documentNamespace": "https://paketo.io/unknown-source-type/unknown-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", |
200 | 197 | "name": "unknown", |
| 198 | + "packages": [ |
| 199 | + { |
| 200 | + "SPDXID": "SPDXRef-DocumentRoot-Unknown-", |
| 201 | + "copyrightText": "NOASSERTION", |
| 202 | + "downloadLocation": "NOASSERTION", |
| 203 | + "filesAnalyzed": false, |
| 204 | + "licenseConcluded": "NOASSERTION", |
| 205 | + "licenseDeclared": "NOASSERTION", |
| 206 | + "name": "", |
| 207 | + "supplier": "NOASSERTION" |
| 208 | + } |
| 209 | + ], |
201 | 210 | "relationships": [ |
202 | 211 | { |
203 | | - "relatedSpdxElement": "SPDXRef-DocumentRoot-Unknown-", |
| 212 | + "relatedSpdxElement": "SPDXRef-DocumentRoot-Unknown-", |
204 | 213 | "relationshipType": "DESCRIBES", |
205 | 214 | "spdxElementId": "SPDXRef-DOCUMENT" |
206 | 215 | } |
|
0 commit comments