1
0
mirror of synced 2026-02-06 19:05:55 +00:00

tests: deal with remaining defer

Signed-off-by: Hidde Beydals <hello@hidde.co>
This commit is contained in:
Hidde Beydals
2023-02-15 13:50:51 +01:00
parent b263e14fa8
commit 1f5961d2ad

View File

@@ -20,7 +20,6 @@ limitations under the License.
package utils
import (
"os"
"path/filepath"
"reflect"
"testing"
@@ -135,16 +134,9 @@ func TestExtractCRDs(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
// Create temporary directory to write the result in.
dir, err := os.MkdirTemp("", "flux-TestExtractCRDs")
if err != nil {
t.Fatalf("failed to create temporary directory: %v", err)
}
defer os.RemoveAll(dir)
outManifestPath := filepath.Join(dir, "crds.yaml")
outManifestPath := filepath.Join(t.TempDir(), "crds.yaml")
inManifestPath := filepath.Join("testdata", tt.inManifestFile)
if err = ExtractCRDs(inManifestPath, outManifestPath); (err != nil) != tt.expectErr {
if err := ExtractCRDs(inManifestPath, outManifestPath); (err != nil) != tt.expectErr {
t.Errorf("ExtractCRDs() error = %v, expectErr %v", err, tt.expectErr)
}
})