Skip to content

Commit

Permalink
sysdump: Refactor absoluteTempPath
Browse files Browse the repository at this point in the history
- Make absoluteTempPath a Collector method so that we don't have to
  keep passing it around to various Collector methods.
- Pass start time to NewCollector to make it easier to unit test.

Signed-off-by: Michi Mutsuzaki <[email protected]>
  • Loading branch information
michi-covalent authored and tklauser committed Oct 7, 2021
1 parent bf84b22 commit d8d6f2d
Show file tree
Hide file tree
Showing 3 changed files with 123 additions and 82 deletions.
7 changes: 6 additions & 1 deletion internal/cli/cmd/sysdump.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package cmd
import (
"fmt"
"io"
"time"

"github.com/spf13/cobra"
"k8s.io/klog/v2"
Expand All @@ -30,7 +31,11 @@ func newCmdSysdump() *cobra.Command {
// Silence klog to avoid displaying "throttling" messages - those are expected.
klog.SetOutput(io.Discard)
// Collect the sysdump.
if err := sysdump.NewCollector(k8sClient, sysdumpOptions).Run(); err != nil {
collector, err := sysdump.NewCollector(k8sClient, sysdumpOptions, time.Now())
if err != nil {
return nil
}
if err = collector.Run(); err != nil {
return fmt.Errorf("failed to collect sysdump: %v", err)
}
return nil
Expand Down
Loading

0 comments on commit d8d6f2d

Please sign in to comment.