Skip to content

Include commands and directory in run output #5254

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

Merged
merged 1 commit into from
Jan 20, 2021
Merged
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
16 changes: 8 additions & 8 deletions integration/skaffold/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func (b *RunBuilder) runForked(t *testing.T, out io.Writer) {

cmd := b.cmd(ctx)
cmd.Stdout = out
logrus.Infoln(cmd.Args)
logrus.Infof("Running %s in %s", cmd.Args, cmd.Dir)

start := time.Now()
if err := cmd.Start(); err != nil {
Expand All @@ -214,7 +214,7 @@ func (b *RunBuilder) runForked(t *testing.T, out io.Writer) {

go func() {
cmd.Wait()
logrus.Infoln("Ran in", util.ShowHumanizeTime(time.Since(start)))
logrus.Infof("Ran %s in %v", cmd.Args, util.ShowHumanizeTime(time.Since(start)))
}()

t.Cleanup(func() {
Expand All @@ -234,13 +234,13 @@ func (b *RunBuilder) Run(t *testing.T) error {
t.Helper()

cmd := b.cmd(context.Background())
logrus.Infoln(cmd.Args)
logrus.Infof("Running %s in %s", cmd.Args, cmd.Dir)

start := time.Now()
if err := cmd.Run(); err != nil {
return fmt.Errorf("skaffold %q: %w", b.command, err)
}
logrus.Infoln("Ran in", util.ShowHumanizeTime(time.Since(start)))
logrus.Infof("Ran %s in %v", cmd.Args, util.ShowHumanizeTime(time.Since(start)))
return nil
}

Expand All @@ -250,14 +250,14 @@ func (b *RunBuilder) RunWithCombinedOutput(t *testing.T) ([]byte, error) {

cmd := b.cmd(context.Background())
cmd.Stdout, cmd.Stderr = nil, nil
logrus.Infoln(cmd.Args)
logrus.Infof("Running %s in %s", cmd.Args, cmd.Dir)

start := time.Now()
out, err := cmd.CombinedOutput()
if err != nil {
return out, fmt.Errorf("skaffold %q: %w", b.command, err)
}
logrus.Infoln("Ran in", util.ShowHumanizeTime(time.Since(start)))
logrus.Infof("Ran %s in %v", cmd.Args, util.ShowHumanizeTime(time.Since(start)))
return out, nil
}

Expand All @@ -269,7 +269,7 @@ func (b *RunBuilder) RunOrFailOutput(t *testing.T) []byte {

cmd := b.cmd(context.Background())
cmd.Stdout, cmd.Stderr = nil, nil
logrus.Infoln(cmd.Args)
logrus.Infof("Running %s in %s", cmd.Args, cmd.Dir)

start := time.Now()
out, err := cmd.Output()
Expand All @@ -279,7 +279,7 @@ func (b *RunBuilder) RunOrFailOutput(t *testing.T) []byte {
}
t.Fatalf("skaffold %s: %v, %s", b.command, err, out)
}
logrus.Infoln("Ran in", util.ShowHumanizeTime(time.Since(start)))
logrus.Infof("Ran %s in %v", cmd.Args, util.ShowHumanizeTime(time.Since(start)))
return out
}

Expand Down