From de38e0e42b156b54f6887c4cb01fe1f0772596ce Mon Sep 17 00:00:00 2001 From: Steven Powell Date: Thu, 16 Dec 2021 14:44:10 -0800 Subject: [PATCH] fix mount test failing due to duplicate port --- test/integration/mount_start_test.go | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/test/integration/mount_start_test.go b/test/integration/mount_start_test.go index 03c8873efc2f..9c0ed82e0c1e 100644 --- a/test/integration/mount_start_test.go +++ b/test/integration/mount_start_test.go @@ -23,6 +23,7 @@ import ( "context" "fmt" "os/exec" + "strconv" "strings" "testing" ) @@ -30,10 +31,15 @@ import ( 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() { @@ -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}, @@ -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 { @@ -124,7 +133,7 @@ func validateMount(ctx context.Context, t *testing.T, profile string) { }{ {"gid", mountGID}, {"msize", mountMSize}, - {"port", mountPort}, + {"port", mountPort()}, {"uid", mountUID}, }