diff --git a/.github/workflows/test-kind.yml b/.github/workflows/test-kind.yml index 2968160..34578c6 100644 --- a/.github/workflows/test-kind.yml +++ b/.github/workflows/test-kind.yml @@ -2,6 +2,9 @@ name: E2E Tests with Kind on: push: + branches: + - main + - go-v1.22 pull_request: jobs: diff --git a/.gitignore b/.gitignore index a2d1621..27f5768 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,5 @@ coverage-output/ *.swo *~ +# SonarQube +.scannerwork/ \ No newline at end of file diff --git a/example_app.go b/example_app.go index 50f5658..c18c76d 100644 --- a/example_app.go +++ b/example_app.go @@ -24,6 +24,9 @@ func Greet(name string) string { if name == "" { return "Hello, stranger!" } + if len(name) < 2 { + return "Are you sure you are human?" + } return "Hello, " + name + "!" } diff --git a/test/e2e_test.go b/test/e2e_test.go index ce8861e..90856da 100644 --- a/test/e2e_test.go +++ b/test/e2e_test.go @@ -72,6 +72,15 @@ var _ = Describe("Application E2E Tests", func() { Expect(string(body)).To(ContainSubstring("Hello, Test!")) }) + It("should handle greet requests with 'unhuman' name", func() { + resp, err := http.Get(appUrl + "/greet?name=X") + Expect(err).NotTo(HaveOccurred()) + defer resp.Body.Close() + body, err := io.ReadAll(resp.Body) + Expect(err).NotTo(HaveOccurred()) + Expect(string(body)).To(ContainSubstring("Are you sure you are human?")) + }) + It("should handle calculate requests", func() { resp, err := http.Get(appUrl + "/calculate") Expect(err).NotTo(HaveOccurred())