2026-03-30 00:54:20 +00:00
|
|
|
// SPDX-License-Identifier: EUPL-1.2
|
2026-03-30 00:19:43 +00:00
|
|
|
|
2026-03-06 13:20:12 +00:00
|
|
|
package plugin
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestBasePlugin_Good(t *testing.T) {
|
|
|
|
|
p := &BasePlugin{
|
|
|
|
|
PluginName: "test-plugin",
|
|
|
|
|
PluginVersion: "1.0.0",
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
assert.Equal(t, "test-plugin", p.Name())
|
|
|
|
|
assert.Equal(t, "1.0.0", p.Version())
|
|
|
|
|
|
|
|
|
|
ctx := context.Background()
|
|
|
|
|
assert.NoError(t, p.Init(ctx))
|
|
|
|
|
assert.NoError(t, p.Start(ctx))
|
|
|
|
|
assert.NoError(t, p.Stop(ctx))
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-30 06:37:20 +00:00
|
|
|
func TestBasePlugin_Good_EmptyFields_Good(t *testing.T) {
|
2026-03-06 13:20:12 +00:00
|
|
|
p := &BasePlugin{}
|
|
|
|
|
|
|
|
|
|
assert.Equal(t, "", p.Name())
|
|
|
|
|
assert.Equal(t, "", p.Version())
|
|
|
|
|
|
|
|
|
|
ctx := context.Background()
|
|
|
|
|
assert.NoError(t, p.Init(ctx))
|
|
|
|
|
assert.NoError(t, p.Start(ctx))
|
|
|
|
|
assert.NoError(t, p.Stop(ctx))
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-30 06:37:20 +00:00
|
|
|
func TestBasePlugin_Good_ImplementsPlugin_Good(t *testing.T) {
|
2026-03-06 13:20:12 +00:00
|
|
|
var _ Plugin = &BasePlugin{}
|
|
|
|
|
}
|