Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/test-kind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: E2E Tests with Kind

on:
push:
branches:
- main
- go-v1.22
pull_request:

jobs:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ coverage-output/
*.swo
*~

# SonarQube
.scannerwork/
3 changes: 3 additions & 0 deletions example_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 + "!"
}

Expand Down
9 changes: 9 additions & 0 deletions test/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
Loading