Skip to content

Commit

Permalink
fix writing crd
Browse files Browse the repository at this point in the history
  • Loading branch information
chrischdi committed Feb 27, 2024
1 parent 51f36e2 commit 6439334
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/framework/management_cluster_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package framework
import (
"context"
"os"
"path/filepath"
"time"

. "github.com/onsi/gomega"
Expand All @@ -41,11 +42,16 @@ func WaitForProviderCAInjection(ctx context.Context, lister Lister, outpath stri
return lister.List(ctx, crdList, client.HasLabels{clusterv1.ProviderNameLabel})
}, retryableOperationTimeout, retryableOperationInterval).Should(Succeed(), "Failed to get crds of providers")

outDir := outpath
Expect(os.MkdirAll(outDir, 0750)).To(Succeed())

for i := range crdList.Items {
crd := crdList.Items[i]
data, err := yaml.Marshal(crd)
Expect(err).ToNot(HaveOccurred())
os.WriteFile(outpath, data, 0600)
outFile := filepath.Join(outDir, crd.Name+".yaml")
log.Logf("Writing crd to %s", outpath)
Expect(os.WriteFile(outFile, data, 0600)).To(Succeed())
// Use all versions so we also test conversion webhooks
for _, version := range crd.Spec.Versions {
if !version.Served {
Expand Down

0 comments on commit 6439334

Please sign in to comment.