Skip to content

Commit

Permalink
test: fix failing Go TestResourceCreationFailed test (#8918)
Browse files Browse the repository at this point in the history
  • Loading branch information
NicholasBlaskey authored Feb 28, 2024
1 parent 94c7bfe commit ef49195
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions master/internal/rm/kubernetesrm/pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"time"

"github.com/google/uuid"
"github.com/pkg/errors"
"github.com/stretchr/testify/require"
"gotest.tools/assert"

Expand Down Expand Up @@ -168,8 +167,6 @@ func checkReceiveTermination(
func TestResourceCreationFailed(t *testing.T) {
setupEntrypoint(t)

const correctMsg = "already exists"

ref, aID, sub := createPodWithMockQueue(t, nil)

purge(aID, sub)
Expand All @@ -179,14 +176,15 @@ func TestResourceCreationFailed(t *testing.T) {
require.NoError(t, err)
time.Sleep(time.Second)

// We expect two messages in the queue because the pod actor sends itself a stop message.
assert.Equal(t, sub.Len(), 2)
// We expect three messages in the queue because the pod actor sends itself a stop message.
assert.Equal(t, sub.Len(), 3)
message := sub.Get()
containerMsg, ok := message.(*sproto.ContainerLog)
if !ok {
t.Errorf("expected sproto.ContainerLog but received %s", reflect.TypeOf(message))
}
assert.ErrorContains(t, errors.New(*containerMsg.AuxMessage), correctMsg)
require.IsType(t, &sproto.ContainerLog{}, message)
require.Contains(t, *message.(*sproto.ContainerLog).AuxMessage, "Pod Spec Configured")

message = sub.Get()
require.IsType(t, &sproto.ContainerLog{}, message)
require.Contains(t, *message.(*sproto.ContainerLog).AuxMessage, "already exists")
}

func TestReceivePodStatusUpdateTerminated(t *testing.T) {
Expand Down

0 comments on commit ef49195

Please sign in to comment.