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
2 changes: 1 addition & 1 deletion base/api/endpoints_debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func ping(ar *Request) (msg string, err error) {

// ready checks if Portmaster has completed starting.
func ready(ar *Request) (msg string, err error) {
if module.instance.Ready() {
if !module.instance.Ready() {
return "", ErrorWithStatus(errors.New("portmaster is not ready, reload (F5) to try again"), http.StatusTooEarly)
}
return "Portmaster is ready.", nil
Expand Down
19 changes: 19 additions & 0 deletions base/api/endpoints_debug_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package api

import (
"testing"
)

// TestReadyEndpoint checks that the ready endpoint reports a ready Portmaster as ready.
func TestReadyEndpoint(t *testing.T) {
t.Parallel()

// The test instance reports that Portmaster is ready.
msg, err := ready(nil)
if err != nil {
t.Fatalf("ready endpoint failed although Portmaster is ready: %s", err)
}
if msg != "Portmaster is ready." {
t.Errorf("unexpected response: %q", msg)
}
}