commit
db460d2636
12 changed files with 18 additions and 16 deletions
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
|
@ -26,8 +26,8 @@ jobs:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
go:
|
go:
|
||||||
- 1.18
|
- 1.20.7
|
||||||
- 1.19.10
|
- 1.21.0
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
ARG GO_VERSION=1.19.10
|
ARG GO_VERSION=1.20.7
|
||||||
ARG ALPINE_VERSION=3.18
|
ARG ALPINE_VERSION=3.18
|
||||||
ARG XX_VERSION=1.2.1
|
ARG XX_VERSION=1.2.1
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
ARG GO_VERSION=1.19.10
|
ARG GO_VERSION=1.20.7
|
||||||
ARG ALPINE_VERSION=3.18
|
ARG ALPINE_VERSION=3.18
|
||||||
|
|
||||||
FROM alpine:${ALPINE_VERSION} AS base
|
FROM alpine:${ALPINE_VERSION} AS base
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
ARG GO_VERSION=1.19.10
|
ARG GO_VERSION=1.20.7
|
||||||
ARG ALPINE_VERSION=3.18
|
ARG ALPINE_VERSION=3.18
|
||||||
ARG GOLANGCI_LINT_VERSION=v1.52
|
ARG GOLANGCI_LINT_VERSION=v1.54.2
|
||||||
ARG BUILDTAGS="include_gcs"
|
ARG BUILDTAGS="include_gcs"
|
||||||
|
|
||||||
FROM golangci/golangci-lint:${GOLANGCI_LINT_VERSION}-alpine AS golangci-lint
|
FROM golangci/golangci-lint:${GOLANGCI_LINT_VERSION}-alpine AS golangci-lint
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
ARG GO_VERSION=1.19.10
|
ARG GO_VERSION=1.20.7
|
||||||
ARG ALPINE_VERSION=3.18
|
ARG ALPINE_VERSION=3.18
|
||||||
ARG MODOUTDATED_VERSION=v0.8.0
|
ARG MODOUTDATED_VERSION=v0.8.0
|
||||||
|
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -1,6 +1,6 @@
|
||||||
module github.com/distribution/distribution/v3
|
module github.com/distribution/distribution/v3
|
||||||
|
|
||||||
go 1.18
|
go 1.20
|
||||||
|
|
||||||
require (
|
require (
|
||||||
cloud.google.com/go/storage v1.30.1
|
cloud.google.com/go/storage v1.30.1
|
||||||
|
|
|
@ -9,7 +9,6 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
)
|
)
|
||||||
|
@ -221,7 +220,6 @@ func TestRouterWithBadCharacters(t *testing.T) {
|
||||||
// with random UTF8 characters not in the 128 bit ASCII range.
|
// with random UTF8 characters not in the 128 bit ASCII range.
|
||||||
// These are not valid characters for the router and we expect
|
// These are not valid characters for the router and we expect
|
||||||
// 404s on every test.
|
// 404s on every test.
|
||||||
rand.Seed(time.Now().UTC().UnixNano())
|
|
||||||
tests := make([]routeTestCase, 1000)
|
tests := make([]routeTestCase, 1000)
|
||||||
for idx := range tests {
|
for idx := range tests {
|
||||||
tests[idx] = routeTestCase{
|
tests[idx] = routeTestCase{
|
||||||
|
|
|
@ -21,6 +21,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var sbsMu sync.Mutex
|
var sbsMu sync.Mutex
|
||||||
|
var randSource rand.Rand
|
||||||
|
|
||||||
type statsBlobStore struct {
|
type statsBlobStore struct {
|
||||||
stats map[string]int
|
stats map[string]int
|
||||||
|
@ -189,13 +190,13 @@ func makeTestEnv(t *testing.T, name string) *testEnv {
|
||||||
func makeBlob(size int) []byte {
|
func makeBlob(size int) []byte {
|
||||||
blob := make([]byte, size)
|
blob := make([]byte, size)
|
||||||
for i := 0; i < size; i++ {
|
for i := 0; i < size; i++ {
|
||||||
blob[i] = byte('A' + rand.Int()%48)
|
blob[i] = byte('A' + randSource.Int()%48)
|
||||||
}
|
}
|
||||||
return blob
|
return blob
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
rand.Seed(42)
|
randSource = *rand.New(rand.NewSource(42))
|
||||||
}
|
}
|
||||||
|
|
||||||
func populate(t *testing.T, te *testEnv, blobCount, size, numUnique int) {
|
func populate(t *testing.T, te *testEnv, blobCount, size, numUnique int) {
|
||||||
|
|
|
@ -2,9 +2,9 @@ package s3
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"crypto/rand"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/rand"
|
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
|
@ -3,6 +3,7 @@ package testsuites
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
|
crand "crypto/rand"
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"io"
|
"io"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
@ -1232,7 +1233,7 @@ func randomFilename(length int64) string {
|
||||||
var randomBytes = make([]byte, 128<<20)
|
var randomBytes = make([]byte, 128<<20)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
_, _ = rand.Read(randomBytes) // always returns len(randomBytes) and nil error
|
_, _ = crand.Read(randomBytes) // always returns len(randomBytes) and nil error
|
||||||
}
|
}
|
||||||
|
|
||||||
func randomContents(length int64) []byte {
|
func randomContents(length int64) []byte {
|
||||||
|
|
|
@ -2,6 +2,7 @@ package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
crand "crypto/rand"
|
||||||
"io"
|
"io"
|
||||||
mrand "math/rand"
|
mrand "math/rand"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -14,7 +15,7 @@ import (
|
||||||
func TestSimpleRead(t *testing.T) {
|
func TestSimpleRead(t *testing.T) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
content := make([]byte, 1<<20)
|
content := make([]byte, 1<<20)
|
||||||
n, err := mrand.Read(content)
|
n, err := crand.Read(content)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unexpected error building random data: %v", err)
|
t.Fatalf("unexpected error building random data: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package testutil
|
||||||
import (
|
import (
|
||||||
"archive/tar"
|
"archive/tar"
|
||||||
"bytes"
|
"bytes"
|
||||||
|
crand "crypto/rand"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
mrand "math/rand"
|
mrand "math/rand"
|
||||||
|
@ -45,7 +46,7 @@ func CreateRandomTarFile() (rs io.ReadSeeker, dgst digest.Digest, err error) {
|
||||||
randomData := make([]byte, fileSize)
|
randomData := make([]byte, fileSize)
|
||||||
|
|
||||||
// Fill up the buffer with some random data.
|
// Fill up the buffer with some random data.
|
||||||
n, err := mrand.Read(randomData)
|
n, err := crand.Read(randomData)
|
||||||
|
|
||||||
if n != len(randomData) {
|
if n != len(randomData) {
|
||||||
return nil, "", fmt.Errorf("short read creating random reader: %v bytes != %v bytes", n, len(randomData))
|
return nil, "", fmt.Errorf("short read creating random reader: %v bytes != %v bytes", n, len(randomData))
|
||||||
|
|
Loading…
Reference in a new issue