E2E: dynamic host volumes (#25063)

I merged #24869 having forgotten we don't run these tests in PR CI, so there's a compile error in the test. Fix that error and add the no-op import we use to catch this kind of thing.

Ref: https://github.com/hashicorp/nomad/pull/24869
This commit is contained in:
Tim Gross
2025-02-07 16:27:36 -05:00
committed by GitHub
parent 3f2d4000a6
commit a11325863e
2 changed files with 10 additions and 6 deletions

View File

@@ -160,14 +160,19 @@ func TestDynamicHostVolumes_StickyVolumes(t *testing.T) {
// TODO: if we create # of volumes == # of nodes, we can make test flakes
// stand out more easily
_, cleanup1 := volumes3.Create(t, "input/volume-sticky.nomad.hcl",
vol1Sub, cleanup1 := volumes3.Create(t, "input/volume-sticky.nomad.hcl",
volumes3.WithClient(nomad))
t.Cleanup(cleanup1)
_, cleanup2 := volumes3.Create(t, "input/volume-sticky.nomad.hcl",
vol2Sub, cleanup2 := volumes3.Create(t, "input/volume-sticky.nomad.hcl",
volumes3.WithClient(nomad))
t.Cleanup(cleanup2)
nodeToVolMap := map[string]string{
vol1Sub.NodeID(): vol1Sub.VolumeID(),
vol2Sub.NodeID(): vol2Sub.VolumeID(),
}
t.Logf("[%v] submitting sticky volume mounter job", time.Since(start))
jobSub, cleanupJob := jobs3.Submit(t, "./input/sticky.nomad.hcl")
t.Cleanup(cleanupJob)
@@ -176,9 +181,9 @@ func TestDynamicHostVolumes_StickyVolumes(t *testing.T) {
alloc, _, err := nomad.Allocations().Info(allocID1, nil)
must.NoError(t, err)
must.Len(t, 1, alloc.HostVolumeIDs)
selectedVolID := alloc.HostVolumeIDs[0]
selectedNodeID := alloc.NodeID
selectedVolID := nodeToVolMap[selectedNodeID]
t.Logf("[%v] volume %q on node %q was selected",
time.Since(start), selectedVolID, selectedNodeID)
@@ -214,7 +219,6 @@ func TestDynamicHostVolumes_StickyVolumes(t *testing.T) {
newAlloc, _, err := nomad.Allocations().Info(allocID2, nil)
must.NoError(t, err)
must.Eq(t, []string{selectedVolID}, newAlloc.HostVolumeIDs)
must.Eq(t, selectedNodeID, newAlloc.NodeID)
t.Logf("[%v] replacement alloc %q is running", time.Since(start), newAlloc.ID)
@@ -278,7 +282,6 @@ func TestDynamicHostVolumes_StickyVolumes(t *testing.T) {
newAlloc, _, err = nomad.Allocations().Info(allocID3, nil)
must.NoError(t, err)
must.Eq(t, []string{selectedVolID}, newAlloc.HostVolumeIDs)
must.Eq(t, selectedNodeID, newAlloc.NodeID)
t.Logf("[%v] replacement alloc %q is running", time.Since(start), newAlloc.ID)

View File

@@ -35,6 +35,7 @@ import (
_ "github.com/hashicorp/nomad/e2e/consultemplate"
_ "github.com/hashicorp/nomad/e2e/disconnectedclients"
_ "github.com/hashicorp/nomad/e2e/docker"
_ "github.com/hashicorp/nomad/e2e/dynamic_host_volumes"
_ "github.com/hashicorp/nomad/e2e/isolation"
_ "github.com/hashicorp/nomad/e2e/metrics"
_ "github.com/hashicorp/nomad/e2e/namespaces"