Skip to content

Commit 399cd0d

Browse files
authored
Set up cron job to run fuzz tester (#15718)
Sets up a CircleCI workflow to run the fuzz tests with a randomly generated seed. The workflow runs on an hourly schedule.
1 parent 025b07b commit 399cd0d

2 files changed

Lines changed: 32 additions & 3 deletions

File tree

.circleci/config.yml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,21 @@ jobs:
165165
- *run_yarn
166166
- run: yarn test-build --maxWorkers=2
167167

168+
test_fuzz:
169+
docker: *docker
170+
environment: *environment
171+
steps:
172+
- checkout
173+
- *restore_yarn_cache
174+
- *run_yarn
175+
- run:
176+
name: Run fuzz tests
177+
command: |
178+
FUZZ_TEST_SEED=$RANDOM
179+
echo $FUZZ_TEST_SEED
180+
yarn test fuzz --maxWorkers=2
181+
yarn test-prod fuzz --maxWorkers=2
182+
168183
test_build_prod:
169184
docker: *docker
170185
environment: *environment
@@ -177,7 +192,7 @@ jobs:
177192

178193
workflows:
179194
version: 2
180-
build-and-test:
195+
commit:
181196
jobs:
182197
- setup
183198
- lint:
@@ -213,3 +228,16 @@ workflows:
213228
- test_build_prod:
214229
requires:
215230
- build
231+
hourly:
232+
triggers:
233+
- schedule:
234+
cron: "0 * * * *"
235+
filters:
236+
branches:
237+
only:
238+
- master
239+
jobs:
240+
- setup
241+
- fuzz_tests:
242+
requires:
243+
- setup

packages/react-reconciler/src/__tests__/ReactSuspenseFuzz-test.internal.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ let Scheduler;
55
let ReactFeatureFlags;
66
let Random;
77

8-
const SEED = 0;
9-
8+
const SEED = process.env.FUZZ_TEST_SEED || 'default';
109
const prettyFormatPkg = require('pretty-format');
1110

1211
function prettyFormat(thing) {
@@ -339,6 +338,8 @@ describe('ReactSuspenseFuzz', () => {
339338
Failed fuzzy test case:
340339
341340
${prettyFormat(randomTestCase)}
341+
342+
Random seed is ${SEED}
342343
`);
343344

344345
throw e;

0 commit comments

Comments
 (0)