From d52f75f3592b103b5b6db1621dde08a651d81cca Mon Sep 17 00:00:00 2001 From: Shailie Jain Date: Fri, 27 Oct 2017 15:54:38 -0700 Subject: [PATCH 1/2] checking text --- tests/ginkgo/temp_test.go | 53 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 tests/ginkgo/temp_test.go diff --git a/tests/ginkgo/temp_test.go b/tests/ginkgo/temp_test.go new file mode 100644 index 000000000..c7ba3cc68 --- /dev/null +++ b/tests/ginkgo/temp_test.go @@ -0,0 +1,53 @@ +package ginkgo + +import ( + "path" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + "github.com/replicatedcom/support-bundle/cmd" +) + +var _ = Describe("Checking contents of the file", func() { + + BeforeEach(EnterNewTempDir) + AfterEach(CleanupDir) + + It("Validating text in blah.txt", func() { + + WriteFile("blah.txt", ` +Hello World! +What's in my Bundle`) + + WriteFile("config.yml", ` +specs: + - builtin: core.read-file + raw: /daemon/etc/default/replicated + config: + file_path: blah.txt + `) + /* + - builtin: core.read-file + raw: /daemon/etc/default/replicated + config: + file_path: /etc/default/replicated */ + + err := cmd.Generate( + path.Join(tmpdir, "config.yml"), + path.Join(tmpdir, "bundle.tar.gz"), + true, + 60, + ) + + Expect(err).To(BeNil()) + + contents := ReadFileFromBundle( + path.Join("bundle.tar.gz"), + "/daemon/etc/default/replicated", + ) + Expect(contents).To(ContainSubstring("Hello World!")) + Expect(contents).To(ContainSubstring("What's in my Bundle")) + + }) + +}) From bc43ab0a2d873c36a554c68e27da325d2ed83845 Mon Sep 17 00:00:00 2001 From: Shailie Jain Date: Fri, 27 Oct 2017 16:01:16 -0700 Subject: [PATCH 2/2] one w/o comments --- tests/ginkgo/temp_test.go | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/tests/ginkgo/temp_test.go b/tests/ginkgo/temp_test.go index c7ba3cc68..51d162bdf 100644 --- a/tests/ginkgo/temp_test.go +++ b/tests/ginkgo/temp_test.go @@ -16,8 +16,8 @@ var _ = Describe("Checking contents of the file", func() { It("Validating text in blah.txt", func() { WriteFile("blah.txt", ` -Hello World! -What's in my Bundle`) +Hey there! +Let's take a peek into my file!`) WriteFile("config.yml", ` specs: @@ -26,11 +26,6 @@ specs: config: file_path: blah.txt `) - /* - - builtin: core.read-file - raw: /daemon/etc/default/replicated - config: - file_path: /etc/default/replicated */ err := cmd.Generate( path.Join(tmpdir, "config.yml"), @@ -45,8 +40,8 @@ specs: path.Join("bundle.tar.gz"), "/daemon/etc/default/replicated", ) - Expect(contents).To(ContainSubstring("Hello World!")) - Expect(contents).To(ContainSubstring("What's in my Bundle")) + Expect(contents).To(ContainSubstring("Hey there!")) + Expect(contents).To(ContainSubstring("Let's take a peek into my file!")) })