[MM-37664] Remove deprecated Backend field from plugin manifest (#18064)

Этот коммит содержится в:
Ben Schumacher
2021-08-13 19:41:32 +02:00
коммит произвёл GitHub
родитель d447d9b64a
Коммит cbba2f1cca
8 изменённых файлов: 19 добавлений и 87 удалений

Просмотреть файл

@@ -559,7 +559,7 @@ func TestSubmitInteractiveDialog(t *testing.T) {
func main() {
plugin.ClientMain(&MyPlugin{})
}
`, `{"id": "myplugin", "backend": {"executable": "backend.exe"}}`, "myplugin", th.App, th.Context)
`, `{"id": "myplugin", "server": {"executable": "backend.exe"}}`, "myplugin", th.App, th.Context)
hooks, err2 := th.App.GetPluginsEnvironment().HooksForPlugin("myplugin")
require.NoError(t, err2)
@@ -841,7 +841,7 @@ func TestPostActionRelativePluginURL(t *testing.T) {
func main() {
plugin.ClientMain(&MyPlugin{})
}
`, `{"id": "myplugin", "backend": {"executable": "backend.exe"}}`, "myplugin", th.App, th.Context)
`, `{"id": "myplugin", "server": {"executable": "backend.exe"}}`, "myplugin", th.App, th.Context)
hooks, err2 := th.App.GetPluginsEnvironment().HooksForPlugin("myplugin")
require.NoError(t, err2)
@@ -1060,7 +1060,7 @@ func TestDoPluginRequest(t *testing.T) {
func main() {
plugin.ClientMain(&MyPlugin{})
}
`, `{"id": "myplugin", "backend": {"executable": "backend.exe"}}`, "myplugin", th.App, th.Context)
`, `{"id": "myplugin", "server": {"executable": "backend.exe"}}`, "myplugin", th.App, th.Context)
hooks, err2 := th.App.GetPluginsEnvironment().HooksForPlugin("myplugin")
require.NoError(t, err2)

Просмотреть файл

@@ -691,7 +691,7 @@ func TestPluginAPILoadPluginConfiguration(t *testing.T) {
require.True(t, found, "Cannot find tests folder")
fullPath := path.Join(testFolder, "manual.test_load_configuration_plugin", "main.go")
err = pluginAPIHookTest(t, th, fullPath, "testloadpluginconfig", `{"id": "testloadpluginconfig", "backend": {"executable": "backend.exe"}, "settings_schema": {
err = pluginAPIHookTest(t, th, fullPath, "testloadpluginconfig", `{"id": "testloadpluginconfig", "server": {"executable": "backend.exe"}, "settings_schema": {
"settings": [
{
"key": "MyStringSetting",
@@ -950,7 +950,7 @@ func TestInstallPlugin(t *testing.T) {
}
`,
`{"id": "testinstallplugin", "backend": {"executable": "backend.exe"}, "settings_schema": {
`{"id": "testinstallplugin", "server": {"executable": "backend.exe"}, "settings_schema": {
"settings": [
{
"key": "DownloadURL",
@@ -1068,7 +1068,7 @@ func pluginAPIHookTest(t *testing.T, th *TestHelper, fileName string, id string,
}
th.App.srv.sqlStore = th.GetSqlStore()
setupPluginApiTest(t, code,
fmt.Sprintf(`{"id": "%v", "backend": {"executable": "backend.exe"}, "settings_schema": %v}`, id, schema),
fmt.Sprintf(`{"id": "%v", "server": {"executable": "backend.exe"}, "settings_schema": %v}`, id, schema),
id, th.App, th.Context)
hooks, err := th.App.GetPluginsEnvironment().HooksForPlugin(id)
require.NoError(t, err)
@@ -1511,8 +1511,8 @@ func TestInterpluginPluginHTTP(t *testing.T) {
`,
},
[]string{
`{"id": "testplugininterserver", "backend": {"executable": "backend.exe"}}`,
`{"id": "testplugininterclient", "backend": {"executable": "backend.exe"}}`,
`{"id": "testplugininterserver", "server": {"executable": "backend.exe"}}`,
`{"id": "testplugininterclient", "server": {"executable": "backend.exe"}}`,
},
[]string{
"testplugininterserver",
@@ -1573,7 +1573,7 @@ func TestApiMetrics(t *testing.T) {
}
`
utils.CompileGo(t, code, backend)
ioutil.WriteFile(filepath.Join(pluginDir, pluginID, "plugin.json"), []byte(`{"id": "`+pluginID+`", "backend": {"executable": "backend.exe"}}`), 0600)
ioutil.WriteFile(filepath.Join(pluginDir, pluginID, "plugin.json"), []byte(`{"id": "`+pluginID+`", "server": {"executable": "backend.exe"}}`), 0600)
// Don't care about these mocks
metricsMock.On("ObservePluginHookDuration", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return()

Просмотреть файл

@@ -45,7 +45,7 @@ func SetAppEnvironmentWithPlugins(t *testing.T, pluginCode []string, app *App, a
backend := filepath.Join(pluginDir, pluginID, "backend.exe")
utils.CompileGo(t, code, backend)
ioutil.WriteFile(filepath.Join(pluginDir, pluginID, "plugin.json"), []byte(`{"id": "`+pluginID+`", "backend": {"executable": "backend.exe"}}`), 0600)
ioutil.WriteFile(filepath.Join(pluginDir, pluginID, "plugin.json"), []byte(`{"id": "`+pluginID+`", "server": {"executable": "backend.exe"}}`), 0600)
_, _, activationErr := env.Activate(pluginID)
pluginIDs = append(pluginIDs, pluginID)
activationErrors = append(activationErrors, activationErr)
@@ -1083,7 +1083,7 @@ func TestHookMetrics(t *testing.T) {
}
`
utils.CompileGo(t, code, backend)
ioutil.WriteFile(filepath.Join(pluginDir, pluginID, "plugin.json"), []byte(`{"id": "`+pluginID+`", "backend": {"executable": "backend.exe"}}`), 0600)
ioutil.WriteFile(filepath.Join(pluginDir, pluginID, "plugin.json"), []byte(`{"id": "`+pluginID+`", "server": {"executable": "backend.exe"}}`), 0600)
// Setup mocks before activating
metricsMock.On("ObservePluginHookDuration", pluginID, "Implemented", true, mock.Anything).Return()

Просмотреть файл

@@ -78,7 +78,7 @@ func TestCreatePostDeduplicate(t *testing.T) {
func main() {
plugin.ClientMain(&MyPlugin{})
}
`, `{"id": "testrejectfirstpost", "backend": {"executable": "backend.exe"}}`, "testrejectfirstpost", th.App, th.Context)
`, `{"id": "testrejectfirstpost", "server": {"executable": "backend.exe"}}`, "testrejectfirstpost", th.App, th.Context)
pendingPostId := model.NewId()
post, err := th.App.CreatePostAsUser(th.Context, &model.Post{
@@ -128,7 +128,7 @@ func TestCreatePostDeduplicate(t *testing.T) {
func main() {
plugin.ClientMain(&MyPlugin{})
}
`, `{"id": "testdelayfirstpost", "backend": {"executable": "backend.exe"}}`, "testdelayfirstpost", th.App, th.Context)
`, `{"id": "testdelayfirstpost", "server": {"executable": "backend.exe"}}`, "testdelayfirstpost", th.App, th.Context)
var post *model.Post
pendingPostId := model.NewId()