mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 20:47:32 +00:00
simple test of a health endpoint
This commit is contained in:
@@ -5,9 +5,7 @@ import (
|
||||
_ "embed"
|
||||
"errors"
|
||||
"io"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
@@ -71,30 +69,3 @@ func initConfig() {
|
||||
logging.WithFields("file", file).OnError(err).Warn("unable to read config file")
|
||||
}
|
||||
}
|
||||
|
||||
type TestServer struct {
|
||||
*start.Server
|
||||
wg sync.WaitGroup
|
||||
}
|
||||
|
||||
func (s *TestServer) Done() {
|
||||
s.Shutdown <- os.Interrupt
|
||||
s.wg.Wait()
|
||||
}
|
||||
|
||||
func NewTestServer(args []string) *TestServer {
|
||||
testServer := new(TestServer)
|
||||
server := make(chan *start.Server, 1)
|
||||
|
||||
testServer.wg.Add(1)
|
||||
go func(wg *sync.WaitGroup) {
|
||||
defer wg.Done()
|
||||
|
||||
cmd := New(os.Stdout, os.Stdin, args, server)
|
||||
cmd.SetArgs(args)
|
||||
logging.OnError(cmd.Execute()).Fatal()
|
||||
}(&testServer.wg)
|
||||
|
||||
testServer.Server = <-server
|
||||
return testServer
|
||||
}
|
||||
|
Reference in New Issue
Block a user