Skip to content

Commit 9c2358c

Browse files
authored
Merge pull request #229 from HyperloopUPV-H8/backend/bugadj
[Backend] Fix testadj script doesn't provide information
2 parents f60e463 + 531cb7a commit 9c2358c

2 files changed

Lines changed: 9 additions & 10 deletions

File tree

backend/cmd/main.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"net/http"
1313
_ "net/http/pprof"
1414
"os"
15-
"os/exec"
1615
"os/signal"
1716
"path"
1817
"runtime"
@@ -107,15 +106,6 @@ func main() {
107106
trace.Fatal().Err(err).Msg("setting up ADJ")
108107
}
109108

110-
if config.Adj.Test {
111-
test := exec.Command("python3", "testadj.py")
112-
out, err := test.CombinedOutput()
113-
if err != nil || len(out) != 0 {
114-
fmt.Printf("\nPython test failed:\nError: %v\nOutput: %s\n", err, string(out))
115-
os.Exit(1)
116-
}
117-
}
118-
119109
podData, err := pod_data.NewPodData(adj.Boards, adj.Info.Units)
120110
if err != nil {
121111
fmt.Println(err)

backend/internal/adj/adj.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ package adj
22

33
import (
44
"encoding/json"
5+
"log"
56
"os"
7+
"os/exec"
68

79
"github.com/HyperloopUPV-H8/h9-backend/internal/utils"
810
)
@@ -71,6 +73,13 @@ func downloadADJ(AdjBranch string) (json.RawMessage, json.RawMessage, error) {
7173
updateRepo(AdjBranch)
7274

7375
// The BoardIds are applied in the NewADJ function by the getBoardIds function
76+
//Execute the script testadj.py (fix bug)
77+
test := exec.Command("python3", "testadj.py")
78+
out, err := test.CombinedOutput()
79+
if err != nil || len(out) != 0 {
80+
log.Fatalf("python test failed:\nError: %v\nOutput: %s\n", err, string(out))
81+
}
82+
7483
info, err := os.ReadFile(RepoPath + "general_info.json")
7584
if err != nil {
7685
return nil, nil, err

0 commit comments

Comments
 (0)