feat: refactor testing
This commit is contained in:
parent
c22e758b2c
commit
25c6b468b1
10 changed files with 328 additions and 2318 deletions
|
|
@ -5,12 +5,15 @@ package stackit_test
|
|||
import (
|
||||
_ "embed"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"os"
|
||||
"path"
|
||||
"regexp"
|
||||
"runtime"
|
||||
"testing"
|
||||
|
||||
"github.com/joho/godotenv"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-testing/config"
|
||||
"github.com/hashicorp/terraform-plugin-testing/helper/acctest"
|
||||
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
|
||||
|
|
@ -31,6 +34,22 @@ var testConfigProviderCredentials = config.Variables{
|
|||
"name": config.StringVariable(fmt.Sprintf("tf-acc-prov%s", acctest.RandStringFromCharSet(3, acctest.CharSetAlphaNum))),
|
||||
}
|
||||
|
||||
func setup() {
|
||||
err := godotenv.Load()
|
||||
if err != nil {
|
||||
slog.Info("could not find .env file - not loading .env")
|
||||
return
|
||||
}
|
||||
slog.Info("loaded .env file")
|
||||
}
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
setup()
|
||||
code := m.Run()
|
||||
// shutdown()
|
||||
os.Exit(code)
|
||||
}
|
||||
|
||||
// Helper function to obtain the home directory on different systems.
|
||||
// Based on os.UserHomeDir().
|
||||
func getHomeEnvVariableName() string {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue