Skip to content

Commit

Permalink
Fix apache#2834: Add E2E for local directory
Browse files Browse the repository at this point in the history
  • Loading branch information
johnpoth committed Jan 6, 2022
1 parent 2933435 commit 990fc61
Showing 1 changed file with 30 additions and 9 deletions.
39 changes: 30 additions & 9 deletions e2e/registry/registry_maven_wagon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ func TestImageRegistryIsAMavenRepository(t *testing.T) {
func TestLocalFilesAreMountedInContainerInDefaultPath(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
name := "laughing-route"
name := "laughing-route-default-path"

// Create integration that reads a file mounted into the container filesystem that was downloaded from the Image Registry
Expect(Kamel("run", "files/LaunghingRoute.java",
Expect(Kamel("run", "files/LaughingRoute.java",
"--name", name,
"-p", "location=files/",
"-d", "file://files/laugh.txt",
"-n", ns,
).Execute()).To(Succeed())
Expand All @@ -87,14 +87,13 @@ func TestLocalFilesAreMountedInContainerInDefaultPath(t *testing.T) {
func TestLocalFilesAreMountedInContainerInCustomPath(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
name := "laughing-route"
customMount := "this/is/a/custom/path/"
name := "laughing-route-custom-path"
customPath := "this/is/a/custom/path/"

// Create integration that reads a file mounted into the container filesystem with a custom path
Expect(Kamel("run", "files/LaunghingRoute.java",
Expect(Kamel("run", "files/LaughingRoute.java",
"--name", name,
"-p", fmt.Sprintf("location=%s", customMount),
"-d", fmt.Sprintf("file://files/laugh.txt:%slaugh.txt", customMount),
"-p", fmt.Sprintf("location=%s", customPath),
"-d", fmt.Sprintf("file://files/laugh.txt:%slaugh.txt", customPath),
"-n", ns,
).Execute()).To(Succeed())

Expand All @@ -106,3 +105,25 @@ func TestLocalFilesAreMountedInContainerInCustomPath(t *testing.T) {
Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}

func TestLocalDirectoryIsMountedInContainer(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
name := "laughing-route-directory"

Expect(Kamel("run", "files/LaughingRoute.java",
"--name", name,
"-p", "location=files/laughs",
"-d", fmt.Sprintf("file://files/laughs/"),
"-n", ns,
).Execute()).To(Succeed())

Eventually(IntegrationPodPhase(ns, name), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
Eventually(IntegrationCondition(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("haha"))
Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("hehe"))

// Clean up
Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}

0 comments on commit 990fc61

Please sign in to comment.