diff --git a/internal/controllers/controllers_test.go b/internal/controllers/controllers_test.go index f9280f4..19d5615 100644 --- a/internal/controllers/controllers_test.go +++ b/internal/controllers/controllers_test.go @@ -7,6 +7,7 @@ import ( "net/http/httptest" "net/url" "os" + "path/filepath" "strconv" "testing" @@ -47,6 +48,25 @@ func TestSuite(t *testing.T) { log.Fatalf("Failed to create DB: %#v", err) } + cwd, err := os.Getwd() + if err != nil { + log.Fatalf("Failed to get current working directory: %v", err) + } + + // Build paths relative to the current working directory + configFilePath := filepath.Join(cwd, "..", "..", "configs", "config.json") + templateHTMLPath := filepath.Join(cwd, "..", "..", "templates", "html") + templateMailPath := filepath.Join(cwd, "..", "..", "templates", "email") + + if err := os.Setenv("TEMPLATE_MAIL_PATH", templateMailPath); err != nil { + log.Fatalf("Error setting environment variable: %v", err) + } + if err := os.Setenv("TEMPLATE_HTML_PATH", templateHTMLPath); err != nil { + log.Fatalf("Error setting environment variable: %v", err) + } + if err := os.Setenv("CONFIG_FILE_PATH", configFilePath); err != nil { + log.Fatalf("Error setting environment variable: %v", err) + } if err := os.Setenv("SMTP_HOST", Host); err != nil { log.Fatalf("Error setting environment variable: %v", err) }