Skip to content

Commit

Permalink
Merge pull request #1763 from josephschorr/close-in-test-when-done
Browse files Browse the repository at this point in the history
Close the parent context in serve_test when complete
  • Loading branch information
josephschorr authored Feb 23, 2024
2 parents 46fd98f + 4977627 commit fcd2386
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/cmd/serve_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"context"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -30,10 +31,10 @@ func RunServeTest(t *testing.T, args []string, assertConfig func(t *testing.T, m
cmd.SetArgs(args)

cmd.RunE = func(cmd *cobra.Command, args []string) error {
_, err := config.Complete(cmd.Context())
t.Cleanup(func() {
// TODO: RunnableServer.closeFunc should be called on Cleanup, but it is private.
})
ctx, cancel := context.WithCancel(cmd.Context())
t.Cleanup(cancel)

_, err := config.Complete(ctx)
if err != nil {
return err
}
Expand Down

0 comments on commit fcd2386

Please sign in to comment.