5
5
"os"
6
6
"os/exec"
7
7
"path/filepath"
8
+ "runtime"
8
9
"strconv"
9
10
"strings"
10
11
"syscall"
@@ -16,12 +17,20 @@ import (
16
17
var currentFolder string
17
18
18
19
func main () {
19
- var err error
20
- currentFolder = filepath .Join (currentFolder , "integration-tests" )
20
+ path , err := os .Getwd ()
21
21
if err != nil {
22
22
fmt .Println (err )
23
23
os .Exit (1 )
24
24
}
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
+ }
25
34
26
35
expectExitCode ("validate happy-path" , 0 )
27
36
expectExitCode ("run --use-uv happy-path" , 0 )
@@ -129,11 +138,12 @@ func expectJSONOutput(command string, jsonFilePath string) {
129
138
if path .Json () == "\" path\" " {
130
139
continue
131
140
}
132
-
141
+ fmt . Println ( "Mismatch at: " , d . Path )
133
142
fmt .Print ("Expected json: " )
134
143
fmt .Println (d .NewValues )
135
144
fmt .Print ("Not Matching found json: " )
136
145
fmt .Println (d .OldValues )
146
+
137
147
os .Exit (1 )
138
148
}
139
149
}
@@ -145,6 +155,7 @@ func expectExitCode(command string, code int) {
145
155
if err != nil {
146
156
if exitCode != code {
147
157
fmt .Println (strconv .Itoa (code ) + " Was expected but got:" + strconv .Itoa (exitCode ))
158
+ fmt .Printf ("Error: %v\n " , err )
148
159
fmt .Println (output )
149
160
os .Exit (1 )
150
161
}
@@ -158,10 +169,16 @@ func expectExitCode(command string, code int) {
158
169
}
159
170
160
171
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
+
165
182
cmd .Dir = currentFolder
166
183
output , err := cmd .Output ()
167
184
0 commit comments