Rename plugin package

This commit is contained in:
Tomasz Sęk
2019-01-16 22:45:09 +01:00
parent cb2dfdd28a
commit 1f1947a80b
7 changed files with 22 additions and 22 deletions
@@ -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)
})
}
}