diff options
author | Valentin Rothberg <rothberg@redhat.com> | 2019-06-24 11:29:13 +0200 |
---|---|---|
committer | Valentin Rothberg <rothberg@redhat.com> | 2019-06-24 13:20:59 +0200 |
commit | d697456dc90adbaf68224ed7c115b38d5855e582 (patch) | |
tree | 5fd88c48b34e7bead0028fa97e39f43f03880642 /vendor/github.com/onsi/gomega/gexec | |
parent | a3211b73c62a9fcc13f09305bf629ef507b26d34 (diff) | |
download | podman-d697456dc90adbaf68224ed7c115b38d5855e582.tar.gz podman-d697456dc90adbaf68224ed7c115b38d5855e582.tar.bz2 podman-d697456dc90adbaf68224ed7c115b38d5855e582.zip |
migrate to go-modules
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'vendor/github.com/onsi/gomega/gexec')
6 files changed, 0 insertions, 667 deletions
diff --git a/vendor/github.com/onsi/gomega/gexec/_fixture/firefly/main.go b/vendor/github.com/onsi/gomega/gexec/_fixture/firefly/main.go deleted file mode 100644 index 16091c22b..000000000 --- a/vendor/github.com/onsi/gomega/gexec/_fixture/firefly/main.go +++ /dev/null @@ -1,36 +0,0 @@ -package main - -import ( - "fmt" - "math/rand" - "os" - "strconv" - "time" -) - -var outQuote = "We've done the impossible, and that makes us mighty." -var errQuote = "Ah, curse your sudden but inevitable betrayal!" - -var randomQuotes = []string{ - "Can we maybe vote on the whole murdering people issue?", - "I swear by my pretty floral bonnet, I will end you.", - "My work's illegal, but at least it's honest.", -} - -func main() { - fmt.Fprintln(os.Stdout, outQuote) - fmt.Fprintln(os.Stderr, errQuote) - - randomIndex := rand.New(rand.NewSource(time.Now().UnixNano())).Intn(len(randomQuotes)) - - time.Sleep(100 * time.Millisecond) - - fmt.Fprintln(os.Stdout, randomQuotes[randomIndex]) - - if len(os.Args) == 2 { - exitCode, _ := strconv.Atoi(os.Args[1]) - os.Exit(exitCode) - } else { - os.Exit(randomIndex) - } -} diff --git a/vendor/github.com/onsi/gomega/gexec/build_test.go b/vendor/github.com/onsi/gomega/gexec/build_test.go deleted file mode 100644 index 295dac8bc..000000000 --- a/vendor/github.com/onsi/gomega/gexec/build_test.go +++ /dev/null @@ -1,112 +0,0 @@ -package gexec_test - -import ( - "fmt" - "io/ioutil" - "os" - "path/filepath" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/onsi/gomega/gexec" -) - -var packagePath = "./_fixture/firefly" - -var _ = Describe(".Build", func() { - Context("when there have been previous calls to Build", func() { - BeforeEach(func() { - _, err := gexec.Build(packagePath) - Expect(err).ShouldNot(HaveOccurred()) - }) - - It("compiles the specified package", func() { - compiledPath, err := gexec.Build(packagePath) - Expect(err).ShouldNot(HaveOccurred()) - Expect(compiledPath).Should(BeAnExistingFile()) - }) - - Context("and CleanupBuildArtifacts has been called", func() { - BeforeEach(func() { - gexec.CleanupBuildArtifacts() - }) - - It("compiles the specified package", func() { - var err error - fireflyPath, err = gexec.Build(packagePath) - Expect(err).ShouldNot(HaveOccurred()) - Expect(fireflyPath).Should(BeAnExistingFile()) - }) - }) - }) -}) - -var _ = Describe(".BuildWithEnvironment", func() { - var err error - env := []string{ - "GOOS=linux", - "GOARCH=amd64", - } - - It("compiles the specified package with the specified env vars", func() { - compiledPath, err := gexec.BuildWithEnvironment(packagePath, env) - Expect(err).ShouldNot(HaveOccurred()) - Expect(compiledPath).Should(BeAnExistingFile()) - }) - - It("returns the environment to a good state", func() { - _, err = gexec.BuildWithEnvironment(packagePath, env) - Expect(err).ShouldNot(HaveOccurred()) - Expect(os.Environ()).ShouldNot(ContainElement("GOOS=linux")) - }) -}) - -var _ = Describe(".BuildIn", func() { - const ( - target = "github.com/onsi/gomega/gexec/_fixture/firefly/" - ) - - var ( - original string - gopath string - ) - - BeforeEach(func() { - var err error - original = os.Getenv("GOPATH") - gopath, err = ioutil.TempDir("", "") - Expect(err).NotTo(HaveOccurred()) - copyFile(filepath.Join("_fixture", "firefly", "main.go"), filepath.Join(gopath, "src", target), "main.go") - Expect(os.Setenv("GOPATH", filepath.Join(os.TempDir(), "emptyFakeGopath"))).To(Succeed()) - Expect(os.Environ()).To(ContainElement(fmt.Sprintf("GOPATH=%s", filepath.Join(os.TempDir(), "emptyFakeGopath")))) - }) - - AfterEach(func() { - if original == "" { - Expect(os.Unsetenv("GOPATH")).To(Succeed()) - } else { - Expect(os.Setenv("GOPATH", original)).To(Succeed()) - } - if gopath != "" { - os.RemoveAll(gopath) - } - }) - - It("appends the gopath env var", func() { - _, err := gexec.BuildIn(gopath, target) - Expect(err).NotTo(HaveOccurred()) - }) - - It("resets GOPATH to its original value", func() { - _, err := gexec.BuildIn(gopath, target) - Expect(err).NotTo(HaveOccurred()) - Expect(os.Getenv("GOPATH")).To(Equal(filepath.Join(os.TempDir(), "emptyFakeGopath"))) - }) -}) - -func copyFile(source, directory, basename string) { - Expect(os.MkdirAll(directory, 0755)).To(Succeed()) - content, err := ioutil.ReadFile(source) - Expect(err).NotTo(HaveOccurred()) - Expect(ioutil.WriteFile(filepath.Join(directory, basename), content, 0644)).To(Succeed()) -} diff --git a/vendor/github.com/onsi/gomega/gexec/exit_matcher_test.go b/vendor/github.com/onsi/gomega/gexec/exit_matcher_test.go deleted file mode 100644 index 9abc3226f..000000000 --- a/vendor/github.com/onsi/gomega/gexec/exit_matcher_test.go +++ /dev/null @@ -1,114 +0,0 @@ -package gexec_test - -import ( - "os/exec" - "time" - - . "github.com/onsi/gomega/gexec" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -type NeverExits struct{} - -func (e NeverExits) ExitCode() int { - return -1 -} - -var _ = Describe("ExitMatcher", func() { - var command *exec.Cmd - var session *Session - - BeforeEach(func() { - var err error - command = exec.Command(fireflyPath, "0") - session, err = Start(command, nil, nil) - Expect(err).ShouldNot(HaveOccurred()) - }) - - Describe("when passed something that is an Exiter", func() { - It("should act normally", func() { - failures := InterceptGomegaFailures(func() { - Expect(NeverExits{}).Should(Exit()) - }) - - Expect(failures[0]).Should(ContainSubstring("Expected process to exit. It did not.")) - }) - }) - - Describe("when passed something that is not an Exiter", func() { - It("should error", func() { - failures := InterceptGomegaFailures(func() { - Expect("aardvark").Should(Exit()) - }) - - Expect(failures[0]).Should(ContainSubstring("Exit must be passed a gexec.Exiter")) - }) - }) - - Context("with no exit code", func() { - It("should say the right things when it fails", func() { - Expect(session).ShouldNot(Exit()) - - failures := InterceptGomegaFailures(func() { - Expect(session).Should(Exit()) - }) - - Expect(failures[0]).Should(ContainSubstring("Expected process to exit. It did not.")) - - Eventually(session).Should(Exit()) - - Expect(session).Should(Exit()) - - failures = InterceptGomegaFailures(func() { - Expect(session).ShouldNot(Exit()) - }) - - Expect(failures[0]).Should(ContainSubstring("Expected process not to exit. It did.")) - }) - }) - - Context("with an exit code", func() { - It("should say the right things when it fails", func() { - Expect(session).ShouldNot(Exit(0)) - Expect(session).ShouldNot(Exit(1)) - - failures := InterceptGomegaFailures(func() { - Expect(session).Should(Exit(0)) - }) - - Expect(failures[0]).Should(ContainSubstring("Expected process to exit. It did not.")) - - Eventually(session).Should(Exit(0)) - - Expect(session).Should(Exit(0)) - - failures = InterceptGomegaFailures(func() { - Expect(session).Should(Exit(1)) - }) - - Expect(failures[0]).Should(ContainSubstring("to match exit code:")) - - Expect(session).ShouldNot(Exit(1)) - - failures = InterceptGomegaFailures(func() { - Expect(session).ShouldNot(Exit(0)) - }) - - Expect(failures[0]).Should(ContainSubstring("not to match exit code:")) - }) - }) - - Describe("bailing out early", func() { - It("should bail out early once the process exits", func() { - t := time.Now() - - failures := InterceptGomegaFailures(func() { - Eventually(session).Should(Exit(1)) - }) - Expect(time.Since(t)).Should(BeNumerically("<=", 500*time.Millisecond)) - Expect(failures).Should(HaveLen(1)) - }) - }) -}) diff --git a/vendor/github.com/onsi/gomega/gexec/gexec_suite_test.go b/vendor/github.com/onsi/gomega/gexec/gexec_suite_test.go deleted file mode 100644 index dc8e1f40c..000000000 --- a/vendor/github.com/onsi/gomega/gexec/gexec_suite_test.go +++ /dev/null @@ -1,26 +0,0 @@ -package gexec_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/onsi/gomega/gexec" - - "testing" -) - -var fireflyPath string - -func TestGexec(t *testing.T) { - BeforeSuite(func() { - var err error - fireflyPath, err = gexec.Build("./_fixture/firefly") - Expect(err).ShouldNot(HaveOccurred()) - }) - - AfterSuite(func() { - gexec.CleanupBuildArtifacts() - }) - - RegisterFailHandler(Fail) - RunSpecs(t, "Gexec Suite") -} diff --git a/vendor/github.com/onsi/gomega/gexec/prefixed_writer_test.go b/vendor/github.com/onsi/gomega/gexec/prefixed_writer_test.go deleted file mode 100644 index e847b1501..000000000 --- a/vendor/github.com/onsi/gomega/gexec/prefixed_writer_test.go +++ /dev/null @@ -1,43 +0,0 @@ -package gexec_test - -import ( - "bytes" - - . "github.com/onsi/gomega/gexec" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -var _ = Describe("PrefixedWriter", func() { - var buffer *bytes.Buffer - var writer *PrefixedWriter - BeforeEach(func() { - buffer = &bytes.Buffer{} - writer = NewPrefixedWriter("[p]", buffer) - }) - - It("should emit the prefix on newlines", func() { - writer.Write([]byte("abc")) - writer.Write([]byte("def\n")) - writer.Write([]byte("hij\n")) - writer.Write([]byte("\n\n")) - writer.Write([]byte("klm\n\nnop")) - writer.Write([]byte("")) - writer.Write([]byte("qrs")) - writer.Write([]byte("\ntuv\nwx")) - writer.Write([]byte("yz\n\n")) - - Expect(buffer.String()).Should(Equal(`[p]abcdef -[p]hij -[p] -[p] -[p]klm -[p] -[p]nopqrs -[p]tuv -[p]wxyz -[p] -`)) - }) -}) diff --git a/vendor/github.com/onsi/gomega/gexec/session_test.go b/vendor/github.com/onsi/gomega/gexec/session_test.go deleted file mode 100644 index 6fdf22d21..000000000 --- a/vendor/github.com/onsi/gomega/gexec/session_test.go +++ /dev/null @@ -1,336 +0,0 @@ -package gexec_test - -import ( - "io" - "io/ioutil" - "os/exec" - "syscall" - "time" - - . "github.com/onsi/gomega/gbytes" - . "github.com/onsi/gomega/gexec" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -var _ = Describe("Session", func() { - var command *exec.Cmd - var session *Session - - var outWriter, errWriter io.Writer - - BeforeEach(func() { - outWriter = nil - errWriter = nil - }) - - JustBeforeEach(func() { - command = exec.Command(fireflyPath) - var err error - session, err = Start(command, outWriter, errWriter) - Expect(err).ShouldNot(HaveOccurred()) - }) - - Context("running a command", func() { - It("should start the process", func() { - Expect(command.Process).ShouldNot(BeNil()) - }) - - It("should wrap the process's stdout and stderr with gbytes buffers", func(done Done) { - Eventually(session.Out).Should(Say("We've done the impossible, and that makes us mighty")) - Eventually(session.Err).Should(Say("Ah, curse your sudden but inevitable betrayal!")) - defer session.Out.CancelDetects() - - select { - case <-session.Out.Detect("Can we maybe vote on the whole murdering people issue"): - Eventually(session).Should(Exit(0)) - case <-session.Out.Detect("I swear by my pretty floral bonnet, I will end you."): - Eventually(session).Should(Exit(1)) - case <-session.Out.Detect("My work's illegal, but at least it's honest."): - Eventually(session).Should(Exit(2)) - } - - close(done) - }) - - It("should satisfy the gbytes.BufferProvider interface, passing Stdout", func() { - Eventually(session).Should(Say("We've done the impossible, and that makes us mighty")) - Eventually(session).Should(Exit()) - }) - }) - - Describe("providing the exit code", func() { - It("should provide the app's exit code", func() { - Expect(session.ExitCode()).Should(Equal(-1)) - - Eventually(session).Should(Exit()) - Expect(session.ExitCode()).Should(BeNumerically(">=", 0)) - Expect(session.ExitCode()).Should(BeNumerically("<", 3)) - }) - }) - - Describe("wait", func() { - It("should wait till the command exits", func() { - Expect(session.ExitCode()).Should(Equal(-1)) - Expect(session.Wait().ExitCode()).Should(BeNumerically(">=", 0)) - Expect(session.Wait().ExitCode()).Should(BeNumerically("<", 3)) - }) - }) - - Describe("exited", func() { - It("should close when the command exits", func() { - Eventually(session.Exited).Should(BeClosed()) - Expect(session.ExitCode()).ShouldNot(Equal(-1)) - }) - }) - - Describe("kill", func() { - It("should kill the command", func() { - session, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Expect(err).ShouldNot(HaveOccurred()) - - session.Kill() - Eventually(session).Should(Exit(128 + 9)) - }) - }) - - Describe("interrupt", func() { - It("should interrupt the command", func() { - session, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Expect(err).ShouldNot(HaveOccurred()) - - session.Interrupt() - Eventually(session).Should(Exit(128 + 2)) - }) - }) - - Describe("terminate", func() { - It("should terminate the command", func() { - session, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Expect(err).ShouldNot(HaveOccurred()) - - session.Terminate() - Eventually(session).Should(Exit(128 + 15)) - }) - }) - - Describe("signal", func() { - It("should send the signal to the command", func() { - session, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Expect(err).ShouldNot(HaveOccurred()) - - session.Signal(syscall.SIGABRT) - Eventually(session).Should(Exit(128 + 6)) - }) - - It("should ignore sending a signal if the command did not start", func() { - session, err := Start(exec.Command("notexisting"), GinkgoWriter, GinkgoWriter) - Expect(err).To(HaveOccurred()) - - Expect(func() { session.Signal(syscall.SIGUSR1) }).NotTo(Panic()) - }) - }) - - Context("tracking sessions", func() { - BeforeEach(func() { - KillAndWait() - }) - - Describe("kill", func() { - It("should kill all the started sessions", func() { - session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Expect(err).ShouldNot(HaveOccurred()) - - session2, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Expect(err).ShouldNot(HaveOccurred()) - - session3, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Expect(err).ShouldNot(HaveOccurred()) - - Kill() - - Eventually(session1).Should(Exit(128 + 9)) - Eventually(session2).Should(Exit(128 + 9)) - Eventually(session3).Should(Exit(128 + 9)) - }) - - It("should not track unstarted sessions", func() { - _, err := Start(exec.Command("does not exist", "10000000"), GinkgoWriter, GinkgoWriter) - Expect(err).Should(HaveOccurred()) - - session2, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Expect(err).ShouldNot(HaveOccurred()) - - session3, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Expect(err).ShouldNot(HaveOccurred()) - - Kill() - - Eventually(session2).Should(Exit(128 + 9)) - Eventually(session3).Should(Exit(128 + 9)) - }) - - }) - - Describe("killAndWait", func() { - It("should kill all the started sessions and wait for them to finish", func() { - session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Expect(err).ShouldNot(HaveOccurred()) - - session2, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Expect(err).ShouldNot(HaveOccurred()) - - session3, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Expect(err).ShouldNot(HaveOccurred()) - - KillAndWait() - Expect(session1).Should(Exit(128+9), "Should have exited") - Expect(session2).Should(Exit(128+9), "Should have exited") - Expect(session3).Should(Exit(128+9), "Should have exited") - }) - }) - - Describe("terminate", func() { - It("should terminate all the started sessions", func() { - session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Expect(err).ShouldNot(HaveOccurred()) - - session2, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Expect(err).ShouldNot(HaveOccurred()) - - session3, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Expect(err).ShouldNot(HaveOccurred()) - - Terminate() - - Eventually(session1).Should(Exit(128 + 15)) - Eventually(session2).Should(Exit(128 + 15)) - Eventually(session3).Should(Exit(128 + 15)) - }) - }) - - Describe("terminateAndWait", func() { - It("should terminate all the started sessions, and wait for them to exit", func() { - session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Expect(err).ShouldNot(HaveOccurred()) - - session2, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Expect(err).ShouldNot(HaveOccurred()) - - session3, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Expect(err).ShouldNot(HaveOccurred()) - - TerminateAndWait() - - Expect(session1).Should(Exit(128+15), "Should have exited") - Expect(session2).Should(Exit(128+15), "Should have exited") - Expect(session3).Should(Exit(128+15), "Should have exited") - }) - }) - - Describe("signal", func() { - It("should signal all the started sessions", func() { - session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Expect(err).ShouldNot(HaveOccurred()) - - session2, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Expect(err).ShouldNot(HaveOccurred()) - - session3, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Expect(err).ShouldNot(HaveOccurred()) - - Signal(syscall.SIGABRT) - - Eventually(session1).Should(Exit(128 + 6)) - Eventually(session2).Should(Exit(128 + 6)) - Eventually(session3).Should(Exit(128 + 6)) - }) - }) - - Describe("interrupt", func() { - It("should interrupt all the started sessions, and not wait", func() { - session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Expect(err).ShouldNot(HaveOccurred()) - - session2, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Expect(err).ShouldNot(HaveOccurred()) - - session3, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Expect(err).ShouldNot(HaveOccurred()) - - Interrupt() - - Eventually(session1).Should(Exit(128 + 2)) - Eventually(session2).Should(Exit(128 + 2)) - Eventually(session3).Should(Exit(128 + 2)) - }) - }) - }) - - Context("when the command exits", func() { - It("should close the buffers", func() { - Eventually(session).Should(Exit()) - - Expect(session.Out.Closed()).Should(BeTrue()) - Expect(session.Err.Closed()).Should(BeTrue()) - - Expect(session.Out).Should(Say("We've done the impossible, and that makes us mighty")) - }) - - var So = It - - So("this means that eventually should short circuit", func() { - t := time.Now() - failures := InterceptGomegaFailures(func() { - Eventually(session).Should(Say("blah blah blah blah blah")) - }) - Expect(time.Since(t)).Should(BeNumerically("<=", 500*time.Millisecond)) - Expect(failures).Should(HaveLen(1)) - }) - }) - - Context("when wrapping out and err", func() { - var ( - outWriterBuffer, errWriterBuffer *Buffer - ) - - BeforeEach(func() { - outWriterBuffer = NewBuffer() - outWriter = outWriterBuffer - errWriterBuffer = NewBuffer() - errWriter = errWriterBuffer - }) - - It("should route to both the provided writers and the gbytes buffers", func() { - Eventually(session.Out).Should(Say("We've done the impossible, and that makes us mighty")) - Eventually(session.Err).Should(Say("Ah, curse your sudden but inevitable betrayal!")) - - Expect(outWriterBuffer.Contents()).Should(ContainSubstring("We've done the impossible, and that makes us mighty")) - Expect(errWriterBuffer.Contents()).Should(ContainSubstring("Ah, curse your sudden but inevitable betrayal!")) - - Eventually(session).Should(Exit()) - - Expect(outWriterBuffer.Contents()).Should(Equal(session.Out.Contents())) - Expect(errWriterBuffer.Contents()).Should(Equal(session.Err.Contents())) - }) - - Context("when discarding the output of the command", func() { - BeforeEach(func() { - outWriter = ioutil.Discard - errWriter = ioutil.Discard - }) - - It("executes succesfuly", func() { - Eventually(session).Should(Exit()) - }) - }) - }) - - Describe("when the command fails to start", func() { - It("should return an error", func() { - _, err := Start(exec.Command("agklsjdfas"), nil, nil) - Expect(err).Should(HaveOccurred()) - }) - }) -}) |