Skip to content

Commit

Permalink
fixup! fix: Add contribution documenation to project
Browse files Browse the repository at this point in the history
Signed-off-by: Mateus Oliveira <[email protected]>
  • Loading branch information
mateusoliveira43 committed Apr 9, 2024
1 parent ffe3800 commit 9796c5f
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 7 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ jobs:
- name: Go unit and integration tests
run: make simulation-test

# TODO coverage report

- name: Go linters
if: ${{ matrix.go-version == '1.21' }}
uses: golangci/golangci-lint-action@v4
Expand Down
17 changes: 16 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

# Image URL to use all building/pushing image targets
IMG ?= quay.io/konveyor/non-admin-controller:latest
IMG ?= quay.io/konveyor/oadp-non-admin:latest
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.29.0

Expand Down Expand Up @@ -204,6 +204,8 @@ endef

##@ oadp-nac specifics

COVERAGE_THRESHOLD=55

## Tool Binaries
OC_CLI ?= $(shell which oc)
EC ?= $(LOCALBIN)/ec-$(EC_VERSION)
Expand All @@ -229,6 +231,19 @@ ci: simulation-test lint docker-build hadolint check-generate check-manifests ec
.PHONY: simulation-test
simulation-test: envtest ## Run unit and integration tests.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e) -coverprofile cover.out
@make check-coverage

.PHONY: check-coverage
check-coverage: ## Check if coverage threshold was reached.
@{ \
set -e ;\
current_coverage=$(shell go tool cover -func=cover.out | grep total | grep -Eo "[0-9]+\.[0-9]+") ;\
if [ "$$(echo "$$current_coverage < $(COVERAGE_THRESHOLD)" | bc -l)" -eq 1 ];then \
echo "Current coverage ($$current_coverage%) is below project threshold of $(COVERAGE_THRESHOLD)%" ;\
exit 1 ;\
fi ;\
echo "Coverage threshold of $(COVERAGE_THRESHOLD)% reached: $$current_coverage%" ;\
}

.PHONY: hadolint
hadolint: ## Run container file linter.
Expand Down
2 changes: 1 addition & 1 deletion config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: controller
newName: quay.io/konveyor/non-admin-controller
newName: quay.io/konveyor/oadp-non-admin
newTag: latest
9 changes: 7 additions & 2 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,17 @@ To run all checks locally, run `make ci`.

### Tests

To run unit and integration tests, run
To run unit and integration tests and coverage report, run
```sh
make simulation-test
```

TODO report, coverage and tests information
To see the html report, run
```sh
go tool cover -html=cover.out
```

TODO end to end tests

### Linters and code formatters

Expand Down
2 changes: 1 addition & 1 deletion docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Normally, to ship a controller to users, the project would present the file created by `make build-installer` command (which include various Kubernetes objects, like Namespace, ServiceAccount, Deployment, etc), to user to install the controller. But since NAC needs OADP operator to properly work, those Kubernetes objects are shipped within OADP operator (and also Kubernetes objects in `config/samples/` folder). Because of this restriction, generated Kubernetes objects names and labels in `config/` folder, may need to be updated to match OADP operator standards (and avoid duplications, by adding `non-admin-` prefix to Kubernetes object names).

> **NOTE:** If needed, you can test NAC alone by running `make build-installer` and `oc apply -f ./dist/install.yaml`. You may want to customize namespace (`openshift-adp-system`) and container image (`quay.io/konveyor/non-admin-controller:latest`) in that file prior to deploying it to your cluster.
> **NOTE:** If needed, you can test NAC alone by running `make build-installer` and `oc apply -f ./dist/install.yaml`. You may want to customize namespace (`openshift-adp-system`) and container image (`quay.io/konveyor/oadp-non-admin:latest`) in that file prior to deploying it to your cluster.
NAC objects are included in OADP operator through `make update-non-admin-manifests` command, which is run in OADP operator repository. To run the command:
- switch to OADP operator repository branch you want to update
Expand Down

0 comments on commit 9796c5f

Please sign in to comment.