소스 검색

api tests: use intSize-agnostic random integers

rand.Intn(math.MaxInt64) causes tests to fail on 32-bit architectures.
Use the simpler rand.Int() instead, which still provides plenty of room
for generating pseudo-random test usernames.
Thomas J Faughnan Jr 2 년 전
부모
커밋
3e0d5de7a3
1개의 변경된 파일1개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 2
      internal/api/api_integration_test.go

+ 1 - 2
internal/api/api_integration_test.go

@@ -8,7 +8,6 @@ import (
 	"errors"
 	"fmt"
 	"io"
-	"math"
 	"math/rand"
 	"os"
 	"strings"
@@ -58,7 +57,7 @@ func (c *integrationTestConfig) isConfigured() bool {
 }
 
 func (c *integrationTestConfig) genRandomUsername() string {
-	return fmt.Sprintf("%s_%10d", c.testRegularUsername, rand.Intn(math.MaxInt64))
+	return fmt.Sprintf("%s_%10d", c.testRegularUsername, rand.Int())
 }
 
 func TestIncorrectEndpoint(t *testing.T) {