Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Fix network-related errors #474

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions machine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2062,12 +2062,12 @@ func TestLoadSnapshot(t *testing.T) {

cases := []struct {
name string
createSnapshot func(ctx context.Context, machineLogger *logrus.Logger, socketPath, memPath, snapPath string)
loadSnapshot func(ctx context.Context, machineLogger *logrus.Logger, socketPath, memPath, snapPath string)
createSnapshot func(ctx context.Context, t *testing.T, machineLogger *logrus.Logger, socketPath, memPath, snapPath string)
loadSnapshot func(ctx context.Context, t *testing.T, machineLogger *logrus.Logger, socketPath, memPath, snapPath string)
}{
{
name: "TestLoadSnapshot",
createSnapshot: func(ctx context.Context, machineLogger *logrus.Logger, socketPath, memPath, snapPath string) {
createSnapshot: func(ctx context.Context, t *testing.T, machineLogger *logrus.Logger, socketPath, memPath, snapPath string) {
// Create a snapshot
cfg := createValidConfig(t, socketPath+".create")
m, err := NewMachine(ctx, cfg, func(m *Machine) {
Expand All @@ -2091,7 +2091,7 @@ func TestLoadSnapshot(t *testing.T) {
require.NoError(t, err)
},

loadSnapshot: func(ctx context.Context, machineLogger *logrus.Logger, socketPath, memPath, snapPath string) {
loadSnapshot: func(ctx context.Context, t *testing.T, machineLogger *logrus.Logger, socketPath, memPath, snapPath string) {
// Note that many fields are not necessary when loading a snapshot
cfg := Config{
SocketPath: socketPath + ".load",
Expand Down Expand Up @@ -2127,11 +2127,11 @@ func TestLoadSnapshot(t *testing.T) {
},
{
name: "TestLoadSnapshot without create",
createSnapshot: func(ctx context.Context, machineLogger *logrus.Logger, socketPath, memPath, snapPath string) {
createSnapshot: func(ctx context.Context, t *testing.T, machineLogger *logrus.Logger, socketPath, memPath, snapPath string) {

},

loadSnapshot: func(ctx context.Context, machineLogger *logrus.Logger, socketPath, memPath, snapPath string) {
loadSnapshot: func(ctx context.Context, t *testing.T, machineLogger *logrus.Logger, socketPath, memPath, snapPath string) {
cfg := createValidConfig(t, socketPath+".load")
m, err := NewMachine(ctx, cfg, func(m *Machine) {
// Rewriting m.cmd partially wouldn't work since Cmd has
Expand All @@ -2147,7 +2147,7 @@ func TestLoadSnapshot(t *testing.T) {
},
{
name: "TestLoadSnapshot and check contents (via ssh)",
createSnapshot: func(ctx context.Context, machineLogger *logrus.Logger, socketPath, memPath, snapPath string) {
createSnapshot: func(ctx context.Context, t *testing.T, machineLogger *logrus.Logger, socketPath, memPath, snapPath string) {
cniConfPath := fmt.Sprintf("%s/%s.conflist", cniConfDir, networkName)
err := writeCNIConfWithHostLocalSubnet(cniConfPath, networkName, subnet)
require.NoError(t, err)
Expand Down Expand Up @@ -2209,7 +2209,7 @@ func TestLoadSnapshot(t *testing.T) {
require.NoError(t, err)
},

loadSnapshot: func(ctx context.Context, machineLogger *logrus.Logger, socketPath, memPath, snapPath string) {
loadSnapshot: func(ctx context.Context, t *testing.T, machineLogger *logrus.Logger, socketPath, memPath, snapPath string) {
var ipFreed bool = false
var err error

Expand Down Expand Up @@ -2316,8 +2316,8 @@ func TestLoadSnapshot(t *testing.T) {
machineLogger := logrus.New()
machineLogger.Out = io.MultiWriter(os.Stderr, &logBuffer)

c.createSnapshot(ctx, machineLogger, socketPath, snapPath, memPath)
c.loadSnapshot(ctx, machineLogger, socketPath, snapPath, memPath)
c.createSnapshot(ctx, t, machineLogger, socketPath, snapPath, memPath)
c.loadSnapshot(ctx, t, machineLogger, socketPath, snapPath, memPath)
})
}

Expand Down