Merge pull request #8103 from AkihiroSuda/go-1.20

Go 1.20.1
This commit is contained in:
Maksym Pavlenko 2023-02-15 20:09:28 -08:00 committed by GitHub
commit 24cf85f5a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 99 additions and 45 deletions

View File

@ -43,7 +43,7 @@ jobs:
steps: steps:
- uses: actions/setup-go@v3 - uses: actions/setup-go@v3
with: with:
go-version: "1.19.6" go-version: "1.20.1"
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:

View File

@ -12,7 +12,7 @@ on:
env: env:
# Go version we currently use to build containerd across all CI. # Go version we currently use to build containerd across all CI.
# Note: don't forget to update `Binaries` step, as it contains the matrix of all supported Go versions. # Note: don't forget to update `Binaries` step, as it contains the matrix of all supported Go versions.
GO_VERSION: "1.19.6" GO_VERSION: "1.20.1"
permissions: # added using https://github.com/step-security/secure-workflows permissions: # added using https://github.com/step-security/secure-workflows
contents: read contents: read
@ -41,7 +41,7 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: golangci/golangci-lint-action@v3 - uses: golangci/golangci-lint-action@v3
with: with:
version: v1.50.1 version: v1.51.1
skip-cache: true skip-cache: true
args: --timeout=8m args: --timeout=8m
@ -207,7 +207,7 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ubuntu-20.04, macos-12, windows-2019, windows-2022] os: [ubuntu-20.04, macos-12, windows-2019, windows-2022]
go-version: ["1.19.6", "1.18.10"] go-version: ["1.20.1", "1.19.6"]
steps: steps:
- uses: actions/setup-go@v3 - uses: actions/setup-go@v3
with: with:

View File

@ -34,7 +34,7 @@ jobs:
- uses: actions/setup-go@v3 - uses: actions/setup-go@v3
with: with:
go-version: 1.19.6 go-version: 1.20.1
# Initializes the CodeQL tools for scanning. # Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL - name: Initialize CodeQL

View File

@ -42,6 +42,8 @@ jobs:
steps: steps:
- uses: actions/setup-go@v3 - uses: actions/setup-go@v3
with: with:
# FIXME: go-fuzz fails with Go 1.20: `cgo_unix_cgo_res.cgo2.c:(.text+0x32): undefined reference to `__res_search'`
# https://github.com/containerd/containerd/pull/8103#issuecomment-1429256152
go-version: 1.18 go-version: 1.18
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- run: script/go-test-fuzz.sh - run: script/go-test-fuzz.sh

View File

@ -28,7 +28,7 @@ jobs:
steps: steps:
- uses: actions/setup-go@v3 - uses: actions/setup-go@v3
with: with:
go-version: "1.19.6" go-version: "1.20.1"
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:

View File

@ -7,7 +7,7 @@ on:
- ".github/workflows/nightly.yml" - ".github/workflows/nightly.yml"
env: env:
GO_VERSION: "1.19.6" GO_VERSION: "1.20.1"
permissions: # added using https://github.com/step-security/secure-workflows permissions: # added using https://github.com/step-security/secure-workflows
contents: read contents: read

View File

@ -13,7 +13,7 @@ on:
name: Release name: Release
env: env:
GO_VERSION: "1.19.6" GO_VERSION: "1.20.1"
permissions: # added using https://github.com/step-security/secure-workflows permissions: # added using https://github.com/step-security/secure-workflows
contents: read contents: read

View File

@ -14,7 +14,7 @@ This doc includes:
To build the `containerd` daemon, and the `ctr` simple test client, the following build system dependencies are required: To build the `containerd` daemon, and the `ctr` simple test client, the following build system dependencies are required:
* Go 1.18.x or above * Go 1.19.x or above
* Protoc 3.x compiler and headers (download at the [Google protobuf releases page](https://github.com/protocolbuffers/protobuf/releases)) * Protoc 3.x compiler and headers (download at the [Google protobuf releases page](https://github.com/protocolbuffers/protobuf/releases))
* Btrfs headers and libraries for your distribution. Note that building the btrfs driver can be disabled via the build tag `no_btrfs`, removing this dependency. * Btrfs headers and libraries for your distribution. Note that building the btrfs driver can be disabled via the build tag `no_btrfs`, removing this dependency.

2
Vagrantfile vendored
View File

@ -101,7 +101,7 @@ EOF
config.vm.provision "install-golang", type: "shell", run: "once" do |sh| config.vm.provision "install-golang", type: "shell", run: "once" do |sh|
sh.upload_path = "/tmp/vagrant-install-golang" sh.upload_path = "/tmp/vagrant-install-golang"
sh.env = { sh.env = {
'GO_VERSION': ENV['GO_VERSION'] || "1.19.6", 'GO_VERSION': ENV['GO_VERSION'] || "1.20.1",
} }
sh.inline = <<~SHELL sh.inline = <<~SHELL
#!/usr/bin/env bash #!/usr/bin/env bash

View File

@ -20,8 +20,8 @@ import (
"bytes" "bytes"
"compress/gzip" "compress/gzip"
"context" "context"
"crypto/rand"
"io" "io"
"math/rand"
"os" "os"
"path/filepath" "path/filepath"
"runtime" "runtime"

View File

@ -341,6 +341,7 @@ func createTarFile(ctx context.Context, path, extractDir string, hdr *tar.Header
} }
} }
//nolint:staticcheck // TypeRegA is deprecated but we may still receive an external tar with TypeRegA
case tar.TypeReg, tar.TypeRegA: case tar.TypeReg, tar.TypeRegA:
file, err := openFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, hdrInfo.Mode()) file, err := openFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, hdrInfo.Mode())
if err != nil { if err != nil {

View File

@ -204,7 +204,6 @@ type Stat struct {
} }
func parseStat(data string) (stat Stat, err error) { func parseStat(data string) (stat Stat, err error) {
//nolint:dupword
// From proc(5), field 2 could contain space and is inside `(` and `)`. // From proc(5), field 2 could contain space and is inside `(` and `)`.
// The following is an example: // The following is an example:
// 89653 (gunicorn: maste) S 89630 89653 89653 0 -1 4194560 29689 28896 0 3 146 32 76 19 20 0 1 0 2971844 52965376 3920 18446744073709551615 1 1 0 0 0 0 0 16781312 137447943 0 0 0 17 1 0 0 0 0 0 0 0 0 0 0 0 0 0 // 89653 (gunicorn: maste) S 89630 89653 89653 0 -1 4194560 29689 28896 0 3 146 32 76 19 20 0 1 0 2971844 52965376 3920 18446744073709551615 1 1 0 0 0 0 0 16781312 137447943 0 0 0 17 1 0 0 0 0 0 0 0 0 0 0 0 0 0

View File

@ -23,12 +23,13 @@ import (
"github.com/containerd/containerd/cmd/containerd/command" "github.com/containerd/containerd/cmd/containerd/command"
"github.com/containerd/containerd/pkg/hasher" "github.com/containerd/containerd/pkg/hasher"
"github.com/containerd/containerd/pkg/seed" "github.com/containerd/containerd/pkg/seed" //nolint:staticcheck // Global math/rand seed is deprecated, but still used by external dependencies
_ "github.com/containerd/containerd/cmd/containerd/builtins" _ "github.com/containerd/containerd/cmd/containerd/builtins"
) )
func init() { func init() {
//nolint:staticcheck // Global math/rand seed is deprecated, but still used by external dependencies
seed.WithTimeAndRand() seed.WithTimeAndRand()
crypto.RegisterHash(crypto.SHA256, hasher.NewSHA256) crypto.RegisterHash(crypto.SHA256, hasher.NewSHA256)
} }

View File

@ -23,13 +23,14 @@ import (
"github.com/containerd/containerd/cmd/ctr/app" "github.com/containerd/containerd/cmd/ctr/app"
"github.com/containerd/containerd/pkg/hasher" "github.com/containerd/containerd/pkg/hasher"
"github.com/containerd/containerd/pkg/seed" "github.com/containerd/containerd/pkg/seed" //nolint:staticcheck // Global math/rand seed is deprecated, but still used by external dependencies
"github.com/urfave/cli" "github.com/urfave/cli"
) )
var pluginCmds = []cli.Command{} var pluginCmds = []cli.Command{}
func init() { func init() {
//nolint:staticcheck // Global math/rand seed is deprecated, but still used by external dependencies
seed.WithTimeAndRand() seed.WithTimeAndRand()
crypto.RegisterHash(crypto.SHA256, hasher.NewSHA256) crypto.RegisterHash(crypto.SHA256, hasher.NewSHA256)
} }

View File

@ -21,12 +21,12 @@ import (
"errors" "errors"
"fmt" "fmt"
"io" "io"
"math/rand"
"sync" "sync"
"time" "time"
"github.com/containerd/containerd/errdefs" "github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/log" "github.com/containerd/containerd/log"
"github.com/containerd/containerd/pkg/randutil"
"github.com/opencontainers/go-digest" "github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1" ocispec "github.com/opencontainers/image-spec/specs-go/v1"
) )
@ -123,7 +123,7 @@ func OpenWriter(ctx context.Context, cs Ingester, opts ...WriterOpt) (Writer, er
// error or abort. Requires asserting for an ingest manager // error or abort. Requires asserting for an ingest manager
select { select {
case <-time.After(time.Millisecond * time.Duration(rand.Intn(retry))): case <-time.After(time.Millisecond * time.Duration(randutil.Intn(retry))):
if retry < 2048 { if retry < 2048 {
retry = retry << 1 retry = retry << 1
} }

View File

@ -20,7 +20,6 @@ import (
"context" "context"
"fmt" "fmt"
"io" "io"
"math/rand"
"os" "os"
"path/filepath" "path/filepath"
"strconv" "strconv"
@ -32,6 +31,7 @@ import (
"github.com/containerd/containerd/errdefs" "github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/filters" "github.com/containerd/containerd/filters"
"github.com/containerd/containerd/log" "github.com/containerd/containerd/log"
"github.com/containerd/containerd/pkg/randutil"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/opencontainers/go-digest" "github.com/opencontainers/go-digest"
@ -473,7 +473,7 @@ func (s *store) Writer(ctx context.Context, opts ...content.WriterOpt) (content.
lockErr = nil lockErr = nil
break break
} }
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1<<count))) time.Sleep(time.Millisecond * time.Duration(randutil.Intn(1<<count)))
} }
if lockErr != nil { if lockErr != nil {

View File

@ -20,10 +20,10 @@ import (
"bufio" "bufio"
"bytes" "bytes"
"context" "context"
"crypto/rand"
_ "crypto/sha256" // required for digest package _ "crypto/sha256" // required for digest package
"fmt" "fmt"
"io" "io"
"math/rand"
"os" "os"
"path/filepath" "path/filepath"
"reflect" "reflect"
@ -35,6 +35,7 @@ import (
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/content/testsuite" "github.com/containerd/containerd/content/testsuite"
"github.com/containerd/containerd/errdefs" "github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/pkg/randutil"
"github.com/containerd/containerd/pkg/testutil" "github.com/containerd/containerd/pkg/testutil"
"github.com/opencontainers/go-digest" "github.com/opencontainers/go-digest"
@ -268,7 +269,7 @@ func generateBlobs(t checker, nblobs, maxsize int64) map[digest.Digest][]byte {
blobs := map[digest.Digest][]byte{} blobs := map[digest.Digest][]byte{}
for i := int64(0); i < nblobs; i++ { for i := int64(0); i < nblobs; i++ {
p := make([]byte, rand.Int63n(maxsize)) p := make([]byte, randutil.Int63n(maxsize))
if _, err := rand.Read(p); err != nil { if _, err := rand.Read(p); err != nil {
t.Fatal(err) t.Fatal(err)

View File

@ -29,7 +29,7 @@
# docker run --privileged containerd-test # docker run --privileged containerd-test
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
ARG GOLANG_VERSION=1.19.6 ARG GOLANG_VERSION=1.20.1
ARG GOLANG_IMAGE=golang ARG GOLANG_IMAGE=golang
FROM ${GOLANG_IMAGE}:${GOLANG_VERSION} AS golang FROM ${GOLANG_IMAGE}:${GOLANG_VERSION} AS golang

View File

@ -18,11 +18,11 @@ package walking
import ( import (
"context" "context"
"crypto/rand"
"encoding/base64" "encoding/base64"
"errors" "errors"
"fmt" "fmt"
"io" "io"
"math/rand"
"time" "time"
"github.com/containerd/containerd/archive" "github.com/containerd/containerd/archive"

2
go.mod
View File

@ -1,6 +1,6 @@
module github.com/containerd/containerd module github.com/containerd/containerd
go 1.18 go 1.19
require ( require (
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230106234847-43070de90fa1 github.com/AdaLogics/go-fuzz-headers v0.0.0-20230106234847-43070de90fa1

View File

@ -95,6 +95,7 @@ func ImportIndex(ctx context.Context, store content.Store, reader io.Reader, opt
symlinks[hdr.Name] = path.Join(path.Dir(hdr.Name), hdr.Linkname) symlinks[hdr.Name] = path.Join(path.Dir(hdr.Name), hdr.Linkname)
} }
//nolint:staticcheck // TypeRegA is deprecated but we may still receive an external tar with TypeRegA
if hdr.Typeflag != tar.TypeReg && hdr.Typeflag != tar.TypeRegA { if hdr.Typeflag != tar.TypeReg && hdr.Typeflag != tar.TypeRegA {
if hdr.Typeflag != tar.TypeDir { if hdr.Typeflag != tar.TypeDir {
log.G(ctx).WithField("file", hdr.Name).Debug("file type ignored") log.G(ctx).WithField("file", hdr.Name).Debug("file type ignored")

View File

@ -1,6 +1,6 @@
module github.com/containerd/containerd/integration/client module github.com/containerd/containerd/integration/client
go 1.18 go 1.19
require ( require (
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230106234847-43070de90fa1 github.com/AdaLogics/go-fuzz-headers v0.0.0-20230106234847-43070de90fa1

View File

@ -17,9 +17,9 @@
package leases package leases
import ( import (
"crypto/rand"
"encoding/base64" "encoding/base64"
"fmt" "fmt"
"math/rand"
"time" "time"
) )

View File

@ -19,11 +19,11 @@ package mount
import ( import (
"errors" "errors"
"fmt" "fmt"
"math/rand"
"os" "os"
"strings" "strings"
"time" "time"
"github.com/containerd/containerd/pkg/randutil"
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
) )
@ -152,7 +152,7 @@ func setupLoop(backingFile string, param LoopParams) (*os.File, error) {
// with EBUSY when trying to set it up. // with EBUSY when trying to set it up.
if strings.Contains(err.Error(), ebusyString) { if strings.Contains(err.Error(), ebusyString) {
// Fallback a bit to avoid live lock // Fallback a bit to avoid live lock
time.Sleep(time.Millisecond * time.Duration(rand.Intn(retry*10))) time.Sleep(time.Millisecond * time.Duration(randutil.Intn(retry*10)))
continue continue
} }
return nil, err return nil, err

View File

@ -24,7 +24,6 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
//nolint:dupword
const procPIDStatus = `Name: cat const procPIDStatus = `Name: cat
Umask: 0022 Umask: 0022
State: R (running) State: R (running)

View File

@ -17,8 +17,8 @@
package util package util
import ( import (
"crypto/rand"
"encoding/hex" "encoding/hex"
"math/rand"
) )
// GenerateID generates a random unique id. // GenerateID generates a random unique id.

View File

@ -18,21 +18,16 @@ package kmutex
import ( import (
"context" "context"
"math/rand"
"runtime" "runtime"
"strconv" "strconv"
"sync" "sync"
"testing" "testing"
"time" "time"
"github.com/containerd/containerd/pkg/seed" "github.com/containerd/containerd/pkg/randutil"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
func init() {
seed.WithTimeAndRand()
}
func TestBasic(t *testing.T) { func TestBasic(t *testing.T) {
t.Parallel() t.Parallel()
@ -60,7 +55,7 @@ func TestBasic(t *testing.T) {
waitLock = true waitLock = true
break break
} }
time.Sleep(time.Duration(rand.Int63n(100)) * time.Millisecond) time.Sleep(time.Duration(randutil.Int63n(100)) * time.Millisecond)
} }
assert.Equal(t, waitLock, true) assert.Equal(t, waitLock, true)
} }
@ -130,7 +125,7 @@ func TestMultileAcquireOnKeys(t *testing.T) {
for i := 0; i < nloops; i++ { for i := 0; i < nloops; i++ {
km.Lock(ctx, key) km.Lock(ctx, key)
time.Sleep(time.Duration(rand.Int63n(100)) * time.Nanosecond) time.Sleep(time.Duration(randutil.Int63n(100)) * time.Nanosecond)
km.Unlock(key) km.Unlock(key)
} }
@ -161,7 +156,7 @@ func TestMultiAcquireOnSameKey(t *testing.T) {
for i := 0; i < nloops; i++ { for i := 0; i < nloops; i++ {
km.Lock(ctx, key) km.Lock(ctx, key)
time.Sleep(time.Duration(rand.Int63n(100)) * time.Nanosecond) time.Sleep(time.Duration(randutil.Int63n(100)) * time.Nanosecond)
km.Unlock(key) km.Unlock(key)
} }

48
pkg/randutil/randutil.go Normal file
View File

@ -0,0 +1,48 @@
/*
Copyright The containerd Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Package randutil provides utilities for [cyrpto/rand].
package randutil
import (
"crypto/rand"
"math"
"math/big"
)
// Int63n is similar to [math/rand.Int63n] but uses [crypto/rand.Reader] under the hood.
func Int63n(n int64) int64 {
b, err := rand.Int(rand.Reader, big.NewInt(n))
if err != nil {
panic(err)
}
return b.Int64()
}
// Int63 is similar to [math/rand.Int63] but uses [crypto/rand.Reader] under the hood.
func Int63() int64 {
return Int63n(math.MaxInt64)
}
// Intn is similar to [math/rand.Intn] but uses [crypto/rand.Reader] under the hood.
func Intn(n int) int {
return int(Int63n(int64(n)))
}
// Int is similar to [math/rand.Int] but uses [crypto/rand.Reader] under the hood.
func Int() int {
return int(Int63())
}

View File

@ -14,6 +14,9 @@
limitations under the License. limitations under the License.
*/ */
// Package seed provides an initializer for the global [math/rand] seed.
//
// Deprecated: Do not rely on the global seed.
package seed package seed
import ( import (
@ -23,6 +26,8 @@ import (
// WithTimeAndRand seeds the global math rand generator with nanoseconds // WithTimeAndRand seeds the global math rand generator with nanoseconds
// XOR'ed with a crypto component if available for uniqueness. // XOR'ed with a crypto component if available for uniqueness.
//
// Deprecated: Do not rely on the global seed.
func WithTimeAndRand() { func WithTimeAndRand() {
var ( var (
b [4]byte b [4]byte

View File

@ -18,11 +18,11 @@ package unpack
import ( import (
"context" "context"
"crypto/rand"
"encoding/base64" "encoding/base64"
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
"math/rand"
"strconv" "strconv"
"sync" "sync"
"sync/atomic" "sync/atomic"

View File

@ -332,6 +332,7 @@ func parseHostsFile(baseDir string, b []byte) ([]hostConfig, error) {
// HACK: we want to keep toml parsing structures private in this package, however go-toml ignores private embedded types. // HACK: we want to keep toml parsing structures private in this package, however go-toml ignores private embedded types.
// so we remap it to a public type within the func body, so technically it's public, but not possible to import elsewhere. // so we remap it to a public type within the func body, so technically it's public, but not possible to import elsewhere.
//nolint:unused
type HostFileConfig = hostFileConfig type HostFileConfig = hostFileConfig
c := struct { c := struct {

View File

@ -18,9 +18,9 @@ package rootfs
import ( import (
"context" "context"
"crypto/rand"
"encoding/base64" "encoding/base64"
"fmt" "fmt"
"math/rand"
"time" "time"
"github.com/containerd/containerd/diff" "github.com/containerd/containerd/diff"

View File

@ -5,7 +5,7 @@
# lived test environment. # lived test environment.
Set-MpPreference -DisableRealtimeMonitoring:$true Set-MpPreference -DisableRealtimeMonitoring:$true
$PACKAGES= @{ mingw = "10.2.0"; git = ""; golang = "1.19.6"; make = ""; nssm = "" } $PACKAGES= @{ mingw = "10.2.0"; git = ""; golang = "1.20.1"; make = ""; nssm = "" }
Write-Host "Downloading chocolatey package" Write-Host "Downloading chocolatey package"
curl.exe -L "https://packages.chocolatey.org/chocolatey.0.10.15.nupkg" -o 'c:\choco.zip' curl.exe -L "https://packages.chocolatey.org/chocolatey.0.10.15.nupkg" -o 'c:\choco.zip'

View File

@ -19,10 +19,10 @@ package testsuite
import ( import (
"context" "context"
"fmt" "fmt"
"math/rand"
"os" "os"
"github.com/containerd/containerd/mount" "github.com/containerd/containerd/mount"
"github.com/containerd/containerd/pkg/randutil"
"github.com/containerd/containerd/snapshots" "github.com/containerd/containerd/snapshots"
"github.com/containerd/continuity/fs/fstest" "github.com/containerd/continuity/fs/fstest"
) )
@ -49,7 +49,7 @@ func applyToMounts(m []mount.Mount, work string, a fstest.Applier) (err error) {
// createSnapshot creates a new snapshot in the snapshotter // createSnapshot creates a new snapshot in the snapshotter
// given an applier to run on top of the given parent. // given an applier to run on top of the given parent.
func createSnapshot(ctx context.Context, sn snapshots.Snapshotter, parent, work string, a fstest.Applier) (string, error) { func createSnapshot(ctx context.Context, sn snapshots.Snapshotter, parent, work string, a fstest.Applier) (string, error) {
n := fmt.Sprintf("%p-%d", a, rand.Int()) n := fmt.Sprintf("%p-%d", a, randutil.Int())
prepare := fmt.Sprintf("%s-prepare", n) prepare := fmt.Sprintf("%s-prepare", n)
m, err := sn.Prepare(ctx, prepare, parent, opt) m, err := sn.Prepare(ctx, prepare, parent, opt)

View File

@ -21,7 +21,6 @@ import (
//nolint:revive // go-digest needs the blank import. See https://github.com/opencontainers/go-digest#usage. //nolint:revive // go-digest needs the blank import. See https://github.com/opencontainers/go-digest#usage.
_ "crypto/sha256" _ "crypto/sha256"
"fmt" "fmt"
"math/rand"
"os" "os"
"path/filepath" "path/filepath"
"sort" "sort"
@ -32,6 +31,7 @@ import (
"github.com/containerd/containerd/log/logtest" "github.com/containerd/containerd/log/logtest"
"github.com/containerd/containerd/mount" "github.com/containerd/containerd/mount"
"github.com/containerd/containerd/namespaces" "github.com/containerd/containerd/namespaces"
"github.com/containerd/containerd/pkg/randutil"
"github.com/containerd/containerd/pkg/testutil" "github.com/containerd/containerd/pkg/testutil"
"github.com/containerd/containerd/snapshots" "github.com/containerd/containerd/snapshots"
"github.com/containerd/continuity/fs/fstest" "github.com/containerd/continuity/fs/fstest"
@ -847,7 +847,7 @@ func checkFileFromLowerLayer(ctx context.Context, t *testing.T, snapshotter snap
} }
func closeTwice(ctx context.Context, t *testing.T, snapshotter snapshots.Snapshotter, work string) { func closeTwice(ctx context.Context, t *testing.T, snapshotter snapshots.Snapshotter, work string) {
n := fmt.Sprintf("closeTwice-%d", rand.Int()) n := fmt.Sprintf("closeTwice-%d", randutil.Int())
prepare := fmt.Sprintf("%s-prepare", n) prepare := fmt.Sprintf("%s-prepare", n)
// do some dummy ops to modify the snapshotter internal state // do some dummy ops to modify the snapshotter internal state