mirror of
https://github.com/fluxcd/flux2.git
synced 2026-02-22 15:41:47 +00:00
tests: deal with remaining defer
Signed-off-by: Hidde Beydals <hello@hidde.co>
This commit is contained in:
parent
b263e14fa8
commit
1f5961d2ad
1 changed files with 2 additions and 10 deletions
|
|
@ -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)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue