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

ci: add automated fuzz tests #697

Merged
merged 1 commit into from
May 6, 2024
Merged

ci: add automated fuzz tests #697

merged 1 commit into from
May 6, 2024

Conversation

rfratto
Copy link
Member

@rfratto rfratto commented Apr 27, 2024

This PR introduces support for automated fuzz testing.

The fuzz-go.yml workflow is a reusable workflow which goes through two phases:

  1. Discover all fuzz tests

  2. Run each fuzz test in a separate GitHub Actions job (as Go doesn't currently allow running more than one fuzz test at a time).

    If the fuzz testing discovers a new failing test case, the test case is uploaded as an artifact and reproduction instructions are added to the summary of the workflow.

    Additionally, the reusable workflow can be configured to create an issue on the discovery of a new failing test case.

Then, two standard workflows are created:

  • "Run Go fuzz tests (PR)" (fuzz-go-pr.yml) runs all fuzz tests for up to 5 minutes on PRs. If a new failure is discovered, the PR author can look at the summary of the run to learn how to reproduce the failure.

  • "Run Go fuzz tests (scheduled)" (fuzz-go-scheduled.yml) runs all fuzz tests for up to 30 minutes every day at midnight. If a new failure is discovered, an issue is created.

I tested this fairly extensively on the rfratto/alloy fork, where you can see that it successfully creates issues such as rfratto#5.

Closes #537.

image image

This PR introduces support for automated fuzz testing.

The `fuzz-go.yml` workflow is a reusable workflow which goes through two
phases:

* Discover all fuzz tests

* Run each fuzz test in a separate GitHub Actions job (as Go doesn't
  currently allow running more than one fuzz test at a time).

  If the fuzz testing discovers a new failing test case, the test case
  is uploaded as an artifact and reproduction instructions are added to
  the summary of the workflow.

  Additionally, the reusable workflow can be configured to create an
  issue on the discovery of a new failing test case.

Then, two standard workflows are created:

* "Run Go fuzz tests (PR)" (`fuzz-go-pr.yml`) runs all fuzz tests for up
  to 5 minutes on PRs. If a new failure is discovered, the PR author can
  look at the summary of the run to learn how to reproduce the failure.

* "Run Go fuzz tests (scheduled)" (`fuzz-go-scheduled.yml`) runs all
  fuzz tests for up to 30 minutes every day at midnight. If a new
  failure is discovered, an issue is created.

Closes grafana#537

consolidate to one reusable workflow
@rfratto rfratto added the backport-to-agent:no PR should NOT be backported to the agent repo. label May 3, 2024
Copy link
Collaborator

@mattdurham mattdurham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, lets see what happens

@rfratto rfratto merged commit 29baf3f into grafana:main May 6, 2024
16 checks passed
@rfratto rfratto deleted the fuzztesting branch May 6, 2024 17:19
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport-to-agent:no PR should NOT be backported to the agent repo. frozen-due-to-age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CI: automate fuzz tests
2 participants