Skip to content

Commit 920d6b0

Browse files
authored
fix(e2e): update tests to use new manifest file path and route (#665)
1 parent 8f130d8 commit 920d6b0

File tree

13 files changed

+102
-17
lines changed

13 files changed

+102
-17
lines changed

e2e/init/front-end/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
FROM nginx
22

3-
COPY index.html /usr/share/nginx/html
3+
COPY nginx.conf /etc/nginx/nginx.conf
4+
5+
RUN mkdir -p /www/data/front-end
6+
COPY index.html /www/data/front-end

e2e/init/front-end/nginx.conf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
events {
2+
worker_connections 768;
3+
}
4+
5+
http {
6+
server {
7+
root /www/data;
8+
listen 80;
9+
10+
location / {
11+
return 200 'healthcheck okay!';
12+
}
13+
14+
location /front-end/ {
15+
}
16+
}
17+
}

e2e/init/init_suite_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ var _ = BeforeSuite(func() {
3131
})
3232

3333
var _ = AfterSuite(func() {
34-
_, err := cli.AppDelete("api")
34+
_, err := cli.AppDelete("front-end")
3535
Expect(err).NotTo(HaveOccurred())
3636

3737
_, err = cli.EnvDelete("test", "default")

e2e/init/init_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var _ = Describe("init flow", func() {
1717
)
1818

1919
BeforeAll(func() {
20-
appName = "api"
20+
appName = "front-end"
2121
_, initErr = cli.Init(&client.InitRequest{
2222
ProjectName: projectName,
2323
AppName: appName,
@@ -81,8 +81,8 @@ var _ = Describe("init flow", func() {
8181
It("should return a valid route", func() {
8282
Expect(len(app.Routes)).To(Equal(1))
8383
Expect(app.Routes[0].Environment).To(Equal("test"))
84-
Expect(app.Routes[0].Path).To(Equal("*"))
85-
resp, fetchErr := http.Get(fmt.Sprintf("http://%s", app.Routes[0].URL))
84+
Expect(app.Routes[0].Path).To(Equal(appName))
85+
resp, fetchErr := http.Get(fmt.Sprintf("http://%s/%s/", app.Routes[0].URL, app.Routes[0].Path))
8686
Expect(fetchErr).NotTo(HaveOccurred())
8787
Expect(resp.StatusCode).To(Equal(200))
8888
})

e2e/internal/client/cli.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
"os"
66
"os/exec"
7+
"path/filepath"
78
"strings"
89

910
"github.com/onsi/ginkgo"
@@ -69,7 +70,11 @@ type AppDeployInput struct {
6970

7071
// NewCLI returns a wrapper around CLI
7172
func NewCLI() (*CLI, error) {
72-
cliPath := "/bin/ecs-preview"
73+
wd, err := os.Getwd()
74+
if err != nil {
75+
return nil, fmt.Errorf("get wd: %w", err)
76+
}
77+
cliPath := filepath.Join(wd, "..", "..", "bin", "local", "ecs-preview")
7378
if _, err := os.Stat(cliPath); err != nil {
7479
return nil, err
7580
}
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
FROM nginx
22

3-
COPY index.html /usr/share/nginx/html
3+
COPY nginx.conf /etc/nginx/nginx.conf
4+
5+
RUN mkdir -p /www/data/back-end
6+
COPY index.html /www/data/back-end
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
events {
2+
worker_connections 768;
3+
}
4+
5+
http {
6+
server {
7+
root /www/data;
8+
listen 80;
9+
10+
location / {
11+
return 200 'healthcheck okay!';
12+
}
13+
14+
location /back-end/ {
15+
}
16+
}
17+
}
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
FROM nginx
22

3-
COPY index.html /usr/share/nginx/html
3+
COPY nginx.conf /etc/nginx/nginx.conf
4+
5+
RUN mkdir -p /www/data/front-end
6+
COPY index.html /www/data/front-end
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
events {
2+
worker_connections 768;
3+
}
4+
5+
http {
6+
server {
7+
root /www/data;
8+
listen 80;
9+
10+
location / {
11+
return 200 'healthcheck okay!';
12+
}
13+
14+
location /front-end/ {
15+
}
16+
}
17+
}

e2e/multi-app-project/multi_app_project_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ var _ = Describe("Multiple App Project", func() {
8888
})
8989

9090
It("app init should create app manifests", func() {
91-
Expect("./ecs-project/front-end-app.yml").Should(BeAnExistingFile())
92-
Expect("./ecs-project/back-end-app.yml").Should(BeAnExistingFile())
91+
Expect("./ecs-project/front-end/manifest.yml").Should(BeAnExistingFile())
92+
Expect("./ecs-project/back-end/manifest.yml").Should(BeAnExistingFile())
9393

9494
})
9595

@@ -150,8 +150,8 @@ var _ = Describe("Multiple App Project", func() {
150150
// Call each environment's endpoint and ensure it returns a 200
151151
route := app.Routes[0]
152152
Expect(route.Environment).To(Equal("test"))
153-
Expect(route.Path).To(Equal("*"))
154-
resp, fetchErr := http.Get(fmt.Sprintf("http://%s", route.URL))
153+
Expect(route.Path).To(Equal(appName))
154+
resp, fetchErr := http.Get(fmt.Sprintf("http://%s/%s/", route.URL, route.Path))
155155
Expect(fetchErr).NotTo(HaveOccurred())
156156
Expect(resp.StatusCode).To(Equal(200))
157157

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
FROM nginx
22

3-
COPY index.html /usr/share/nginx/html
3+
COPY nginx.conf /etc/nginx/nginx.conf
4+
5+
RUN mkdir -p /www/data/front-end
6+
COPY index.html /www/data/front-end
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
events {
2+
worker_connections 768;
3+
}
4+
5+
http {
6+
server {
7+
root /www/data;
8+
listen 80;
9+
10+
location / {
11+
return 200 'healthcheck okay!';
12+
}
13+
14+
location /front-end/ {
15+
}
16+
}
17+
}

e2e/multi-env-project/multi_env_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ var _ = Describe("Multiple Env Project", func() {
103103
_, frontEndInitErr = cli.AppInit(&client.AppInitRequest{
104104
AppName: "front-end",
105105
AppType: "Load Balanced Web App",
106-
Dockerfile: "./front-end/Dockerfile", //TODO FIX MEH
106+
Dockerfile: "./front-end/Dockerfile",
107107
})
108108
})
109109

@@ -112,7 +112,7 @@ var _ = Describe("Multiple Env Project", func() {
112112
})
113113

114114
It("app init should create an app manifest", func() {
115-
Expect("./ecs-project/front-end-app.yml").Should(BeAnExistingFile())
115+
Expect("./ecs-project/front-end/manifest.yml").Should(BeAnExistingFile())
116116
})
117117

118118
It("app ls should list the app", func() {
@@ -170,8 +170,8 @@ var _ = Describe("Multiple Env Project", func() {
170170
for _, env := range []string{"test", "prod"} {
171171
route := envRoutes[env]
172172
Expect(route.Environment).To(Equal(env))
173-
Expect(route.Path).To(Equal("*"))
174-
resp, fetchErr := http.Get(fmt.Sprintf("http://%s", route.URL))
173+
Expect(route.Path).To(Equal(appName))
174+
resp, fetchErr := http.Get(fmt.Sprintf("http://%s/%s/", route.URL, route.Path))
175175
Expect(fetchErr).NotTo(HaveOccurred())
176176
Expect(resp.StatusCode).To(Equal(200))
177177
}

0 commit comments

Comments
 (0)