From 901e98a8681259865e94f7e51547ca327cb9d859 Mon Sep 17 00:00:00 2001 From: congqixia Date: Tue, 5 Sep 2023 14:11:54 +0800 Subject: [PATCH] Update CONTRIBUTING.md for mockery generation (#26842) Signed-off-by: Congqi Xia --- CONTRIBUTING.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 84f82d1015..69ed1734f7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -192,6 +192,26 @@ $ go test ./internal/datanode -run SegmentReplica/segmentFlushed ok github.com/milvus-io/milvus/internal/datanode 0.019s ``` +### Using mockery + +It is recommended to use [Mockery](https://github.com/vektra/mockery) to generate mock implementations for unit test dependencies. + +If your PR changes any interface definition, you shall run following commands to update all mockery implemented type before submitting it: + +```shell +make generate-mockery +``` + +If your PR adds any new interface and related mockery types, please add a new entry under proper [Makefile](Makefile) `generate-mockery-xxx` command. + +```Makefile +generate-mockery-xxx: getdeps + # ... + # other mockery generation commands + # use mockery under $(INSTALL_PATH) to unify mockery binary version + $(INSTALL_PATH)/mockery --name=NewInterface ... +``` + ### Run C++ unit tests Install lcov