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))
| 81 | |
| 82 | // sendInitAndGetResp will send the init request and wait for and return the InitComplete response. |
| 83 | func 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 | |
| 103 | func configure(ctx context.Context, t *testing.T, client proto.DRPCProvisionerClient, config *proto.Config) proto.DRPCProvisioner_SessionClient { |
| 104 | t.Helper() |
no test coverage detected