MCPcopy Create free account
hub / github.com/coder/coder / sendInitAndGetResp

Function sendInitAndGetResp

provisioner/terraform/provision_test.go:83–101  ·  view source on GitHub ↗

sendInitAndGetResp will send the init request and wait for and return the InitComplete response.

(t *testing.T, sess proto.DRPCProvisioner_SessionClient, archive []byte, onLog ...func(log string))

Source from the content-addressed store, hash-verified

81
82// sendInitAndGetResp will send the init request and wait for and return the InitComplete response.
83func sendInitAndGetResp(t *testing.T, sess proto.DRPCProvisioner_SessionClient, archive []byte, onLog ...func(log string)) *proto.InitComplete {
84 t.Helper()
85 err := sendInit(sess, archive)
86 require.NoError(t, err)
87 for {
88 msg, err := sess.Recv()
89 require.NoError(t, err)
90 if logMsg, ok := msg.Type.(*proto.Response_Log); ok {
91 for _, do := range onLog {
92 do(logMsg.Log.Output)
93 }
94 continue
95 }
96
97 init := msg.GetInit()
98 require.NotNil(t, init)
99 return init
100 }
101}
102
103func configure(ctx context.Context, t *testing.T, client proto.DRPCProvisionerClient, config *proto.Config) proto.DRPCProvisioner_SessionClient {
104 t.Helper()

Callers 4

TestProvisionFunction · 0.85
TestProvision_ExtraEnvFunction · 0.85
TestProvision_SafeEnvFunction · 0.85

Calls 4

sendInitFunction · 0.85
HelperMethod · 0.65
RecvMethod · 0.65
GetInitMethod · 0.45

Tested by

no test coverage detected