// Copyright (c) 2021 Gitpod GmbH. All rights reserved.1// Licensed under the GNU Affero General Public License (AGPL).2// See License.AGPL.txt in the project root for license information.34package integration56import (7"testing"8)910func DeferCloser(t *testing.T, closer []func() error) {11// Much "defer", we run the closer in reversed order. This way, we can12// append to this list quite naturally, and still break things down in13// the correct order.14t.Cleanup(func() {15for i := len(closer) - 1; i >= 0; i-- {16err := closer[i]()17if err != nil {18t.Logf("cleanup failed: %q", err)19}20}21})22}232425