File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ var Flags AgentCmdFlags
50
50
const schemaVersion string = "v2.0.0"
51
51
52
52
// Run starts the agent process
53
- func Run (cmd * cobra.Command , args []string ) error {
53
+ func Run (cmd * cobra.Command , args []string ) ( returnErr error ) {
54
54
logs .Log .Printf ("Preflight agent version: %s (%s)" , version .PreflightVersion , version .Commit )
55
55
ctx , cancel := context .WithCancel (
56
56
klog .NewContext (
@@ -85,8 +85,8 @@ func Run(cmd *cobra.Command, args []string) error {
85
85
defer func () {
86
86
cancel ()
87
87
if groupErr := group .Wait (); groupErr != nil {
88
- err = multierror .Append (
89
- err ,
88
+ returnErr = multierror .Append (
89
+ returnErr ,
90
90
fmt .Errorf ("failed to wait for controller-runtime component to stop: %v" , groupErr ),
91
91
)
92
92
}
Original file line number Diff line number Diff line change @@ -44,8 +44,11 @@ func TestRunOneShot(t *testing.T) {
44
44
require .NoError (t , err )
45
45
46
46
logs .Initialize ()
47
- Run (c , nil )
48
- klog .Flush ()
47
+ defer klog .Flush ()
48
+
49
+ runErr := Run (c , nil )
50
+ require .NoError (t , runErr , "Run returned an unexpected error" )
51
+
49
52
return
50
53
}
51
54
t .Log ("Running child process" )
You can’t perform that action at this time.
0 commit comments