Skip to content

Commit

Permalink
updated std's outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
oakrizan committed Oct 14, 2024
1 parent 9e2a3e5 commit d2f7b38
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
3 changes: 1 addition & 2 deletions .buildkite/x-pack/pipeline.xpack.agentbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ steps:
# - agentbeat-package-linux
command: |
cd x-pack/agentbeat
../../agentbeat-9.0.0-SNAPSHOT-linux-x86_64/agentbeat filebeat -E setup.ilm.enabled=false -E setup.template.enabled=false -E management.enabled=true -E management.restart_on_output_change=true -E logging.level=info -E logging.to_stderr=true -E gc_percent=${FILEBEAT_GOGC:100} -E filebeat.config.modules.enabled=false -E logging.event_data.to_stderr=true -E logging.event_data.to_files=false
# mage -v testWithSpec
mage -v testWithSpec
agents:
provider: "gcp"
image: "${IMAGE_UBUNTU_X86_64}"
Expand Down
20 changes: 7 additions & 13 deletions x-pack/agentbeat/magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
package main

import (
"bufio"
"context"
"fmt"
"log"
"os"
"os/exec"
"path/filepath"
"strings"
"time"

"github.com/magefile/mage/sh"
Expand Down Expand Up @@ -236,7 +236,7 @@ func TestWithSpec(ctx context.Context) {
cmdResults := make(map[string]bool)

for _, command := range commands {
cmdResults[command] = runCmd(agentbeatPath, command)
cmdResults[command] = runCmd(agentbeatPath, strings.Split(command, " "))
}

hasFailures := false
Expand All @@ -255,14 +255,13 @@ func TestWithSpec(ctx context.Context) {
}
}

func runCmd(agentbeatPath string, command string) bool {
cmd := exec.Command(agentbeatPath, command)
func runCmd(agentbeatPath string, command []string) bool {
cmd := exec.Command(agentbeatPath, command...)
fmt.Printf("Executing: %s\n", cmd.String())

stdout, err := cmd.StdoutPipe()
if err != nil {
fmt.Printf("Error creating stdout pipe: %v\n", err)
}
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Stdin = os.Stdin

if err := cmd.Start(); err != nil {
fmt.Printf("failed to start command: %v\n", err)
Expand All @@ -286,11 +285,6 @@ func runCmd(agentbeatPath string, command string) bool {
select {
case err := <-done:
fmt.Printf("command exited before %s: %v\n", timeout.String(), err)
fmt.Println("printing command stdout")
scanner := bufio.NewScanner(stdout)
for scanner.Scan() {
fmt.Println(scanner.Text())
}
return false

case <-deadline:
Expand Down

0 comments on commit d2f7b38

Please sign in to comment.