diff options
author | Pavlo Strokov <pstrokov@gitlab.com> | 2020-05-06 15:24:35 +0300 |
---|---|---|
committer | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2020-05-06 15:24:35 +0300 |
commit | c1a0129bf7c6769a7a4316b2b003e2109d0524dd (patch) | |
tree | 5acd4f694ea713b15ef93a0e4479c6b28e6ef487 /internal/testhelper | |
parent | feb75fc196dc07256d95aeb6d66387ebd35fbe08 (diff) |
Praefect: configuration verification
Praefect uses a .toml file as a source of configuration.
Before praefect starts handle requests the verification
must be executed to check if configuration is correct.
All `gitaly`-s must use distinct addresses.
Any virtual node must have at least one gitaly behind it.
Each virtual node must be named.
Diffstat (limited to 'internal/testhelper')
-rw-r--r-- | internal/testhelper/testserver.go | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/internal/testhelper/testserver.go b/internal/testhelper/testserver.go index efdf1dbe5..af0aca243 100644 --- a/internal/testhelper/testserver.go +++ b/internal/testhelper/testserver.go @@ -126,17 +126,13 @@ func (p *TestServer) Socket() string { // Start will start the grpc server as well as spawn a praefect instance if GITALY_TEST_PRAEFECT_BIN is enabled func (p *TestServer) Start() error { - gitalyServerSocketPath := GetTemporaryGitalySocketFileName() - - listener, err := net.Listen("unix", gitalyServerSocketPath) - if err != nil { - return err - } - - go p.grpcServer.Serve(listener) - praefectBinPath, ok := os.LookupEnv("GITALY_TEST_PRAEFECT_BIN") if !ok { + gitalyServerSocketPath, err := p.listen() + if err != nil { + return err + } + p.socket = gitalyServerSocketPath return nil } @@ -164,6 +160,11 @@ func (p *TestServer) Start() error { } for _, storage := range p.storages { + gitalyServerSocketPath, err := p.listen() + if err != nil { + return err + } + c.VirtualStorages = append(c.VirtualStorages, &praefectconfig.VirtualStorage{ Name: storage, Nodes: []*models.Node{ @@ -222,6 +223,18 @@ func (p *TestServer) Start() error { return nil } +func (p *TestServer) listen() (string, error) { + gitalyServerSocketPath := GetTemporaryGitalySocketFileName() + + listener, err := net.Listen("unix", gitalyServerSocketPath) + if err != nil { + return "", err + } + + go p.grpcServer.Serve(listener) + return gitalyServerSocketPath, nil +} + func waitForPraefectStartup(conn *grpc.ClientConn) error { client := healthpb.NewHealthClient(conn) |