Skip to content
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

fix(redhat_osv): restructure test data #308

Merged

Conversation

andrewpollock
Copy link
Collaborator

This commit restructures the test data so that CSAF and OSV data is not co-mingled in the same directory. It is an attept to address

$ go install github.com/ossf/osv-schema/tools/osv-linter@latest
go: downloading github.com/ossf/osv-schema v1.6.7
go: github.com/ossf/osv-schema/tools/osv-linter@latest: create zip: tools/redhat/testdata/rhsa-2024_4546.json: case-insensitive file name collision: "tools/redhat/testdata/RHSA-2024_4546.json" and "tools/redhat/testdata/rhsa-2024_4546.json"

This commit restructures the test data so that CSAF and OSV data is not
co-mingled in the same directory. It is an attept to address

```
$ go install github.com/ossf/osv-schema/tools/osv-linter@latest
go: downloading github.com/ossf/osv-schema v1.6.7
go: github.com/ossf/osv-schema/tools/osv-linter@latest: create zip: tools/redhat/testdata/rhsa-2024_4546.json: case-insensitive file name collision: "tools/redhat/testdata/RHSA-2024_4546.json" and "tools/redhat/testdata/rhsa-2024_4546.json"
```

Signed-off-by: Andrew Pollock <[email protected]>
@andrewpollock
Copy link
Collaborator Author

@jasinner FYI, also what's the go with "test_date" here?

osv = OSV(csaf, "test_date")

@jasinner
Copy link
Contributor

jasinner commented Nov 5, 2024

Looks good to me. If we wanted to match more closely with the filenames produced by the redhat_osv converter we could change the expected output filename to use a colon like 'RHSA-2024:6220.json'. I just didn't do that because the colon character needs to be escaped in a Linux shell.

@jasinner
Copy link
Contributor

jasinner commented Nov 5, 2024

what's the go with "test_date" here?

The short version is that the date is not used in the test. The long version is that the 'modified' date used in the OSV class is passed into the converter instead of being calculated based on the current time. When we do the conversion of the CSAF data we use the modified date from the CSAF data directly because that value is also used to determine if the content has changed or not since the last update.

This has the unfortunate side affect that if the OSV data is regenerated with new conversion code the modified date of the OSV records will not be updated.

This commit adds a link to additional context for posterity.

I personally found this line odd and confusing and received an explanation,
so figured not to let it go to waste...
Signed-off-by: Andrew Pollock <[email protected]>
@andrewpollock andrewpollock merged commit 4220311 into ossf:main Nov 5, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants