From 7acf82e40b3083ac168ffdee99bc57ad72218cd1 Mon Sep 17 00:00:00 2001 From: Michael Reimsbach Date: Fri, 26 Jul 2024 14:27:22 +0200 Subject: [PATCH 1/3] chore(makefile): add targets for generation and testing --- Makefile | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 865a4dc0..b75f2a94 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ VERSION ?= $(shell git log -1 --pretty=format:"%H") OS := $(shell go env GOOS) ARCH := $(shell go env GOARCH) -.PHONY: all test doc +.PHONY: all test doc gqlgen test-all test-e2e test-app test-db # Source the .env file to use the env vars with make -include .env @@ -47,3 +47,21 @@ push: run: go run cmd/heureka/main.go + +gqlgen: + cd internal/api/graphql && go run github.com/99designs/gqlgen generate + +mockery: + mockery + +test-all: + ginkgo -r + +test-e2e: + ginkgo internal/e2e + +test-app: + ginkgo internal/app + +test-db: + ginkgo internal/database/mariadb \ No newline at end of file From 42e521f63b254e4bcb9fef81ab153efffab02b6b Mon Sep 17 00:00:00 2001 From: David Rochow Date: Tue, 30 Jul 2024 09:02:26 +0200 Subject: [PATCH 2/3] docs(mockery): added mockery section to readme --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 58acbe36..6bf1f8b2 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,14 @@ make start-all-heureka ### Tests +#### Mockery + +Heureka uses [Mockery](https://vektra.github.io/mockery/) for building Mocks based on defined interfaces for the purpose of Unit-Testing. + +Please [follow the steps to install mockery on your local system](https://vektra.github.io/mockery/latest/installation/) to be able to build mocks. + +#### Using Ginkgo + Heureka uses [Ginkgo](https://onsi.github.io/ginkgo/) for behavior-driven development (BDD) style tests. In the current project setup, tests are organized into three different directories, each serving a specific purpose: - End-to-End Tests: These tests are located in the ./internal/e2e directory. End-to-end tests are designed to test the flow of an application from start to finish and ensure all integrated pieces of an application function as expected together. @@ -136,8 +144,6 @@ ginkgo -focus="Getting Services" ./internal/database/mariadb ``` If the test block you're trying to run depends on `BeforeEach`, `JustBeforeEach`, or `Describe` blocks that aren't being run when you use the `-focus` flag, this could cause the test to fail. - - ## Support, Feedback, Contributing This project is open to feature requests/suggestions, bug reports etc. via [GitHub issues](https://github.com/SAP//issues). Contribution and feedback are encouraged and always welcome. For more information about how to contribute, the project structure, as well as additional contribution information, see our [Contribution Guidelines](CONTRIBUTING.md). From b94e949ab85dd580605204cf4b7aa9463992dc55 Mon Sep 17 00:00:00 2001 From: Michael Reimsbach Date: Tue, 30 Jul 2024 09:25:44 +0200 Subject: [PATCH 3/3] chore(makefile): add fmt --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b75f2a94..71e18184 100644 --- a/Makefile +++ b/Makefile @@ -64,4 +64,7 @@ test-app: ginkgo internal/app test-db: - ginkgo internal/database/mariadb \ No newline at end of file + ginkgo internal/database/mariadb + +fmt: + go fmt ./... \ No newline at end of file