Skip to content

Commit

Permalink
Move file out of glob
Browse files Browse the repository at this point in the history
  • Loading branch information
jveski committed Nov 20, 2023
1 parent 811d495 commit 361eed9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions internal/testutil/testutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func NewManager(t *testing.T) *Manager {
ErrorIfCRDPathMissing: true,
}
if version >= 21 {
t.Logf("managing downstream cluster CRDs with envtest because version >= 21")
t.Logf("managing downstream cluster CRD with envtest because version >= 21")
downstreamEnv.CRDDirectoryPaths = append(downstreamEnv.CRDDirectoryPaths, testCrdDir)
}

Expand Down Expand Up @@ -146,21 +146,16 @@ func NewManager(t *testing.T) *Manager {
// Install CRDs
// This is required because older k8s versions don't have apiextensions v1, which envtest uses
if version < 21 {
t.Logf("managing downstream cluster CRDs ourselves (not with envtest) because version < 21")
crds, err := os.ReadDir(testCrdDir)
t.Logf("managing downstream cluster CRD ourselves (not with envtest) because version < 21")
raw, err := os.ReadFile(filepath.Join(testCrdDir, "internal", "controllers", "reconciliation", "fixtures", "v1", "config", "enotest.azure.io_testresources-old.yaml"))
require.NoError(t, err)

for _, crdFile := range crds {
raw, err := os.ReadFile(filepath.Join(testCrdDir, crdFile.Name()))
require.NoError(t, err)
res := &unstructured.Unstructured{}
require.NoError(t, yaml.Unmarshal(raw, res))

res := &unstructured.Unstructured{}
require.NoError(t, yaml.Unmarshal(raw, res))

cli, err := client.New(m.DownstreamRestConfig, client.Options{})
require.NoError(t, err)
require.NoError(t, cli.Create(context.Background(), res))
}
cli, err := client.New(m.DownstreamRestConfig, client.Options{})
require.NoError(t, err)
require.NoError(t, cli.Create(context.Background(), res))
}

return m
Expand Down

0 comments on commit 361eed9

Please sign in to comment.