Skip to content

Commit 3c67efa

Browse files
author
Paulo Gomes
authored
Merge pull request fluxcd#686 from codablock/fix-git-tests
tests: Fix flakiness of git related tests
2 parents cfbe6ac + fa09aa2 commit 3c67efa

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ build: check-deps $(LIBGIT2) ## Build manager binary
9696
KUBEBUILDER_ASSETS?="$(shell $(ENVTEST) --arch=$(ENVTEST_ARCH) use -i $(ENVTEST_KUBERNETES_VERSION) --bin-dir=$(ENVTEST_ASSETS_DIR) -p path)"
9797
test: $(LIBGIT2) install-envtest test-api check-deps ## Run tests
9898
KUBEBUILDER_ASSETS=$(KUBEBUILDER_ASSETS) \
99+
GIT_CONFIG_GLOBAL=/dev/null \
99100
go test $(GO_STATIC_FLAGS) ./... -coverprofile cover.out
100101

101102
check-deps:
@@ -268,3 +269,4 @@ env: $(LIBGIT2)
268269
echo 'CGO_CFLAGS="$(CGO_CFLAGS)"' >> $(BUILD_DIR)/.env
269270
echo 'CGO_LDFLAGS="$(CGO_LDFLAGS)"' >> $(BUILD_DIR)/.env
270271
echo 'KUBEBUILDER_ASSETS=$(KUBEBUILDER_ASSETS)' >> $(BUILD_DIR)/.env
272+
echo 'GIT_CONFIG_GLOBAL=/dev/null' >> $(BUILD_DIR)/.env

controllers/gitrepository_controller_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ func TestGitRepositoryReconciler_reconcileSource_authStrategy(t *testing.T) {
434434
},
435435
Spec: sourcev1.GitRepositorySpec{
436436
Interval: metav1.Duration{Duration: interval},
437-
Timeout: &metav1.Duration{Duration: interval},
437+
Timeout: &metav1.Duration{Duration: timeout},
438438
},
439439
}
440440

@@ -653,7 +653,7 @@ func TestGitRepositoryReconciler_reconcileSource_checkoutStrategy(t *testing.T)
653653
},
654654
Spec: sourcev1.GitRepositorySpec{
655655
Interval: metav1.Duration{Duration: interval},
656-
Timeout: &metav1.Duration{Duration: interval},
656+
Timeout: &metav1.Duration{Duration: timeout},
657657
URL: server.HTTPAddress() + repoPath,
658658
Reference: tt.reference,
659659
},
@@ -1517,7 +1517,7 @@ func TestGitRepositoryReconciler_ConditionsUpdate(t *testing.T) {
15171517
URL: server.HTTPAddress() + repoPath,
15181518
GitImplementation: sourcev1.GoGitImplementation,
15191519
Interval: metav1.Duration{Duration: interval},
1520-
Timeout: &metav1.Duration{Duration: interval},
1520+
Timeout: &metav1.Duration{Duration: timeout},
15211521
},
15221522
}
15231523

controllers/helmrepository_controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ func TestHelmRepositoryReconciler_reconcileSource(t *testing.T) {
440440
},
441441
Spec: sourcev1.HelmRepositorySpec{
442442
Interval: metav1.Duration{Duration: interval},
443-
Timeout: &metav1.Duration{Duration: interval},
443+
Timeout: &metav1.Duration{Duration: timeout},
444444
},
445445
}
446446

0 commit comments

Comments
 (0)