MCPcopy
hub / github.com/gotify/server / TestWrapIncompatiblePlugins

Function TestWrapIncompatiblePlugins

plugin/compat/wrap_test.go:132–157  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

130}
131
132func TestWrapIncompatiblePlugins(t *testing.T) {
133 tmpDir := test.NewTmpDir("gotify_testwrapincompatibleplugins")
134 defer tmpDir.Clean()
135 for i, modulePath := range []string{
136 "github.com/gotify/server/v2/plugin/testing/broken/noinstance",
137 "github.com/gotify/server/v2/plugin/testing/broken/nothing",
138 "github.com/gotify/server/v2/plugin/testing/broken/unknowninfo",
139 "github.com/gotify/server/v2/plugin/testing/broken/malformedconstructor",
140 } {
141 fName := tmpDir.Path(fmt.Sprintf("broken_%d.so", i))
142 exec.Command("go", "get", "-d").Run()
143 goBuildFlags := []string{"build", "-buildmode=plugin", "-o=" + fName}
144 goBuildFlags = append(goBuildFlags, extraGoBuildFlags...)
145 goBuildFlags = append(goBuildFlags, modulePath)
146
147 cmd := exec.Command("go", goBuildFlags...)
148 cmd.Stderr = os.Stderr
149 assert.Nil(t, cmd.Run())
150
151 plugin, err := plugin.Open(fName)
152 assert.Nil(t, err)
153 _, err = Wrap(plugin)
154 assert.Error(t, err)
155 os.Remove(fName)
156 }
157}

Callers

nothing calls this directly

Calls 6

CleanMethod · 0.95
PathMethod · 0.95
NewTmpDirFunction · 0.92
WrapFunction · 0.85
OpenMethod · 0.80
ErrorMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…