tests: deal with remaining defer
Signed-off-by: Hidde Beydals <hello@hidde.co>
This commit is contained in:
@@ -20,7 +20,6 @@ limitations under the License.
|
|||||||
package utils
|
package utils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
@@ -135,16 +134,9 @@ func TestExtractCRDs(t *testing.T) {
|
|||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
// Create temporary directory to write the result in.
|
outManifestPath := filepath.Join(t.TempDir(), "crds.yaml")
|
||||||
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")
|
|
||||||
inManifestPath := filepath.Join("testdata", tt.inManifestFile)
|
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)
|
t.Errorf("ExtractCRDs() error = %v, expectErr %v", err, tt.expectErr)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user