Do not rename test files on-the-fly to share functions
Instead this commit moves some functions that could be used by fuzzers. Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
This commit is contained in:
@@ -33,7 +33,6 @@ import (
|
||||
imagelist "github.com/containerd/containerd/integration/images"
|
||||
"github.com/containerd/containerd/leases"
|
||||
"github.com/containerd/containerd/log"
|
||||
"github.com/containerd/containerd/log/logtest"
|
||||
"github.com/containerd/containerd/namespaces"
|
||||
"github.com/containerd/containerd/pkg/testutil"
|
||||
"github.com/containerd/containerd/platforms"
|
||||
@@ -45,32 +44,16 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
address string
|
||||
noDaemon bool
|
||||
noCriu bool
|
||||
supportsCriu bool
|
||||
testNamespace = "testing"
|
||||
testSnapshotter = DefaultSnapshotter
|
||||
ctrdStdioFilePath string
|
||||
|
||||
ctrd = &daemon{}
|
||||
noDaemon bool
|
||||
noCriu bool
|
||||
supportsCriu bool
|
||||
)
|
||||
|
||||
func init() {
|
||||
flag.StringVar(&address, "address", defaultAddress, "The address to the containerd socket for use in the tests")
|
||||
flag.BoolVar(&noDaemon, "no-daemon", false, "Do not start a dedicated daemon for the tests")
|
||||
flag.BoolVar(&noCriu, "no-criu", false, "Do not run the checkpoint tests")
|
||||
}
|
||||
|
||||
func testContext(t testing.TB) (context.Context, context.CancelFunc) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
ctx = namespaces.WithNamespace(ctx, testNamespace)
|
||||
if t != nil {
|
||||
ctx = logtest.WithT(ctx, t)
|
||||
}
|
||||
return ctx, cancel
|
||||
}
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
flag.Parse()
|
||||
if testing.Short() {
|
||||
@@ -507,26 +490,6 @@ func TestClientReconnect(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func createShimDebugConfig() string {
|
||||
f, err := os.CreateTemp("", "containerd-config-")
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Failed to create config file: %s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
defer f.Close()
|
||||
if _, err := f.WriteString("version = 2\n"); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Failed to write to config file %s: %s\n", f.Name(), err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if _, err := f.WriteString("[plugins.\"io.containerd.runtime.v1.linux\"]\n\tshim_debug = true\n"); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Failed to write to config file %s: %s\n", f.Name(), err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
return f.Name()
|
||||
}
|
||||
|
||||
func TestDefaultRuntimeWithNamespaceLabels(t *testing.T) {
|
||||
client, err := newClient(t, address)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user