summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/e2e/cp_test.go33
-rw-r--r--test/framework/framework.go56
2 files changed, 89 insertions, 0 deletions
diff --git a/test/e2e/cp_test.go b/test/e2e/cp_test.go
index f89865264..591f533d6 100644
--- a/test/e2e/cp_test.go
+++ b/test/e2e/cp_test.go
@@ -112,4 +112,37 @@ var _ = Describe("Podman cp", func() {
}
Expect(string(output)).To(Equal("copy from host to container directory"))
})
+
+ It("podman cp dir to dir", func() {
+ path, err := os.Getwd()
+ if err != nil {
+ os.Exit(1)
+ }
+ testDirPath := filepath.Join(path, "TestDir")
+ err = os.Mkdir(testDirPath, 0777)
+ if err != nil {
+ os.Exit(1)
+ }
+
+ session := podmanTest.Podman([]string{"create", ALPINE, "ls", "/foodir"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ name := session.OutputToString()
+
+ session = podmanTest.Podman([]string{"cp", testDirPath, name + ":/foodir"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ session = podmanTest.Podman([]string{"start", "-a", name})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(len(session.OutputToStringArray())).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"cp", testDirPath, name + ":/foodir"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ session = podmanTest.Podman([]string{"start", "-a", name})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(Equal("TestDir"))
+ })
})
diff --git a/test/framework/framework.go b/test/framework/framework.go
new file mode 100644
index 000000000..52401faf8
--- /dev/null
+++ b/test/framework/framework.go
@@ -0,0 +1,56 @@
+package framework
+
+import (
+ "fmt"
+
+ "github.com/onsi/ginkgo"
+ "github.com/onsi/gomega"
+)
+
+// TestFramework is used to support commonnly used test features
+type TestFramework struct {
+ setup func(*TestFramework) error
+ teardown func(*TestFramework) error
+ TestError error
+}
+
+// NewTestFramework creates a new test framework instance for a given `setup`
+// and `teardown` function
+func NewTestFramework(
+ setup func(*TestFramework) error,
+ teardown func(*TestFramework) error,
+) *TestFramework {
+ return &TestFramework{
+ setup,
+ teardown,
+ fmt.Errorf("error"),
+ }
+}
+
+// NilFn is a convenience function which simply does nothing
+func NilFunc(f *TestFramework) error {
+ return nil
+}
+
+// Setup is the global initialization function which runs before each test
+// suite
+func (t *TestFramework) Setup() {
+ // Global initialization for the whole framework goes in here
+
+ // Setup the actual test suite
+ gomega.Expect(t.setup(t)).To(gomega.Succeed())
+}
+
+// Teardown is the global deinitialization function which runs after each test
+// suite
+func (t *TestFramework) Teardown() {
+ // Global deinitialization for the whole framework goes in here
+
+ // Teardown the actual test suite
+ gomega.Expect(t.teardown(t)).To(gomega.Succeed())
+}
+
+// Describe is a convenience wrapper around the `ginkgo.Describe` function
+func (t *TestFramework) Describe(text string, body func()) bool {
+ return ginkgo.Describe("libpod: "+text, body)
+}