X-Git-Url: https://git.giacomolli.uk/onehouse/blobdiff_plain/b9a4f3bdd2609a8b178dd42f313c383ccb59049b..c36e60046f72af3d0803943185526c27b10aa4ae:/driver/alamo/gateway_test.go diff --git a/driver/alamo/gateway_test.go b/driver/alamo/gateway_test.go index 715e860..ab004e0 100644 --- a/driver/alamo/gateway_test.go +++ b/driver/alamo/gateway_test.go @@ -85,3 +85,19 @@ func TestGatewayBoundsFakeClientOperationsAndReturnsFailures(t *testing.T) { require.ErrorIs(t, err, client.err) }) } + +func TestGatewayDoesNotStartAtTheExactCommandDeadline(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + client := &fakeGateway{states: []State{testState()}} + gateway := &gateway{client: client} + _, err := gateway.status(t.Context()) + require.NoError(t, err) + + ctx, cancel := context.WithTimeout(t.Context(), 6*time.Second) + defer cancel() + + _, err = gateway.action(ctx, testMAC, Action{}) + require.ErrorIs(t, err, context.DeadlineExceeded) + require.Len(t, client.starts, 1) + }) +}