From dfd0beead709775fcf545341aeb5e257718ed11e Mon Sep 17 00:00:00 2001 From: Luiz Aoqui Date: Tue, 15 Mar 2022 10:41:07 -0400 Subject: [PATCH] fix alloc list test (#12297) The alloc list test with pagination was creating allocs before the target namespace existed. This works in OSS but fails in ENT because quotas are checked before the alloc can be created, so the namespace must exist beforehand. --- nomad/alloc_endpoint_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nomad/alloc_endpoint_test.go b/nomad/alloc_endpoint_test.go index 9efdc06bb..04e6c5e86 100644 --- a/nomad/alloc_endpoint_test.go +++ b/nomad/alloc_endpoint_test.go @@ -126,6 +126,10 @@ func TestAllocEndpoint_List_PaginationFiltering(t *testing.T) { state := s1.fsm.State() + require.NoError(t, state.UpsertNamespaces(1099, []*structs.Namespace{ + {Name: "non-default"}, + })) + var allocs []*structs.Allocation for i, m := range mocks { allocsInTx := []*structs.Allocation{} @@ -146,10 +150,6 @@ func TestAllocEndpoint_List_PaginationFiltering(t *testing.T) { require.NoError(t, state.UpsertAllocs(structs.MsgTypeTestSetup, index, allocsInTx)) } - require.NoError(t, state.UpsertNamespaces(1099, []*structs.Namespace{ - {Name: "non-default"}, - })) - aclToken := mock.CreatePolicyAndToken(t, state, 1100, "test-valid-read", mock.NamespacePolicy("*", "read", nil),