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

Function makePluginDir

internal/pluginhost/test_helpers_test.go:323–337  ·  view source on GitHub ↗
(t *testing.T, ids ...string)

Source from the content-addressed store, hash-verified

321}
322
323func makePluginDir(t *testing.T, ids ...string) string {
324 t.Helper()
325 root := t.TempDir()
326 archDir := filepath.Join(root, runtime.GOOS, runtime.GOARCH)
327 if errMkdirAll := os.MkdirAll(archDir, 0o755); errMkdirAll != nil {
328 t.Fatalf("MkdirAll() error = %v", errMkdirAll)
329 }
330 for _, id := range ids {
331 path := filepath.Join(archDir, id+pluginExtension(runtime.GOOS))
332 if errWriteFile := os.WriteFile(path, []byte("x"), 0o644); errWriteFile != nil {
333 t.Fatalf("WriteFile(%s) error = %v", path, errWriteFile)
334 }
335 }
336 return root
337}
338
339func makeVersionedPluginDir(t *testing.T, id string, versions ...string) (string, map[string]string) {
340 t.Helper()

Calls 1

pluginExtensionFunction · 0.70

Tested by

no test coverage detected