/
bundle_test.go
71 lines (62 loc) · 1.74 KB
/
bundle_test.go
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
61
62
63
64
65
66
67
68
69
70
71
package goci_test
import (
"github.com/cloudfoundry-incubator/goci"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Bundle", func() {
var (
initialBundle goci.Bndle
)
BeforeEach(func() {
initialBundle = goci.Bundle()
})
Describe("WithProcess", func() {
It("adds the process to the bundle", func() {
bundle := goci.Bundle().WithProcess(goci.Process("echo", "foo"))
Expect(bundle.Spec.Process).To(Equal(goci.SpecProcess{Args: []string{"echo", "foo"}}))
})
})
Describe("WithMounts", func() {
var bundle goci.Bndle
BeforeEach(func() {
bundle = goci.Bundle().WithMounts(
goci.Mount{
Name: "apple",
Type: "apple_fs",
Source: "iDevice",
Destination: "/apple",
Options: []string{
"healthy",
"shiny",
},
},
goci.Mount{
Name: "banana",
Type: "banana_fs",
Source: "banana_device",
Destination: "/banana",
Options: []string{
"yellow",
"fresh",
},
})
})
It("returns a bundle with the mounts added to the spec", func() {
Expect(bundle.Spec.Mounts).To(ContainElement(goci.SpecMount{Name: "banana", Path: "/banana"}))
Expect(bundle.Spec.Mounts).To(ContainElement(goci.SpecMount{Name: "apple", Path: "/apple"}))
})
It("returns a bundle with the mounts mapped in the runtime spec", func() {
Expect(bundle.RuntimeSpec.Mounts).To(HaveKeyWithValue("banana", goci.RuntimeSpecMount{
Type: "banana_fs",
Source: "banana_device",
Options: []string{"yellow", "fresh"},
}))
Expect(bundle.RuntimeSpec.Mounts).To(HaveKeyWithValue("apple", goci.RuntimeSpecMount{
Type: "apple_fs",
Source: "iDevice",
Options: []string{"healthy", "shiny"},
}))
})
})
})