Fix flaky TestNomadStderrFifoIsRemoved
that expected only one allocation per job. However, in practice, a job can be rescheduled on multiple allocations.
This commit is contained in:
@ -7,6 +7,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
|
"github.com/hashicorp/nomad/api"
|
||||||
"github.com/openHPI/poseidon/internal/nomad"
|
"github.com/openHPI/poseidon/internal/nomad"
|
||||||
"github.com/openHPI/poseidon/pkg/dto"
|
"github.com/openHPI/poseidon/pkg/dto"
|
||||||
"github.com/openHPI/poseidon/pkg/logging"
|
"github.com/openHPI/poseidon/pkg/logging"
|
||||||
@ -324,8 +325,14 @@ func parseLogFile(t *testing.T, name string, start time.Time, end time.Time) (lo
|
|||||||
func (s *E2ETestSuite) ListTempDirectory(runnerID string) string {
|
func (s *E2ETestSuite) ListTempDirectory(runnerID string) string {
|
||||||
allocListStub, _, err := nomadClient.Jobs().Allocations(runnerID, true, nil)
|
allocListStub, _, err := nomadClient.Jobs().Allocations(runnerID, true, nil)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().Equal(1, len(allocListStub))
|
var runningAllocStub *api.AllocationListStub
|
||||||
alloc, _, err := nomadClient.Allocations().Info(allocListStub[0].ID, nil)
|
for _, stub := range allocListStub {
|
||||||
|
if stub.ClientStatus == api.AllocClientStatusRunning && stub.DesiredStatus == api.AllocDesiredStatusRun {
|
||||||
|
runningAllocStub = stub
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
alloc, _, err := nomadClient.Allocations().Info(runningAllocStub.ID, nil)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
|
|
||||||
var stdout, stderr bytes.Buffer
|
var stdout, stderr bytes.Buffer
|
||||||
|
Reference in New Issue
Block a user