mirror of
https://gitlab.com/psuapp/psu.git
synced 2024-08-30 18:12:34 +00:00
47 lines
744 B
Go
47 lines
744 B
Go
package client
|
|
|
|
import (
|
|
"testing"
|
|
|
|
portainer "github.com/portainer/portainer/api"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestGetTranslatedStackType(t *testing.T) {
|
|
type args struct {
|
|
t portainer.StackType
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
args args
|
|
want string
|
|
}{
|
|
{
|
|
name: "swarm stack type",
|
|
args: args{
|
|
t: portainer.DockerSwarmStack,
|
|
},
|
|
want: "swarm",
|
|
},
|
|
{
|
|
name: "compose stack type",
|
|
args: args{
|
|
t: portainer.DockerComposeStack,
|
|
},
|
|
want: "compose",
|
|
},
|
|
{
|
|
name: "unknown stack type",
|
|
args: args{
|
|
t: 100,
|
|
},
|
|
want: "",
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
assert.Equal(t, tt.want, GetTranslatedStackType(tt.args.t))
|
|
})
|
|
}
|
|
}
|