2018-02-20 10:31:08 -05:00
|
|
|
package kubernetes
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
composetypes "github.com/docker/cli/cli/compose/types"
|
|
|
|
apiv1beta1 "github.com/docker/cli/kubernetes/compose/v1beta1"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestLoadStack(t *testing.T) {
|
2018-02-21 12:31:52 -05:00
|
|
|
s, err := LoadStack("foo", composetypes.Config{
|
|
|
|
Version: "3.1",
|
2018-02-20 10:31:08 -05:00
|
|
|
Filename: "banana",
|
|
|
|
Services: []composetypes.ServiceConfig{
|
|
|
|
{
|
|
|
|
Name: "foo",
|
|
|
|
Image: "foo",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "bar",
|
|
|
|
Image: "bar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
require.NoError(t, err)
|
|
|
|
require.Equal(t, &apiv1beta1.Stack{
|
|
|
|
ObjectMeta: metav1.ObjectMeta{
|
|
|
|
Name: "foo",
|
|
|
|
},
|
|
|
|
Spec: apiv1beta1.StackSpec{
|
2018-02-21 12:31:52 -05:00
|
|
|
ComposeFile: string(`version: "3.1"
|
2018-02-20 10:31:08 -05:00
|
|
|
services:
|
|
|
|
bar:
|
|
|
|
image: bar
|
|
|
|
foo:
|
|
|
|
image: foo
|
2018-02-21 12:31:52 -05:00
|
|
|
networks: {}
|
2018-02-20 10:31:08 -05:00
|
|
|
volumes: {}
|
2018-02-21 12:31:52 -05:00
|
|
|
secrets: {}
|
|
|
|
configs: {}
|
2018-02-20 10:31:08 -05:00
|
|
|
`),
|
|
|
|
},
|
|
|
|
}, s)
|
|
|
|
}
|