Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
wildum committed Oct 8, 2024
1 parent ff01d8b commit 077e825
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions internal/cmd/integration-tests/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ func runIntegrationTests(cmd *cobra.Command, args []string) {
return
}

ctx := context.Background()

compose, err := tc.NewDockerCompose("./docker-compose.yaml")
if err != nil {
panic(fmt.Errorf("failed to parse the docker compose file: %v", err))
}

ctx := context.Background()
fmt.Println("Start test containers with docker compose config")
err = compose.Up(ctx)
if err != nil {
panic(fmt.Errorf("could not start the docker compose: %v", err))
Expand Down
9 changes: 8 additions & 1 deletion internal/cmd/integration-tests/utils.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"bytes"
"context"
"fmt"
"io"
Expand Down Expand Up @@ -40,9 +41,15 @@ var logChan chan TestLog

func executeCommand(command string, args []string, taskDescription string) {
fmt.Printf("%s...\n", taskDescription)

cmd := exec.Command(command, args...)

var outBuf, errBuf bytes.Buffer
cmd.Stdout = &outBuf
cmd.Stderr = &errBuf

if err := cmd.Run(); err != nil {
log.Fatalf("error executing %s: %v", taskDescription, err)
log.Fatalf("error executing %s: %v\nstdout: %s\nstderr: %s", taskDescription, err, outBuf.String(), errBuf.String())
}
}

Expand Down

0 comments on commit 077e825

Please sign in to comment.