wolfi-dev / wolfictl

A CLI used to work with the Wolfi OSS project
Apache License 2.0
52 stars 46 forks source link

test: flaky TestCreate/creating_additional_advisory_for_package #975

Open hectorj2f opened 1 week ago

hectorj2f commented 1 week ago

Description

It seems there is a flaky test on the test suite of the advisories functions. I ran the test locally and it passed but I got an error on the CI here: https://github.com/wolfi-dev/wolfictl/actions/runs/9596890702/job/26464754752?pr=974#step:8:50.

TestCreate/creating_additional_advisory_for_package
    create_test.go:221: Update() mismatch (-want +got):
          v2.Document{
            SchemaVersion: "2.0.2",
            Package:       {Name: "brotli"},
            Advisories: v2.Advisories{
        -       {
        -           ID:      "CGA-xoxo-xoxo-xoxo2",
        -           Aliases: []string{"CVE-2023-1234"},
        -           Events:  []v2.Event{{Timestamp: s"2022-09-26T00:00:00Z", Type: "detection", Data: v2.Detection{...}}},
        -       },
                {Aliases: {"CVE-2020-8927"}, Events: {{Timestamp: s"2022-09-15T02:40:18Z", Type: "fixed", Data: v2.Fixed{FixedVersion: "1.0.9-r0"}}}, ...},
        +       {
        +           ID:      "CGA-xr[44](https://github.com/wolfi-dev/wolfictl/actions/runs/9596890702/job/26464754752?pr=974#step:8:45)-c573-6rmw",
        +           Aliases: []string{"CVE-2023-1234"},
        +           Events:  []v2.Event{{Timestamp: s"2022-09-26T00:00:00Z", Type: "detection", Data: v2.Detection{...}}},
        +       },
            },
          }
luhring commented 1 week ago

The best option might be to update CreateOptions to allow the caller to override how CGA IDs are generated (and do the same for Update, too)