From df9fa95c9f89e87390440d33f9f17ee4bb8b9a10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Fri, 23 Oct 2020 20:56:17 +0200 Subject: [PATCH] wait for open port when setting up metadata storage for accounts tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- accounts/pkg/indexer/test/test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/accounts/pkg/indexer/test/test.go b/accounts/pkg/indexer/test/test.go index 5a131e71d2d..36b846fe881 100644 --- a/accounts/pkg/indexer/test/test.go +++ b/accounts/pkg/indexer/test/test.go @@ -3,6 +3,9 @@ package test import ( "context" "flag" + "net" + "time" + "github.com/micro/cli/v2" "github.com/owncloud/ocis/storage/pkg/command" mcfg "github.com/owncloud/ocis/storage/pkg/config" @@ -20,4 +23,12 @@ func setupMetadataStorage() { } _ = app.Command("storage-metadata").Run(cli.NewContext(&app, &flag.FlagSet{}, &cli.Context{Context: context.Background()})) + + // wait until port is open + d := net.Dialer{Timeout: 5 * time.Second} + conn, err := d.Dial("tcp", "localhost:9125") + if err != nil { + panic("timeout waiting for storage") + } + conn.Close() }