-
Notifications
You must be signed in to change notification settings - Fork 178
Expand file tree
/
Copy pathpatch_detector_test.go
More file actions
60 lines (53 loc) · 2.44 KB
/
Copy pathpatch_detector_test.go
File metadata and controls
60 lines (53 loc) · 2.44 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 storage_test
import (
"github.com/cloudfoundry/bosh-bootloader/fakes"
"github.com/cloudfoundry/bosh-bootloader/storage"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var _ = Describe("patch detector", func() {
var (
logger *fakes.Logger
)
BeforeEach(func() {
logger = &fakes.Logger{}
})
It("logs the relevant files that it finds", func() {
err := storage.NewPatchDetector("fixtures/patched", logger).Find()
Expect(err).NotTo(HaveOccurred())
Expect(logger.PrintlnCall.Messages).To(HaveLen(2))
Expect(logger.PrintfCall.Messages).To(HaveLen(7))
Expect(logger.PrintlnCall.Messages).To(ContainElement(ContainSubstring("you've supplied the following files to bbl:")))
Expect(logger.PrintfCall.Messages).To(ContainElement(ContainSubstring("create-director-override.sh")))
Expect(logger.PrintfCall.Messages).To(ContainElement(ContainSubstring("create-jumpbox-override.sh")))
Expect(logger.PrintfCall.Messages).To(ContainElement(ContainSubstring("delete-director-override.sh")))
Expect(logger.PrintfCall.Messages).To(ContainElement(ContainSubstring("delete-jumpbox-override.sh")))
Expect(logger.PrintfCall.Messages).To(ContainElement(ContainSubstring("terraform/patched-terraform.tf")))
Expect(logger.PrintfCall.Messages).To(ContainElement(ContainSubstring("vars/patched-vars.tfvars")))
Expect(logger.PrintfCall.Messages).To(ContainElement(ContainSubstring("cloud-config/patch-cloud-config.yml")))
Expect(logger.PrintlnCall.Messages).NotTo(ContainElement(ContainSubstring("UNRELATED_FILE.md")))
Expect(logger.PrintlnCall.Messages).NotTo(ContainElement(ContainSubstring("fixtures")))
Expect(logger.PrintlnCall.Messages).To(ContainElement(ContainSubstring("they will be used by \"bbl up\".")))
})
Context("given an unpatched directory", func() {
It("is silent", func() {
err := storage.NewPatchDetector("fixtures/unpatched", logger).Find()
Expect(err).NotTo(HaveOccurred())
Expect(logger.PrintlnCall.Messages).To(BeEmpty())
})
})
Context("given an unpatched, upped directory", func() {
It("is silent", func() {
err := storage.NewPatchDetector("fixtures/upped", logger).Find()
Expect(err).NotTo(HaveOccurred())
Expect(logger.PrintlnCall.Messages).To(BeEmpty())
})
})
Context("given an empty directory", func() {
It("is silent", func() {
err := storage.NewPatchDetector("fixtures/empty", logger).Find()
Expect(err).NotTo(HaveOccurred())
Expect(logger.PrintlnCall.Messages).To(BeEmpty())
})
})
})