From 6ee0989a5bde6413fb2a2f97ddfa7c0eadb9db96 Mon Sep 17 00:00:00 2001 From: Pavel Sturc Date: Sun, 19 Oct 2025 09:19:26 +0200 Subject: [PATCH 1/2] test: uncovered change --- .github/workflows/test-kind.yml | 3 +++ .gitignore | 2 ++ example_app.go | 3 +++ 3 files changed, 8 insertions(+) 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 + "!" } From 71c717c7b7a4014e6ed9fd35ff144b6914b3b4f1 Mon Sep 17 00:00:00 2001 From: Pavel Sturc Date: Sun, 19 Oct 2025 09:30:16 +0200 Subject: [PATCH 2/2] fix: cover the change by e2e test --- test/e2e_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) 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())