Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require local provider in tests #2953

Merged
merged 7 commits into from
Nov 16, 2023
37 changes: 37 additions & 0 deletions examples/main_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package examples

import (
"log"
"os"
"os/exec"
"path/filepath"
"testing"
)

func TestMain(m *testing.M) {
disableProviderBuild := os.Getenv("GITHUB_ACTIONS")
if disableProviderBuild == "" {
cwd, err := os.Getwd()
if err != nil {
log.Println("Unable to get working directory!")
os.Exit(1)
}
command := exec.Command("make", "provider_no_deps")
command.Dir = filepath.Join(cwd, "..")
err = command.Run()
if err != nil {
log.Println("Unable to build provider!")
os.Exit(1)
}

binPath := filepath.Join(cwd, "..", "bin")
err = os.Setenv("PATH", binPath+":"+os.Getenv("PATH"))
VenelinMartinov marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
log.Println("Unable to set PATH!")
os.Exit(1)
}
}

exitVal := m.Run()
os.Exit(exitVal)
}
Loading