Skip to content

Commit

Permalink
Sort timestamps with timezones
Browse files Browse the repository at this point in the history
- addresses parts of #749, #341
- clarify that timestamps might have different timezones
- add invalid example for 6.2.6
- add valid examples for 6.2.6
  • Loading branch information
tschmidtb51 committed May 31, 2024
1 parent 9404cda commit 6d7329e
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 0 deletions.
1 change: 1 addition & 0 deletions csaf_2.1/prose/edit/src/tests-02-optional.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ The relevant path for this test is:
### Older Current Release Date than Revision History

It MUST be tested that the Current Release Date is not older than the `date` of the newest item in Revision History.
As the timestamps might use different timezones, the sorting and comparison MUST take timezones into account.

The relevant path for this test is:

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"document": {
"category": "csaf_base",
"csaf_version": "2.1",
"distribution": {
"tlp": {
"label": "CLEAR"
}
},
"publisher": {
"category": "other",
"name": "OASIS CSAF TC",
"namespace": "https://csaf.io"
},
"title": "Optional test: Older Current Release Date than Revision History (failing example 2)",
"tracking": {
"current_release_date": "2024-01-21T11:00:00.000-01:00",
"id": "OASIS_CSAF_TC-CSAF_2.1-2024-6-2-06-02",
"initial_release_date": "2023-09-06T10:00:00.000Z",
"revision_history": [
{
"date": "2023-09-06T10:00:00.000Z",
"number": "1",
"summary": "Initial version."
},
{
"date": "2024-01-21T11:00:00.000+10:00",
"number": "2",
"summary": "Second version."
}
],
"status": "final",
"version": "2"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"document": {
"category": "csaf_base",
"csaf_version": "2.1",
"distribution": {
"tlp": {
"label": "CLEAR"
}
},
"publisher": {
"category": "other",
"name": "OASIS CSAF TC",
"namespace": "https://csaf.io"
},
"title": "Optional test: Older Current Release Date than Revision History (valid example 1)",
"tracking": {
"current_release_date": "2024-01-21T11:00:00.000Z",
"id": "OASIS_CSAF_TC-CSAF_2.1-2024-6-2-06-11",
"initial_release_date": "2023-09-06T10:00:00.000Z",
"revision_history": [
{
"date": "2023-09-06T10:00:00.000Z",
"number": "1",
"summary": "Initial version."
},
{
"date": "2024-01-21T11:00:00.000Z",
"number": "2",
"summary": "Second version."
}
],
"status": "final",
"version": "2"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"document": {
"category": "csaf_base",
"csaf_version": "2.1",
"distribution": {
"tlp": {
"label": "CLEAR"
}
},
"publisher": {
"category": "other",
"name": "OASIS CSAF TC",
"namespace": "https://csaf.io"
},
"title": "Optional test: Older Current Release Date than Revision History (valid example 2)",
"tracking": {
"current_release_date": "2024-01-21T11:00:00.000+10:00",
"id": "OASIS_CSAF_TC-CSAF_2.1-2024-6-2-06-12",
"initial_release_date": "2023-09-06T10:00:00.000Z",
"revision_history": [
{
"date": "2023-09-06T10:00:00.000Z",
"number": "1",
"summary": "Initial version."
},
{
"date": "2024-01-21T11:00:00.000+10:00",
"number": "2",
"summary": "Second version."
}
],
"status": "final",
"version": "2"
}
}
}
14 changes: 14 additions & 0 deletions csaf_2.1/test/validator/data/testcases.json
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,20 @@
{
"name": "optional/oasis_csaf_tc-csaf_2_1-2024-6-2-06-01.json",
"valid": true
},
{
"name": "optional/oasis_csaf_tc-csaf_2_1-2024-6-2-06-02.json",
"valid": true
}
],
"valid": [
{
"name": "optional/oasis_csaf_tc-csaf_2_1-2024-6-2-06-11.json",
"valid": true
},
{
"name": "optional/oasis_csaf_tc-csaf_2_1-2024-6-2-06-12.json",
"valid": true
}
]
},
Expand Down

0 comments on commit 6d7329e

Please sign in to comment.