-
Notifications
You must be signed in to change notification settings - Fork 405
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for flickering application status (#4843)
* External API for the validator * Update deployment args and services for the validator * Add proper port to the deployment * Update dep files and goimports * Fix dep version misalignment * Fix formatting * Update image versions * Remove deprecated labels
- Loading branch information
1 parent
1c9ffc5
commit 10dffb0
Showing
9 changed files
with
106 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
components/application-connectivity-validator/internal/externalapi/externalapi.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package externalapi | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/gorilla/mux" | ||
) | ||
|
||
func NewHandler() http.Handler { | ||
|
||
router := mux.NewRouter() | ||
|
||
router.Path("/v1/health").Handler(NewHealthCheckHandler()) | ||
|
||
return router | ||
} |
12 changes: 12 additions & 0 deletions
12
components/application-connectivity-validator/internal/externalapi/healthcheckhandler.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package externalapi | ||
|
||
import ( | ||
"net/http" | ||
) | ||
|
||
// NewHealthCheckHandler creates handler for performing health check | ||
func NewHealthCheckHandler() http.Handler { | ||
return http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { | ||
w.WriteHeader(http.StatusOK) | ||
}) | ||
} |
27 changes: 27 additions & 0 deletions
27
...onents/application-connectivity-validator/internal/externalapi/healthcheckhandler_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package externalapi | ||
|
||
import ( | ||
"net/http" | ||
"net/http/httptest" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestHealthCheckHandler_HandleRequest(t *testing.T) { | ||
t.Run("should always respond with 200 status code", func(t *testing.T) { | ||
// given | ||
req, err := http.NewRequest(http.MethodGet, "/v1/health", nil) | ||
require.NoError(t, err) | ||
rr := httptest.NewRecorder() | ||
|
||
handler := NewHealthCheckHandler() | ||
|
||
// when | ||
handler.ServeHTTP(rr, req) | ||
|
||
// then | ||
assert.Equal(t, http.StatusOK, rr.Code) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters