Skip to content

Commit

Permalink
- Test coverage for probation server module
Browse files Browse the repository at this point in the history
  • Loading branch information
ciroque committed Oct 25, 2023
1 parent f945c3d commit 16e7f65
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions internal/probation/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ package probation

import (
"github.com/nginxinc/kubernetes-nginx-ingress/test/mocks"
"github.com/sirupsen/logrus"
"net/http"
"testing"
)

Expand Down Expand Up @@ -51,3 +53,21 @@ func TestHealthServer_HandleFailCheck(t *testing.T) {
t.Errorf("Expected 'Service Not Available', got %v", body)
}
}

func TestHealthServer_Start(t *testing.T) {
server := NewHealthServer()
server.Start()

response, err := http.Get("http://localhost:51031/livez")
if err != nil {
t.Error(err)
}

if response.StatusCode != http.StatusOK {
t.Errorf("Expected status code %v, got %v", http.StatusAccepted, response.StatusCode)
}

logrus.Infof("recevied a response from the probe server: %v", response)

server.Stop()
}

0 comments on commit 16e7f65

Please sign in to comment.