-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinject_test.go
49 lines (35 loc) · 1.07 KB
/
inject_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
package main_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
. "github.com/onsi/gomega/gbytes"
. "github.com/bunniesandbeatings/commandgo/runner"
)
var _ = Describe("inject command", func() {
var runner *Runner
BeforeEach(func() {
runner = NewRunner(offspringCLI, "inject")
})
Describe("Statefile as a pipe", func() {
Context("Passing in credentials as an argument", func() {
BeforeEach(func() {
runner.AddArguments("-c", "VeryObscurePassword")
})
Context("Passing in valid credential key", func() {
BeforeEach(func() {
runner.AddArguments("-k", "sensitive-password")
})
It("adds the credential to the output", func() {
command, stdin := runner.PipeCommand()
session, err := Start(command, GinkgoWriter, GinkgoWriter)
Expect(err).ToNot(HaveOccurred())
stdin.Write([]byte("this is a {{sensitive-password}}"))
stdin.Close()
Eventually(session).Should(Say("this is a VeryObscurePassword"))
Eventually(session).Should(Exit(0))
})
})
})
})
})