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

Run merkledb fuzz tests every 6 hours #2415

Merged
merged 11 commits into from
Dec 6, 2023
27 changes: 27 additions & 0 deletions .github/workflows/fuzz_merkledb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Run merkledb fuzz tests
danlaine marked this conversation as resolved.
Show resolved Hide resolved

on:
workflow_dispatch:
schedule:
# Run every 6 hours
- cron: "0 0,6,12,18 * * *"

permissions:
contents: read

jobs:
fuzz:
danlaine marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v3
with:
ref: 'dev'
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '~1.20.10'
StephenButtolph marked this conversation as resolved.
Show resolved Hide resolved
check-latest: true
- name: Run merkledb fuzz tests
shell: bash
run: ./scripts/build_fuzz.sh 900 ./x/merkledb # Run each merkledb fuzz tests 15 minutes
10 changes: 9 additions & 1 deletion scripts/build_fuzz.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/usr/bin/env bash

# First argument is the time, in seconds, to run each fuzz test for.
# If not provided, defaults to 1 second.
#
# Second argument is the directory to run fuzz tests in.
# If not provided, defaults to the current directory.

set -euo pipefail

# Mostly taken from https://github.com/golang/go/issues/46312#issuecomment-1153345129
Expand All @@ -10,7 +16,9 @@ AVALANCHE_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd )
source "$AVALANCHE_PATH"/scripts/constants.sh

fuzzTime=${1:-1}
files=$(grep -r --include='**_test.go' --files-with-matches 'func Fuzz' .)
fuzzDir=${2:-.}

files=$(grep -r --include='**_test.go' --files-with-matches 'func Fuzz' $fuzzDir)
failed=false
for file in ${files}
do
Expand Down
Loading