mirror of
https://github.com/jenkinsci/kubernetes-operator.git
synced 2026-10-18 14:01:04 +02:00
Rename plugin package
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
package plugins
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/VirtusLab/jenkins-operator/pkg/log"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestVerifyDependencies(t *testing.T) {
|
||||
data := []struct {
|
||||
basePlugins map[string][]Plugin
|
||||
extraPlugins map[string][]Plugin
|
||||
expectedResult bool
|
||||
}{
|
||||
{
|
||||
basePlugins: map[string][]Plugin{
|
||||
"first-root-plugin:1.0.0": {
|
||||
Must(New("first-plugin:0.0.1")),
|
||||
},
|
||||
},
|
||||
expectedResult: true,
|
||||
},
|
||||
{
|
||||
basePlugins: map[string][]Plugin{
|
||||
"first-root-plugin:1.0.0": {
|
||||
Must(New("first-plugin:0.0.1")),
|
||||
},
|
||||
"second-root-plugin:1.0.0": {
|
||||
Must(New("first-plugin:0.0.1")),
|
||||
},
|
||||
},
|
||||
expectedResult: true,
|
||||
},
|
||||
{
|
||||
basePlugins: map[string][]Plugin{
|
||||
"first-root-plugin:1.0.0": {
|
||||
Must(New("first-plugin:0.0.1")),
|
||||
},
|
||||
},
|
||||
extraPlugins: map[string][]Plugin{
|
||||
"second-root-plugin:2.0.0": {
|
||||
Must(New("first-plugin:0.0.1")),
|
||||
},
|
||||
},
|
||||
expectedResult: true,
|
||||
},
|
||||
{
|
||||
basePlugins: map[string][]Plugin{
|
||||
"first-root-plugin:1.0.0": {
|
||||
Must(New("first-plugin:0.0.1")),
|
||||
},
|
||||
"first-root-plugin:2.0.0": {
|
||||
Must(New("first-plugin:0.0.2")),
|
||||
},
|
||||
},
|
||||
expectedResult: false,
|
||||
},
|
||||
{
|
||||
basePlugins: map[string][]Plugin{
|
||||
"first-root-plugin:1.0.0": {
|
||||
Must(New("first-plugin:0.0.1")),
|
||||
},
|
||||
},
|
||||
extraPlugins: map[string][]Plugin{
|
||||
"first-root-plugin:2.0.0": {
|
||||
Must(New("first-plugin:0.0.2")),
|
||||
},
|
||||
},
|
||||
expectedResult: false,
|
||||
},
|
||||
{
|
||||
basePlugins: map[string][]Plugin{
|
||||
"invalid-plugin-name": {},
|
||||
},
|
||||
expectedResult: false,
|
||||
},
|
||||
}
|
||||
|
||||
debug := false
|
||||
log.SetupLogger(&debug)
|
||||
|
||||
for index, testingData := range data {
|
||||
t.Run(fmt.Sprintf("Testing %d data", index), func(t *testing.T) {
|
||||
result := VerifyDependencies(testingData.basePlugins, testingData.extraPlugins)
|
||||
assert.Equal(t, testingData.expectedResult, result)
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user