forked from docker/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstackclient_test.go
More file actions
60 lines (56 loc) · 1.26 KB
/
Copy pathstackclient_test.go
File metadata and controls
60 lines (56 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package kubernetes
import (
"io/ioutil"
"testing"
composetypes "github.com/docker/cli/cli/compose/types"
"gotest.tools/v3/assert"
)
func TestFromCompose(t *testing.T) {
stackClient := &stackV1Beta1{}
s, err := stackClient.FromCompose(ioutil.Discard, "foo", &composetypes.Config{
Version: "3.1",
Filename: "banana",
Services: []composetypes.ServiceConfig{
{
Name: "foo",
Image: "foo",
},
{
Name: "bar",
Image: "bar",
},
},
})
assert.NilError(t, err)
assert.Equal(t, "foo", s.Name)
assert.Equal(t, string(`version: "3.5"
services:
bar:
image: bar
foo:
image: foo
`), s.ComposeFile)
}
func TestFromComposeUnsupportedVersion(t *testing.T) {
stackClient := &stackV1Beta1{}
_, err := stackClient.FromCompose(ioutil.Discard, "foo", &composetypes.Config{
Version: "3.6",
Filename: "banana",
Services: []composetypes.ServiceConfig{
{
Name: "foo",
Image: "foo",
Volumes: []composetypes.ServiceVolumeConfig{
{
Type: "tmpfs",
Target: "/app",
Tmpfs: &composetypes.ServiceVolumeTmpfs{
Size: 10000,
},
},
},
},
},
})
assert.ErrorContains(t, err, "the compose yaml file is invalid with v3.5: services.foo.volumes.0 Additional property tmpfs is not allowed")
}