File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
pkg/testcoverage/badgestorer Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -2,11 +2,11 @@ package badgestorer_test
22
33import (
44 "context"
5+ crand "crypto/rand"
6+ "encoding/hex"
57 "fmt"
68 "os"
7- "runtime"
89 "testing"
9- "time"
1010
1111 "github.com/google/go-github/v56/github"
1212 "github.com/stretchr/testify/assert"
@@ -56,7 +56,7 @@ func Test_Github(t *testing.T) {
5656 Branch : "badges-integration-test" ,
5757 // badge name must be unique because two tests running from different platforms
5858 // in CI can cause race condition if badge has the same name
59- FileName : fmt .Sprintf ("badge_%s_%d .svg" , runtime . GOOS , time . Now (). UnixNano ()),
59+ FileName : fmt .Sprintf ("badge_%s .svg" , randName ()),
6060 }
6161 s := NewGithub (cfg )
6262
@@ -110,3 +110,14 @@ func deleteFile(t *testing.T, cfg Git) {
110110 )
111111 assert .NoError (t , err )
112112}
113+
114+ func randName () string {
115+ buf := make ([]byte , 20 )
116+
117+ _ , err := crand .Read (buf )
118+ if err != nil {
119+ panic (err ) //nolint:forbidigo // okay here because it is only used for tests
120+ }
121+
122+ return hex .EncodeToString (buf )
123+ }
You can’t perform that action at this time.
0 commit comments