Skip to content

Commit

Permalink
Merge pull request #686 from codablock/fix-git-tests
Browse files Browse the repository at this point in the history
tests: Fix flakiness of git related tests
  • Loading branch information
Paulo Gomes authored Apr 25, 2022
2 parents cfbe6ac + fa09aa2 commit 3c67efa
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ build: check-deps $(LIBGIT2) ## Build manager binary
KUBEBUILDER_ASSETS?="$(shell $(ENVTEST) --arch=$(ENVTEST_ARCH) use -i $(ENVTEST_KUBERNETES_VERSION) --bin-dir=$(ENVTEST_ASSETS_DIR) -p path)"
test: $(LIBGIT2) install-envtest test-api check-deps ## Run tests
KUBEBUILDER_ASSETS=$(KUBEBUILDER_ASSETS) \
GIT_CONFIG_GLOBAL=/dev/null \
go test $(GO_STATIC_FLAGS) ./... -coverprofile cover.out

check-deps:
Expand Down Expand Up @@ -268,3 +269,4 @@ env: $(LIBGIT2)
echo 'CGO_CFLAGS="$(CGO_CFLAGS)"' >> $(BUILD_DIR)/.env
echo 'CGO_LDFLAGS="$(CGO_LDFLAGS)"' >> $(BUILD_DIR)/.env
echo 'KUBEBUILDER_ASSETS=$(KUBEBUILDER_ASSETS)' >> $(BUILD_DIR)/.env
echo 'GIT_CONFIG_GLOBAL=/dev/null' >> $(BUILD_DIR)/.env
6 changes: 3 additions & 3 deletions controllers/gitrepository_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ func TestGitRepositoryReconciler_reconcileSource_authStrategy(t *testing.T) {
},
Spec: sourcev1.GitRepositorySpec{
Interval: metav1.Duration{Duration: interval},
Timeout: &metav1.Duration{Duration: interval},
Timeout: &metav1.Duration{Duration: timeout},
},
}

Expand Down Expand Up @@ -653,7 +653,7 @@ func TestGitRepositoryReconciler_reconcileSource_checkoutStrategy(t *testing.T)
},
Spec: sourcev1.GitRepositorySpec{
Interval: metav1.Duration{Duration: interval},
Timeout: &metav1.Duration{Duration: interval},
Timeout: &metav1.Duration{Duration: timeout},
URL: server.HTTPAddress() + repoPath,
Reference: tt.reference,
},
Expand Down Expand Up @@ -1517,7 +1517,7 @@ func TestGitRepositoryReconciler_ConditionsUpdate(t *testing.T) {
URL: server.HTTPAddress() + repoPath,
GitImplementation: sourcev1.GoGitImplementation,
Interval: metav1.Duration{Duration: interval},
Timeout: &metav1.Duration{Duration: interval},
Timeout: &metav1.Duration{Duration: timeout},
},
}

Expand Down
2 changes: 1 addition & 1 deletion controllers/helmrepository_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ func TestHelmRepositoryReconciler_reconcileSource(t *testing.T) {
},
Spec: sourcev1.HelmRepositorySpec{
Interval: metav1.Duration{Duration: interval},
Timeout: &metav1.Duration{Duration: interval},
Timeout: &metav1.Duration{Duration: timeout},
},
}

Expand Down

0 comments on commit 3c67efa

Please sign in to comment.