diff --git a/management/server/testutil/store.go b/management/server/testutil/store.go index b43a3b0111f..a04ad87a57b 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" @@ -15,14 +18,19 @@ import ( "github.com/testcontainers/testcontainers-go/wait" ) -var mysqlContainerConfigPath = "../testdata/mysql.cnf" +var configPath = "../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), configPath)), mysql.WithDatabase("netbird"), mysql.WithUsername("root"), mysql.WithPassword("netbird"),