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

Fix mount test failing due to duplicate port #13183

Merged
merged 1 commit into from
Dec 17, 2021
Merged
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
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