diff --git a/.gitignore b/.gitignore index 423368d3c..c2ec8dfd4 100644 --- a/.gitignore +++ b/.gitignore @@ -67,3 +67,5 @@ mattermost-plugin/dist .idea docker/certs docker/data +server/**/*.coverage +mattermost-plugin/**/*.coverage diff --git a/Makefile b/Makefile index c61af8697..7b1cbc8bf 100644 --- a/Makefile +++ b/Makefile @@ -118,7 +118,8 @@ server-test: server-test-sqlite server-test-mysql server-test-postgres ## Run se server-test-sqlite: export FB_UNIT_TESTING=1 server-test-sqlite: templates-archive ## Run server tests using sqlite - cd server; go test -tags '$(BUILD_TAGS)' -race -v -count=1 -timeout=30m ./... + cd server; go test -tags '$(BUILD_TAGS)' -race -v -coverpkg=./... -coverprofile=server-sqlite-profile.coverage -count=1 -timeout=30m ./... + cd server; go tool cover -func server-sqlite-profile.coverage server-test-mini-sqlite: export FB_UNIT_TESTING=1 @@ -133,8 +134,10 @@ server-test-mysql: templates-archive ## Run server tests using mysql @echo Starting docker container for mysql docker-compose -f ./docker-testing/docker-compose-mysql.yml down -v --remove-orphans docker-compose -f ./docker-testing/docker-compose-mysql.yml run start_dependencies - cd server; go test -tags '$(BUILD_TAGS)' -race -v -count=1 -timeout=30m ./... - cd mattermost-plugin/server; go test -tags '$(BUILD_TAGS)' -race -v -count=1 -timeout=30m ./... + cd server; go test -tags '$(BUILD_TAGS)' -race -v -coverpkg=./... -coverprofile=server-mysql-profile.coverage -count=1 -timeout=30m ./... + cd server; go tool cover -func server-mysql-profile.coverage + cd mattermost-plugin/server; go test -tags '$(BUILD_TAGS)' -race -v -coverpkg=./... -coverprofile=plugin-mysql-profile.coverage -count=1 -timeout=30m ./... + cd mattermost-plugin/server; go tool cover -func plugin-mysql-profile.coverage docker-compose -f ./docker-testing/docker-compose-mysql.yml down -v --remove-orphans server-test-postgres: export FB_UNIT_TESTING=1 @@ -145,8 +148,10 @@ server-test-postgres: templates-archive ## Run server tests using postgres @echo Starting docker container for postgres docker-compose -f ./docker-testing/docker-compose-postgres.yml down -v --remove-orphans docker-compose -f ./docker-testing/docker-compose-postgres.yml run start_dependencies - cd server; go test -tags '$(BUILD_TAGS)' -race -v -count=1 -timeout=30m ./... - cd mattermost-plugin/server; go test -tags '$(BUILD_TAGS)' -race -v -count=1 -timeout=30m ./... + cd server; go test -tags '$(BUILD_TAGS)' -race -v -coverpkg=./... -coverprofile=server-postgres-profile.coverage -count=1 -timeout=30m ./... + cd server; go tool cover -func server-postgres-profile.coverage + cd mattermost-plugin/server; go test -tags '$(BUILD_TAGS)' -race -v -coverpkg=./... -coverprofile=plugin-postgres-profile.coverage -count=1 -timeout=30m ./... + cd mattermost-plugin/server; go tool cover -func plugin-postgres-profile.coverage docker-compose -f ./docker-testing/docker-compose-postgres.yml down -v --remove-orphans webapp: ## Build webapp.