fix: Always output job failure reason in provisioner daemon tests (#2850)

This flake can be seen here: https://github.com/coder/coder/runs/7186604615?check_suite_focus=true
This commit is contained in:
Kyle Carberry
2022-07-10 14:52:33 -05:00
committed by GitHub
parent 08a781f401
commit 4f1df88529

View File

@ -962,6 +962,14 @@ func createProvisionerd(t *testing.T, dialer provisionerd.Dialer, provisioners p
// Creates a provisionerd protobuf client that's connected
// to the server implementation provided.
func createProvisionerDaemonClient(t *testing.T, server provisionerDaemonTestServer) proto.DRPCProvisionerDaemonClient {
if server.failJob == nil {
// Default to asserting the error from the failure, otherwise
// it can be lost in tests!
server.failJob = func(ctx context.Context, job *proto.FailedJob) (*proto.Empty, error) {
assert.Fail(t, job.Error)
return &proto.Empty{}, nil
}
}
clientPipe, serverPipe := provisionersdk.TransportPipe()
t.Cleanup(func() {
_ = clientPipe.Close()