Skip to content

Commit 7167e09

Browse files
authored
Merge pull request #7928 from sbueringer/pr-fix-self-hosted-test-cleanup
🐛 test/e2e: Fix cluster cleanup in self-hosted test
2 parents 0119de7 + 73d0dde commit 7167e09

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

scripts/ci-e2e.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,16 @@ cleanup() {
8686
ctr -n moby containers list > "${ARTIFACTS_LOCAL}/containerd-containers.txt" || true
8787
ctr -n moby images list > "${ARTIFACTS_LOCAL}/containerd-images.txt" || true
8888
ctr -n moby version > "${ARTIFACTS_LOCAL}/containerd-version.txt" || true
89+
90+
# Verify that no containers are running at this time
91+
# Note: This verifies that all our tests clean up clusters correctly.
92+
if [[ ! "$(docker ps -q | wc -l)" -eq "0" ]]
93+
then
94+
echo "ERROR: Found unexpected running containers:"
95+
echo ""
96+
docker ps
97+
exit 1
98+
fi
8999
}
90100
trap "cleanup" EXIT SIGINT
91101

test/e2e/self_hosted.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ func SelfHostedSpec(ctx context.Context, inputGetter func() SelfHostedSpecInput)
232232
// object. The Cluster object has special processing for the paused field during the move to
233233
// avoid having clusterctl as the manager of the field.
234234
log.Logf("Ensure clusterctl does not take ownership on any fields on the self-hosted cluster")
235-
selfHostedCluster := framework.GetClusterByName(ctx, framework.GetClusterByNameInput{
235+
selfHostedCluster = framework.GetClusterByName(ctx, framework.GetClusterByNameInput{
236236
Getter: selfHostedClusterProxy.GetClient(),
237237
Name: cluster.Name,
238238
Namespace: selfHostedNamespace.Name,

0 commit comments

Comments
 (0)