Skip to content

Commit

Permalink
Configure correctly for old versions
Browse files Browse the repository at this point in the history
  • Loading branch information
jveski committed Nov 21, 2023
1 parent c59e128 commit b88e716
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/controllers/reconciliation/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func TestControllerPodBasics(t *testing.T) {
return []*apiv1.ResourceSlice{slice}
})

require.NoError(t, New(rm, mgr.DownstreamRestConfig, 5, true))
require.NoError(t, New(rm, mgr.DownstreamRestConfig, 5, testutil.AtLeastVersion(t, 15)))
mgr.Start(t)

syn := &apiv1.Synthesizer{}
Expand Down Expand Up @@ -181,7 +181,7 @@ func TestControllerCRBasics(t *testing.T) {
return []*apiv1.ResourceSlice{slice}
})

require.NoError(t, New(rm, mgr.DownstreamRestConfig, 5, true))
require.NoError(t, New(rm, mgr.DownstreamRestConfig, 5, testutil.AtLeastVersion(t, 15)))
mgr.Start(t)

syn := &apiv1.Synthesizer{}
Expand Down
10 changes: 10 additions & 0 deletions internal/testutil/testutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,3 +285,13 @@ func NewPodController(t testing.TB, mgr ctrl.Manager, fn func(*apiv1.Composition
Build(podCtrl)
require.NoError(t, err)
}

func AtLeastVersion(t *testing.T, minor int) bool {
versionStr := os.Getenv("DOWNSTREAM_VERSION_MINOR")
if versionStr == "" {
return true // fail open for local dev
}

version, _ := strconv.Atoi(versionStr)
return version >= minor
}

0 comments on commit b88e716

Please sign in to comment.