Skip to content

Commit

Permalink
Fix unknown mysql config file path
Browse files Browse the repository at this point in the history
Signed-off-by: bcmmbaga <[email protected]>
  • Loading branch information
bcmmbaga committed Dec 27, 2024
1 parent 626b36f commit c155d2b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions management/server/testutil/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ package testutil

import (
"context"
"fmt"
"os"
"path/filepath"
"runtime"
"time"

log "github.com/sirupsen/logrus"
Expand All @@ -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"),
Expand Down

0 comments on commit c155d2b

Please sign in to comment.