Skip to content

Conversation

mtardy
Copy link
Member

@mtardy mtardy commented Aug 15, 2025

I felt like that now that we have this separate function with its own regexes, maybe we should have some unit tests so that we have more confidence over touching that code going on and we can add regression tests if needed. I generated a bunch of them and I think they all make sense even if we have some redundancy.

We could make the code more testable by creating a function accepting the API response and creating the output, thus being able to check more on the API parsing stability.

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Aug 15, 2025
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 15, 2025
@mtardy
Copy link
Member Author

mtardy commented Aug 15, 2025

/cc @tabbysable

Any idea if we have GHA enabled on the repo and the action would work? Any way to test the action beforehand?

@mtardy
Copy link
Member Author

mtardy commented Aug 15, 2025

/cc 4rivappa

fyi!

@k8s-ci-robot
Copy link
Contributor

@mtardy: GitHub didn't allow me to request PR reviews from the following users: 4rivappa.

Note that only kubernetes members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/cc 4rivappa

fyi!

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@mtardy mtardy force-pushed the pr/mtardy/cve-feed-parser-tests branch from 826a161 to 8281467 Compare August 15, 2025 21:13
mtardy added 3 commits August 15, 2025 23:29
This will be useful in the next commit to run unit tests on the
function.

Signed-off-by: Mahe Tardy <mahe.tardy@gmail.com>
This adds a bunch of simple unit tests and regression tests based on the
failures that were found by moving to regex parsing.

Signed-off-by: Mahe Tardy <mahe.tardy@gmail.com>
Signed-off-by: Mahe Tardy <mahe.tardy@gmail.com>
@mtardy mtardy force-pushed the pr/mtardy/cve-feed-parser-tests branch from 53e1f0a to 66ccd21 Compare August 15, 2025 21:29
@mtardy mtardy marked this pull request as ready for review August 15, 2025 21:29
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 15, 2025
Fix the following warning appearing on stderr:

sig-security/sig-security-tooling/cve-feed/hack/fetch-official-cve-feed.py:68:
DeprecationWarning: datetime.datetime.utcnow() is deprecated and
scheduled for removal in a future version. Use timezone-aware objects to
represent datetimes in UTC:
datetime.datetime.now(datetime.UTC). 'updated_at': datetime.utcnow().isoformat(sep='T', timespec='seconds') + 'Z'}

Signed-off-by: Mahe Tardy <mahe.tardy@gmail.com>
@mtardy mtardy force-pushed the pr/mtardy/cve-feed-parser-tests branch from 66ccd21 to f5e5c40 Compare August 29, 2025 17:36
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mtardy

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 29, 2025
@mtardy
Copy link
Member Author

mtardy commented Aug 29, 2025

So I remove the GHA yaml file to use prow from this kubernetes/test-infra#35426.

mtardy added a commit to mtardy/k8s-test-infra that referenced this pull request Aug 29, 2025
This new job is for running the CVE feed scripts unit tests every time
something touches them. The tests were added by kubernetes/sig-security#155.
@tabbysable
Copy link
Member

This is cool! /lgtm

@tabbysable
Copy link
Member

lol forgot it has to be on its own line
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 29, 2025
@k8s-ci-robot k8s-ci-robot merged commit c1f734b into kubernetes:main Aug 29, 2025
2 checks passed
k8s-ci-robot pushed a commit to kubernetes/test-infra that referenced this pull request Aug 29, 2025
This new job is for running the CVE feed scripts unit tests every time
something touches them. The tests were added by kubernetes/sig-security#155.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants