Skip to content

Commit

Permalink
Merge pull request bruin-data#297 from bruin-data/patch/avoid-compile
Browse files Browse the repository at this point in the history
avoid compiling every time
  • Loading branch information
turtleDev authored Dec 9, 2024
2 parents ea2058a + afb26ff commit 4761b8f
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,5 @@ glossary.yaml

integration-tests/duckdb.db
integration-tests/logs
integration-tests/bruin
!integration-tests/.bruin.yml
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@ build: deps


integration-test: build
@touch integration-tests/.git
@touch integration-tests/bruin
@rm -rf integration-tests/.git
@rm integration-tests/bruin
@echo "$(OK_COLOR)==> Running integration tests...$(NO_COLOR)"
@cd integration-tests && git init
@go run integration-tests/integration-test.go
@rm -rf integration-tests/.git

clean:
@rm -rf ./bin

Expand Down
31 changes: 24 additions & 7 deletions integration-tests/integration-test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"
"strconv"
"strings"
"syscall"
Expand All @@ -16,12 +17,20 @@ import (
var currentFolder string

func main() {
var err error
currentFolder = filepath.Join(currentFolder, "integration-tests")
path, err := os.Getwd()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
currentFolder = filepath.Join(path, "integration-tests")

if runtime.GOOS == "windows" {
out, err := exec.Command("mv", "bin/bruin", "bin/bruin.exe").Output()
if err != nil {
fmt.Printf("failed to rename binary for execution on windows: %s\n", out)
panic(err)
}
}

expectExitCode("validate happy-path", 0)
expectExitCode("run --use-uv happy-path", 0)
Expand Down Expand Up @@ -129,11 +138,12 @@ func expectJSONOutput(command string, jsonFilePath string) {
if path.Json() == "\"path\"" {
continue
}

fmt.Println("Mismatch at: ", d.Path)
fmt.Print("Expected json: ")
fmt.Println(d.NewValues)
fmt.Print("Not Matching found json: ")
fmt.Println(d.OldValues)

os.Exit(1)
}
}
Expand All @@ -145,6 +155,7 @@ func expectExitCode(command string, code int) {
if err != nil {
if exitCode != code {
fmt.Println(strconv.Itoa(code) + " Was expected but got:" + strconv.Itoa(exitCode))
fmt.Printf("Error: %v\n", err)
fmt.Println(output)
os.Exit(1)
}
Expand All @@ -158,10 +169,16 @@ func expectExitCode(command string, code int) {
}

func runCommand(command string) (string, error) {
fmt.Println("Running command:", command)
args := []string{"run", "../main.go"}
args = append(args, strings.Split(command, " ")...)
cmd := exec.Command("go", args...)
fmt.Println("Running command: bruin", command)
args := strings.Split(command, " ")
executable := "bruin"
if runtime.GOOS == "windows" {
executable = "bruin.exe"
}
wd, _ := os.Getwd()
binary := filepath.Join(wd, "bin", executable)
cmd := exec.Command(binary, args...)

cmd.Dir = currentFolder
output, err := cmd.Output()

Expand Down
1 change: 0 additions & 1 deletion pkg/path/walk.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ func GetPipelinePaths(root string, pipelineDefinitionFile []string) ([]string, e

return nil
})

if err != nil {
return nil, errors.Wrapf(err, "error walking directory")
}
Expand Down

0 comments on commit 4761b8f

Please sign in to comment.