MCPcopy Index your code
hub / github.com/coder/coder / expectStatusWithHandshake

Function expectStatusWithHandshake

tailnet/configmaps_internal_test.go:1084–1110  ·  view source on GitHub ↗
(
	ctx context.Context, t testing.TB, fEng *fakeEngineConfigurable, k key.NodePublic, lastHandshake time.Time,
)

Source from the content-addressed store, hash-verified

1082}
1083
1084func expectStatusWithHandshake(
1085 ctx context.Context, t testing.TB, fEng *fakeEngineConfigurable, k key.NodePublic, lastHandshake time.Time,
1086) <-chan struct{} {
1087 t.Helper()
1088 called := make(chan struct{})
1089 go func() {
1090 select {
1091 case <-ctx.Done():
1092 t.Error("timeout waiting for status")
1093 return
1094 case b := <-fEng.status:
1095 b.AddPeer(k, &ipnstate.PeerStatus{
1096 PublicKey: k,
1097 LastHandshake: lastHandshake,
1098 Active: true,
1099 })
1100 select {
1101 case <-ctx.Done():
1102 t.Error("timeout sending done")
1103 case fEng.statusDone <- struct{}{}:
1104 close(called)
1105 return
1106 }
1107 }
1108 }()
1109 return called
1110}
1111
1112func TestConfigMaps_updatePeers_nonexist(t *testing.T) {
1113 t.Parallel()

Calls 3

HelperMethod · 0.65
DoneMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected