MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / newBlockingOpenHost

Function newBlockingOpenHost

internal/pluginhost/host_test.go:1158–1187  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1156}
1157
1158func newBlockingOpenHost(t *testing.T) (*Host, *config.Config, <-chan struct{}, func()) {
1159 t.Helper()
1160
1161 inner := newTestSymbolLoader()
1162 plugin := &testPlugin{
1163 registerResult: validTestPlugin("alpha"),
1164 reconfigureResult: validTestPlugin("alpha"),
1165 }
1166 inner.lookups["alpha"] = newTestSymbolLookup(plugin)
1167
1168 openStarted := make(chan struct{})
1169 release := make(chan struct{})
1170 var releaseOnce sync.Once
1171 releaseOpen := func() { releaseOnce.Do(func() { close(release) }) }
1172 t.Cleanup(releaseOpen)
1173
1174 h := NewForTest(&blockingOpenLoader{
1175 inner: inner,
1176 started: openStarted,
1177 release: release,
1178 })
1179 cfg := &config.Config{
1180 Plugins: config.PluginsConfig{
1181 Enabled: true,
1182 Dir: makePluginDir(t, "alpha"),
1183 Configs: enabledPluginConfigs("alpha"),
1184 },
1185 }
1186 return h, cfg, openStarted, releaseOpen
1187}
1188
1189func newBlockingRegisterHost(t *testing.T) (*Host, *config.Config, <-chan struct{}, func()) {
1190 t.Helper()

Calls 8

newTestSymbolLoaderFunction · 0.85
validTestPluginFunction · 0.85
newTestSymbolLookupFunction · 0.85
NewForTestFunction · 0.85
makePluginDirFunction · 0.85
enabledPluginConfigsFunction · 0.85
DoMethod · 0.65
CleanupMethod · 0.45

Tested by

no test coverage detected