Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4f1df88

Browse files
authored
fix: Always output job failure reason in provisioner daemon tests (coder#2850)
This flake can be seen here: https://github.com/coder/coder/runs/7186604615?check_suite_focus=true
1 parent 08a781f commit 4f1df88

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

provisionerd/provisionerd_test.go

+8
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,14 @@ func createProvisionerd(t *testing.T, dialer provisionerd.Dialer, provisioners p
962962
// Creates a provisionerd protobuf client that's connected
963963
// to the server implementation provided.
964964
func createProvisionerDaemonClient(t *testing.T, server provisionerDaemonTestServer) proto.DRPCProvisionerDaemonClient {
965+
if server.failJob == nil {
966+
// Default to asserting the error from the failure, otherwise
967+
// it can be lost in tests!
968+
server.failJob = func(ctx context.Context, job *proto.FailedJob) (*proto.Empty, error) {
969+
assert.Fail(t, job.Error)
970+
return &proto.Empty{}, nil
971+
}
972+
}
965973
clientPipe, serverPipe := provisionersdk.TransportPipe()
966974
t.Cleanup(func() {
967975
_ = clientPipe.Close()

0 commit comments

Comments
 (0)