Skip to content

Commit 4761b8f

Browse files
authored
Merge pull request bruin-data#297 from bruin-data/patch/avoid-compile
avoid compiling every time
2 parents ea2058a + afb26ff commit 4761b8f

File tree

4 files changed

+30
-9
lines changed

4 files changed

+30
-9
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,5 @@ glossary.yaml
142142

143143
integration-tests/duckdb.db
144144
integration-tests/logs
145+
integration-tests/bruin
145146
!integration-tests/.bruin.yml

Makefile

+5-1
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,14 @@ build: deps
2323

2424

2525
integration-test: build
26+
@touch integration-tests/.git
27+
@touch integration-tests/bruin
28+
@rm -rf integration-tests/.git
29+
@rm integration-tests/bruin
2630
@echo "$(OK_COLOR)==> Running integration tests...$(NO_COLOR)"
2731
@cd integration-tests && git init
2832
@go run integration-tests/integration-test.go
29-
@rm -rf integration-tests/.git
33+
3034
clean:
3135
@rm -rf ./bin
3236

integration-tests/integration-test.go

+24-7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"os"
66
"os/exec"
77
"path/filepath"
8+
"runtime"
89
"strconv"
910
"strings"
1011
"syscall"
@@ -16,12 +17,20 @@ import (
1617
var currentFolder string
1718

1819
func main() {
19-
var err error
20-
currentFolder = filepath.Join(currentFolder, "integration-tests")
20+
path, err := os.Getwd()
2121
if err != nil {
2222
fmt.Println(err)
2323
os.Exit(1)
2424
}
25+
currentFolder = filepath.Join(path, "integration-tests")
26+
27+
if runtime.GOOS == "windows" {
28+
out, err := exec.Command("mv", "bin/bruin", "bin/bruin.exe").Output()
29+
if err != nil {
30+
fmt.Printf("failed to rename binary for execution on windows: %s\n", out)
31+
panic(err)
32+
}
33+
}
2534

2635
expectExitCode("validate happy-path", 0)
2736
expectExitCode("run --use-uv happy-path", 0)
@@ -129,11 +138,12 @@ func expectJSONOutput(command string, jsonFilePath string) {
129138
if path.Json() == "\"path\"" {
130139
continue
131140
}
132-
141+
fmt.Println("Mismatch at: ", d.Path)
133142
fmt.Print("Expected json: ")
134143
fmt.Println(d.NewValues)
135144
fmt.Print("Not Matching found json: ")
136145
fmt.Println(d.OldValues)
146+
137147
os.Exit(1)
138148
}
139149
}
@@ -145,6 +155,7 @@ func expectExitCode(command string, code int) {
145155
if err != nil {
146156
if exitCode != code {
147157
fmt.Println(strconv.Itoa(code) + " Was expected but got:" + strconv.Itoa(exitCode))
158+
fmt.Printf("Error: %v\n", err)
148159
fmt.Println(output)
149160
os.Exit(1)
150161
}
@@ -158,10 +169,16 @@ func expectExitCode(command string, code int) {
158169
}
159170

160171
func runCommand(command string) (string, error) {
161-
fmt.Println("Running command:", command)
162-
args := []string{"run", "../main.go"}
163-
args = append(args, strings.Split(command, " ")...)
164-
cmd := exec.Command("go", args...)
172+
fmt.Println("Running command: bruin", command)
173+
args := strings.Split(command, " ")
174+
executable := "bruin"
175+
if runtime.GOOS == "windows" {
176+
executable = "bruin.exe"
177+
}
178+
wd, _ := os.Getwd()
179+
binary := filepath.Join(wd, "bin", executable)
180+
cmd := exec.Command(binary, args...)
181+
165182
cmd.Dir = currentFolder
166183
output, err := cmd.Output()
167184

pkg/path/walk.go

-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ func GetPipelinePaths(root string, pipelineDefinitionFile []string) ([]string, e
4343

4444
return nil
4545
})
46-
4746
if err != nil {
4847
return nil, errors.Wrapf(err, "error walking directory")
4948
}

0 commit comments

Comments
 (0)