From 8194817d543ed9acfe80f17d9eba1352cc43ff0f Mon Sep 17 00:00:00 2001 From: Jesse Hallam Date: Fri, 9 Jun 2023 07:29:08 -0300 Subject: [PATCH] disable coverage (#23686) * disable coverage This reduces runtime of the server test suite from ~30m to ~10m, and as far as I can see: we discarded the coverage output anyway. * allow morph 60s to migrate when running tests --- server/Makefile | 17 +++++++---------- server/channels/store/storetest/settings.go | 2 +- server/scripts/test-xprog.sh | 3 +-- server/scripts/test.sh | 5 +---- 4 files changed, 10 insertions(+), 17 deletions(-) diff --git a/server/Makefile b/server/Makefile index a090dce0a3..1fff34d07b 100644 --- a/server/Makefile +++ b/server/Makefile @@ -434,9 +434,6 @@ endif check-style: plugin-checker vet golangci-lint ## Runs style/lint checks -do-cover-file: ## Creates the test coverage report file. - @echo "mode: count" > cover.out - go-junit-report: $(GO) install github.com/jstemmer/go-junit-report@v1.0.0 @@ -457,7 +454,7 @@ modules-tidy: mv channels/imports/imports.go.orig channels/imports/imports.go; \ fi; -test-server-pre: check-prereqs-enterprise start-docker go-junit-report do-cover-file ## Runs tests. +test-server-pre: check-prereqs-enterprise start-docker go-junit-report ## Runs tests. ifeq ($(BUILD_ENTERPRISE_READY),true) @echo Running all tests else @@ -465,9 +462,9 @@ else endif test-server-race: test-server-pre - ./scripts/test.sh "$(GO)" "-race $(GOFLAGS)" "$(TE_PACKAGES) $(EE_PACKAGES)" "$(TESTS)" "$(TESTFLAGS)" "$(GOBIN)" "90m" "atomic" - ./scripts/test.sh "$(GO)" "-race $(GOFLAGS)" "$(BOARDS_PACKAGES)" "$(TESTS)" "$(TESTFLAGS)" "$(GOBIN)" "90m" "atomic" - ./scripts/test.sh "$(GO)" "-race $(GOFLAGS)" "$(PLAYBOOKS_PACKAGES)" "$(TESTS)" "$(TESTFLAGS)" "$(GOBIN)" "90m" "atomic" + ./scripts/test.sh "$(GO)" "-race $(GOFLAGS)" "$(TE_PACKAGES) $(EE_PACKAGES)" "$(TESTS)" "$(TESTFLAGS)" "$(GOBIN)" "90m" + ./scripts/test.sh "$(GO)" "-race $(GOFLAGS)" "$(BOARDS_PACKAGES)" "$(TESTS)" "$(TESTFLAGS)" "$(GOBIN)" "90m" + ./scripts/test.sh "$(GO)" "-race $(GOFLAGS)" "$(PLAYBOOKS_PACKAGES)" "$(TESTS)" "$(TESTFLAGS)" "$(GOBIN)" "90m" ifneq ($(IS_CI),true) ifneq ($(MM_NO_DOCKER),true) ifneq ($(TEMP_DOCKER_SERVICES),) @@ -478,7 +475,7 @@ ifneq ($(IS_CI),true) endif test-server: test-server-pre - ./scripts/test.sh "$(GO)" "$(GOFLAGS)" "$(SUITE_PACKAGES) $(EE_PACKAGES)" "$(TESTS)" "$(TESTFLAGS)" "$(GOBIN)" "90m" "count" + ./scripts/test.sh "$(GO)" "$(GOFLAGS)" "$(SUITE_PACKAGES) $(EE_PACKAGES)" "$(TESTS)" "$(TESTFLAGS)" "$(GOBIN)" "90m" ifneq ($(IS_CI),true) ifneq ($(MM_NO_DOCKER),true) ifneq ($(TEMP_DOCKER_SERVICES),) @@ -488,9 +485,9 @@ ifneq ($(IS_CI),true) endif endif -test-server-ee: check-prereqs-enterprise start-docker go-junit-report do-cover-file ## Runs EE tests. +test-server-ee: check-prereqs-enterprise start-docker go-junit-report ## Runs EE tests. @echo Running only EE tests - ./scripts/test.sh "$(GO)" "$(GOFLAGS)" "$(EE_PACKAGES)" "$(TESTS)" "$(TESTFLAGS)" "$(GOBIN)" "20m" "count" + ./scripts/test.sh "$(GO)" "$(GOFLAGS)" "$(EE_PACKAGES)" "$(TESTS)" "$(TESTFLAGS)" "$(GOBIN)" "20m" test-server-quick: check-prereqs-enterprise ## Runs only quick tests. ifeq ($(BUILD_ENTERPRISE_READY),true) diff --git a/server/channels/store/storetest/settings.go b/server/channels/store/storetest/settings.go index 19b9b4b9de..3f29e3beed 100644 --- a/server/channels/store/storetest/settings.go +++ b/server/channels/store/storetest/settings.go @@ -182,7 +182,7 @@ func databaseSettings(driver, dataSource string) *model.SqlSettings { *settings.ConnMaxIdleTimeMilliseconds = 300000 *settings.MaxOpenConns = 100 *settings.QueryTimeout = 60 - *settings.MigrationsStatementTimeoutSeconds = 10 + *settings.MigrationsStatementTimeoutSeconds = 60 return settings } diff --git a/server/scripts/test-xprog.sh b/server/scripts/test-xprog.sh index 899c95543c..b9a89a7be2 100755 --- a/server/scripts/test-xprog.sh +++ b/server/scripts/test-xprog.sh @@ -2,8 +2,7 @@ set -e [[ $1 =~ (github.com.*)/_test ]] && \ echo Testing ${BASH_REMATCH[1]} -coverprofile=`pwd`/cprofile.out if [[ $1 == *"/enterprise/"* ]]; then cd "$(dirname "$(dirname "${BASH_SOURCE[0]}")")" fi -"$@" -test.coverprofile "$coverprofile" +"$@" diff --git a/server/scripts/test.sh b/server/scripts/test.sh index 63f89fc785..c2f5b5b2d1 100755 --- a/server/scripts/test.sh +++ b/server/scripts/test.sh @@ -10,7 +10,6 @@ TESTS=$4 TESTFLAGS=$5 GOBIN=$6 TIMEOUT=$7 -COVERMODE=$8 PACKAGES_COMMA=$(echo $PACKAGES | tr ' ' ',') export MM_SERVER_PATH=$PWD @@ -23,15 +22,13 @@ then export GOMAXPROCS=4 fi -find . -name 'cprofile*.out' -exec sh -c 'rm "{}"' \; find . -type d -name data -not -path './data' | xargs rm -rf -$GO test $GOFLAGS -run=$TESTS $TESTFLAGS -v -timeout=$TIMEOUT -covermode=$COVERMODE -coverpkg=$PACKAGES_COMMA -exec $DIR/test-xprog.sh $PACKAGES 2>&1 > >( tee output ) +$GO test $GOFLAGS -run=$TESTS $TESTFLAGS -v -timeout=$TIMEOUT -exec $DIR/test-xprog.sh $PACKAGES 2>&1 > >( tee output ) EXIT_STATUS=$? cat output | $GOBIN/go-junit-report > report.xml rm output -find . -name 'cprofile*.out' -exec sh -c 'tail -n +2 "{}" >> cover.out ; rm "{}"' \; rm -f config/*.crt rm -f config/*.key