+func TestHealthxAppFail(t *testing.T) {
+ svr := httptest.NewUnstartedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.WriteHeader(501)
+ }))
+
+ svr.Listener.Close()
+ svr.Listener, _ = net.Listen("tcp", ricdms.Config.MockServer)
+
+ svr.Start()
+ defer svr.Close()
+
+ resp := rh.GetxAppHealth("test", "test")
+ switch resp.(type) {
+ case *h.GetHealthCheckOK:
+ assert.Fail(t, "Health check should not be okay: %v", resp)
+
+ case *h.GetHealthCheckInternalServerError:
+ break
+
+ default:
+ assert.Fail(t, "Unknown type of resp : %v", resp)
+ }
+}
+
+func TestHealthxApp(t *testing.T) {
+ svr := httptest.NewUnstartedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.WriteHeader(http.StatusOK)
+ }))
+
+ svr.Listener.Close()
+ svr.Listener, _ = net.Listen("tcp", ricdms.Config.MockServer)
+
+ svr.Start()
+ defer svr.Close()
+
+ resp := rh.GetxAppHealth("test", "test")
+ switch resp.(type) {
+ case *h.GetHealthCheckOK:
+ assert.Equal(t, successStatus, resp.(*h.GetHealthCheckOK).Payload)
+
+ case *h.GetHealthCheckInternalServerError:
+ assert.Fail(t, "Internal Server generated: %v", resp)
+
+ default:
+ assert.Fail(t, "Unknown type of resp : %v", resp)
+ }
+}
+