From 0422b36acf0e183093df30c738d16f21a72ba5f5 Mon Sep 17 00:00:00 2001 From: bcmmbaga Date: Fri, 27 Dec 2024 16:42:59 +0300 Subject: [PATCH] Fix unknown mysql config file path Signed-off-by: bcmmbaga --- management/server/testutil/store.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/management/server/testutil/store.go b/management/server/testutil/store.go index b43a3b011..87caf9d90 100644 --- a/management/server/testutil/store.go +++ b/management/server/testutil/store.go @@ -5,7 +5,10 @@ package testutil import ( "context" + "fmt" "os" + "path/filepath" + "runtime" "time" log "github.com/sirupsen/logrus" @@ -20,9 +23,14 @@ var mysqlContainerConfigPath = "../testdata/mysql.cnf" func CreateMysqlTestContainer() (func(), error) { ctx := context.Background() + _, caller, _, ok := runtime.Caller(0) + if !ok { + return nil, fmt.Errorf("failed to get caller information") + } + container, err := mysql.Run(ctx, "mysql:8.0.40", - mysql.WithConfigFile(mysqlContainerConfigPath), + mysql.WithConfigFile(filepath.Join(filepath.Dir(caller), mysqlContainerConfigPath)), mysql.WithDatabase("netbird"), mysql.WithUsername("root"), mysql.WithPassword("netbird"),