Skip to content

Commit

Permalink
ping mock server
Browse files Browse the repository at this point in the history
  • Loading branch information
rakeshsharma14317 committed Dec 7, 2023
1 parent 29e9854 commit 6f54992
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions cli/pkg/mock/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import (
"context"
"encoding/hex"
"fmt"
"net/http"
"time"

"github.com/google/go-github/v50/github"
"github.com/rilldata/rill/admin"
"github.com/rilldata/rill/admin/server"
admincli "github.com/rilldata/rill/cli/cmd/admin"
adminv1 "github.com/rilldata/rill/proto/gen/rill/admin/v1"
"github.com/rilldata/rill/runtime/pkg/activity"
"github.com/rilldata/rill/runtime/pkg/email"
"github.com/rilldata/rill/runtime/pkg/observability"
Expand Down Expand Up @@ -120,8 +120,21 @@ func CheckServerStatus(srv *server.Server) error {
resultChan := make(chan error, 1)

go func() {
_, err := srv.Ping(ctx, &adminv1.PingRequest{})
resultChan <- err
resp, err := http.Get("http://localhost:8080/v1/ping")
if err != nil {
resultChan <- err
return
}
defer resp.Body.Close()

// Additional check for response status, if needed
if resp.StatusCode != http.StatusOK {
resultChan <- fmt.Errorf("unexpected status code: %d", resp.StatusCode)
return
}

// If everything's fine, signal no error
resultChan <- nil
}()

select {
Expand Down

0 comments on commit 6f54992

Please sign in to comment.