Skip to content

Commit f02d36b

Browse files
committed
libgit2: refactor tests to use managed and unmanaged transport cleanly
Refactors libgit2 checkout tests to test managed and unmanaged transport by making sure the tests requiring unmanaged transport are run before, any tests that require managed transport (since disabling managed transport isn't possible). This is done via arranging the tests carefully in alphabetically sorted names, i.e. the tests with unmanaged transport go in `checkout_test.go`, which forces golang to run the tests in that file before any other tests. Signed-off-by: Sanskar Jaiswal <[email protected]>
1 parent a00d0ed commit f02d36b

File tree

5 files changed

+286
-260
lines changed

5 files changed

+286
-260
lines changed

controllers/suite_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import (
3737
ctrl "sigs.k8s.io/controller-runtime"
3838

3939
"github.com/fluxcd/pkg/runtime/controller"
40+
feathelper "github.com/fluxcd/pkg/runtime/features"
4041
"github.com/fluxcd/pkg/runtime/testenv"
4142
"github.com/fluxcd/pkg/testserver"
4243
"github.com/go-logr/logr"
@@ -206,6 +207,8 @@ func TestMain(m *testing.M) {
206207
panic(fmt.Sprintf("Failed to create a test registry server: %v", err))
207208
}
208209

210+
fg := feathelper.FeatureGates{}
211+
fg.SupportedFeatures(features.FeatureGates())
209212
managed.InitManagedTransport(logr.Discard())
210213

211214
if err := (&GitRepositoryReconciler{

0 commit comments

Comments
 (0)