mirror of
https://github.com/vmware-tanzu/pinniped.git
synced 2025-12-23 14:25:50 +00:00
avoid using t.Context inside t.Cleanup because it is already cancelled
This commit is contained in:
@@ -358,7 +358,7 @@ func run(ctx context.Context) error {
|
|||||||
plog.Debug("controllers are ready")
|
plog.Debug("controllers are ready")
|
||||||
|
|
||||||
listenConfig := net.ListenConfig{}
|
listenConfig := net.ListenConfig{}
|
||||||
l, err := listenConfig.Listen(context.Background(), "tcp", ":8443")
|
l, err := listenConfig.Listen(ctx, "tcp", ":8443")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("cannot create listener: %w", err)
|
return fmt.Errorf("cannot create listener: %w", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2024 the Pinniped contributors. All Rights Reserved.
|
// Copyright 2024-2025 the Pinniped contributors. All Rights Reserved.
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
package integration
|
package integration
|
||||||
|
|
||||||
@@ -701,7 +701,9 @@ func performKubectlApply(t *testing.T, resourceName string, yamlBytes []byte) (s
|
|||||||
|
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
require.NoError(t, exec.CommandContext(t.Context(), "kubectl", "delete", "--ignore-not-found", "-f", yamlFilepath).Run())
|
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
|
||||||
|
defer cancel()
|
||||||
|
require.NoError(t, exec.CommandContext(ctx, "kubectl", "delete", "--ignore-not-found", "-f", yamlFilepath).Run())
|
||||||
})
|
})
|
||||||
|
|
||||||
return stdOut.String(), stdErr.String(), err
|
return stdOut.String(), stdErr.String(), err
|
||||||
|
|||||||
Reference in New Issue
Block a user