MCPcopy Create free account
hub / github.com/encodeous/nylon / TestIPCReloadConfig

Function TestIPCReloadConfig

integration/ipc_test.go:99–132  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

97}
98
99func TestIPCReloadConfig(t *testing.T) {
100 defer goleak.VerifyNone(t)
101 vh, errs := setupTwoNodeHarness(t)
102 defer vh.Stop()
103
104 time.Sleep(1 * time.Second)
105
106 // Write the current central config to a temp file
107 cfgData, err := yaml.Marshal(&vh.Central)
108 require.NoError(t, err)
109 tmpFile := t.TempDir() + "/central.yaml"
110 require.NoError(t, os.WriteFile(tmpFile, cfgData, 0600))
111
112 a := vh.Nylons[vh.IndexOf("a")].Load()
113 a.ConfigPath = tmpFile
114 done := make(chan *protocol.IpcResponse, 1)
115 go func() {
116 resp := ipcCall(t, a, &protocol.IpcRequest{
117 Request: &protocol.IpcRequest_Reload{Reload: &protocol.ReloadRequest{}},
118 })
119 done <- resp
120 }()
121
122 select {
123 case resp := <-done:
124 assert.True(t, resp.Ok)
125 r := resp.GetReload()
126 assert.Contains(t, []protocol.ReloadResult{protocol.ReloadResult_APPLIED}, r.Result)
127 case err := <-errs:
128 t.Fatal(err)
129 case <-time.After(10 * time.Second):
130 t.Fatal("timeout")
131 }
132}
133
134func TestIPCProbeNonNeighbour(t *testing.T) {
135 defer goleak.VerifyNone(t)

Callers

nothing calls this directly

Calls 6

setupTwoNodeHarnessFunction · 0.85
ipcCallFunction · 0.85
IndexOfMethod · 0.80
AfterMethod · 0.80
StopMethod · 0.65
GetReloadMethod · 0.45

Tested by

no test coverage detected