Skip to content

Commit

Permalink
TO REVERT: add randomly failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszcl committed Nov 14, 2024
1 parent 543bfb9 commit 5254cde
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions core/web/resolver/spec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package resolver

import (
"context"
"math/rand"
"testing"
"time"

Expand All @@ -27,6 +28,16 @@ import (
// Specs are only embedded on the job and are not fetchable by it's own id, so
// we test the spec resolvers by fetching a job by id.

func TestRandomPassOrFail(t *testing.T) {
rand.Seed(time.Now().UnixNano()) // Seed the random number generator

Check failure on line 32 in core/web/resolver/spec_test.go

View workflow job for this annotation

GitHub Actions / lint

SA1019: rand.Seed has been deprecated since Go 1.20 and an alternative has been available since Go 1.0: As of Go 1.20 there is no reason to call Seed with a random value. Programs that call Seed with a known value to get a specific sequence of results should use New(NewSource(seed)) to obtain a local random generator. (staticcheck)
if rand.Float32() < 0.5 {
t.Log("Test failed randomly")
t.Fail() // Fail the test
} else {
t.Log("Test passed randomly")
}
}

func TestResolver_CronSpec(t *testing.T) {
var (
id = int32(1)
Expand Down

0 comments on commit 5254cde

Please sign in to comment.