* plugins: Don't exit on duplicate plugin
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Add missing files
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Fix test
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
(cherry picked from commit 4084b53f91)
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
co-authored by
Arve Knudsen
parent
d18ac27126
commit
363d0a9588
@@ -2,6 +2,7 @@ package plugins
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
@@ -163,6 +164,23 @@ func TestPluginManager_Init(t *testing.T) {
|
||||
require.Empty(t, pm.scanningErrors)
|
||||
assert.Equal(t, []string{"gel"}, fm.registeredPlugins)
|
||||
})
|
||||
|
||||
t.Run("With nested plugin duplicating parent", func(t *testing.T) {
|
||||
origPluginsPath := setting.PluginsPath
|
||||
t.Cleanup(func() {
|
||||
setting.PluginsPath = origPluginsPath
|
||||
})
|
||||
setting.PluginsPath = "testdata/duplicate-plugins"
|
||||
|
||||
pm := &PluginManager{
|
||||
Cfg: &setting.Cfg{},
|
||||
}
|
||||
err := pm.Init()
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Len(t, pm.scanningErrors, 1)
|
||||
assert.True(t, errors.Is(pm.scanningErrors[0], duplicatePluginError{}))
|
||||
})
|
||||
}
|
||||
|
||||
func TestPluginManager_IsBackendOnlyPlugin(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user