Skip to content

add quiet logs option #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions testing/it_sidecar/client/sidecar_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ type K8STestSetup struct {
// Callback function type is invoked post-setup but pre-test
type Callback func() error

var setupCMD = flag.String("setup", "", "the path to the it setup command")
var (
setupCMD = flag.String("setup", "", "the path to the it setup command")
quiet = flag.Bool("quiet", false, "silence logs from remote pods")
)

// TestMain will execute the provided setup command, wait for configured pods and services to be
// ready, and then forwards service logs to test output. On completion, signals to the it_sidecar
Expand Down Expand Up @@ -92,7 +95,6 @@ func (s *K8STestSetup) before(wg *sync.WaitGroup) {
log.Fatal(fmt.Errorf("unable to read setup command STDOUT; %w", err))
}


go func() {
rd := bufio.NewReader(s.er)
for {
Expand All @@ -103,7 +105,9 @@ func (s *K8STestSetup) before(wg *sync.WaitGroup) {
if err != nil {
log.Fatal(err)
}
log.Print(str)
if !*quiet {
log.Print(str)
}
}
wg.Done()
}()
Expand Down Expand Up @@ -150,7 +154,9 @@ waitForReady:
if err != nil {
log.Fatal(err)
}
log.Print(str)
if !*quiet {
log.Print(str)
}
}
wg.Done()
}()
Expand Down