Skip to content

Commit

Permalink
Merge pull request kubernetes#13183 from spowelljr/fixHyperkitMount
Browse files Browse the repository at this point in the history
Fix mount test failing due to duplicate port
  • Loading branch information
spowelljr authored Dec 17, 2021
2 parents a36473f + de38e0e commit 5738dfb
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions test/integration/mount_start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,23 @@ import (
"context"
"fmt"
"os/exec"
"strconv"
"strings"
"testing"
)

const (
mountGID = "0"
mountMSize = "6543"
mountPort = "46464"
mountUID = "0"
)

var mountStartPort = 46463

func mountPort() string {
return strconv.Itoa(mountStartPort)
}

// TestMountStart tests using the mount command on start
func TestMountStart(t *testing.T) {
if NoneDriver() {
Expand All @@ -55,8 +61,8 @@ func TestMountStart(t *testing.T) {
profile string
}{
{"StartWithMountFirst", validateStartWithMount, profile1},
{"StartWithMountSecond", validateStartWithMount, profile2},
{"VerifyMountFirst", validateMount, profile1},
{"StartWithMountSecond", validateStartWithMount, profile2},
{"VerifyMountSecond", validateMount, profile2},
{"DeleteFirst", validateDelete, profile1},
{"VerifyMountPostDelete", validateMount, profile2},
Expand Down Expand Up @@ -84,7 +90,10 @@ func TestMountStart(t *testing.T) {
func validateStartWithMount(ctx context.Context, t *testing.T, profile string) {
defer PostMortemLogs(t, profile)

args := []string{"start", "-p", profile, "--memory=2048", "--mount", "--mount-gid", mountGID, "--mount-msize", mountMSize, "--mount-port", mountPort, "--mount-uid", mountUID}
// We have to increment this because if you have two mounts with the same port, when you kill one cluster the mount will break for the other
mountStartPort++

args := []string{"start", "-p", profile, "--memory=2048", "--mount", "--mount-gid", mountGID, "--mount-msize", mountMSize, "--mount-port", mountPort(), "--mount-uid", mountUID}
args = append(args, StartArgs()...)
rr, err := Run(t, exec.CommandContext(ctx, Target(), args...))
if err != nil {
Expand Down Expand Up @@ -124,7 +133,7 @@ func validateMount(ctx context.Context, t *testing.T, profile string) {
}{
{"gid", mountGID},
{"msize", mountMSize},
{"port", mountPort},
{"port", mountPort()},
{"uid", mountUID},
}

Expand Down

0 comments on commit 5738dfb

Please sign in to comment.