mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Makefile: Refactor test-server-race (#17196)
test-server-race wasn't using the same set of steps that the test-server step did. Therefore one test was failing. Refactored it such that scripts/test.sh can be used to run normal and race tests as well ```release-note NONE ```
This commit is contained in:
52
Makefile
52
Makefile
@@ -307,39 +307,6 @@ endif
|
||||
|
||||
check-style: golangci-lint plugin-checker vet ## Runs golangci against all packages
|
||||
|
||||
test-te-race: ## Checks for race conditions in the team edition.
|
||||
@echo Testing TE race conditions
|
||||
|
||||
@echo "Packages to test: "$(TE_PACKAGES)
|
||||
|
||||
@for package in $(TE_PACKAGES); do \
|
||||
echo "Testing "$$package; \
|
||||
$(GO) test $(GOFLAGS) -race -run=$(TESTS) -test.timeout=4000s $$package || exit 1; \
|
||||
done
|
||||
|
||||
test-ee-race: check-prereqs-enterprise ## Checks for race conditions in the enterprise edition.
|
||||
@echo Testing EE race conditions
|
||||
|
||||
ifeq ($(BUILD_ENTERPRISE_READY),true)
|
||||
@echo "Packages to test: "$(EE_PACKAGES)
|
||||
|
||||
for package in $(EE_PACKAGES); do \
|
||||
echo "Testing "$$package; \
|
||||
$(GO) test $(GOFLAGS) -race -run=$(TESTS) -c $$package; \
|
||||
if [ -f $$(basename $$package).test ]; then \
|
||||
echo "Testing "$$package; \
|
||||
./$$(basename $$package).test -test.timeout=2000s || exit 1; \
|
||||
rm -r $$(basename $$package).test; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
rm -f config/*.crt
|
||||
rm -f config/*.key
|
||||
endif
|
||||
|
||||
test-server-race: test-te-race test-ee-race ## Checks for race conditions.
|
||||
find . -type d -name data -not -path './vendor/*' | xargs rm -rf
|
||||
|
||||
do-cover-file: ## Creates the test coverage report file.
|
||||
@echo "mode: count" > cover.out
|
||||
|
||||
@@ -368,13 +335,26 @@ gomodtidy:
|
||||
fi;
|
||||
@rm go.*.orig;
|
||||
|
||||
test-server: check-prereqs-enterprise start-docker-check start-docker go-junit-report do-cover-file ## Runs tests.
|
||||
test-server-pre: check-prereqs-enterprise start-docker-check start-docker go-junit-report do-cover-file ## Runs tests.
|
||||
ifeq ($(BUILD_ENTERPRISE_READY),true)
|
||||
@echo Running all tests
|
||||
else
|
||||
@echo Running only TE tests
|
||||
endif
|
||||
./scripts/test.sh "$(GO)" "$(GOFLAGS)" "$(ALL_PACKAGES)" "$(TESTS)" "$(TESTFLAGS)" "$(GOBIN)"
|
||||
|
||||
test-server-race: test-server-pre
|
||||
./scripts/test.sh "$(GO)" "-race $(GOFLAGS)" "$(ALL_PACKAGES)" "$(TESTS)" "$(TESTFLAGS)" "$(GOBIN)" "90m" "atomic"
|
||||
ifneq ($(IS_CI),true)
|
||||
ifneq ($(MM_NO_DOCKER),true)
|
||||
ifneq ($(TEMP_DOCKER_SERVICES),)
|
||||
@echo Stopping temporary docker services
|
||||
docker-compose stop $(TEMP_DOCKER_SERVICES)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
test-server: test-server-pre
|
||||
./scripts/test.sh "$(GO)" "$(GOFLAGS)" "$(ALL_PACKAGES)" "$(TESTS)" "$(TESTFLAGS)" "$(GOBIN)" "20m" "count"
|
||||
ifneq ($(IS_CI),true)
|
||||
ifneq ($(MM_NO_DOCKER),true)
|
||||
ifneq ($(TEMP_DOCKER_SERVICES),)
|
||||
@@ -386,7 +366,7 @@ endif
|
||||
|
||||
test-server-ee: check-prereqs-enterprise start-docker-check start-docker go-junit-report do-cover-file ## Runs EE tests.
|
||||
@echo Running only EE tests
|
||||
./scripts/test.sh "$(GO)" "$(GOFLAGS)" "$(EE_PACKAGES)" "$(TESTS)" "$(TESTFLAGS)" "$(GOBIN)"
|
||||
./scripts/test.sh "$(GO)" "$(GOFLAGS)" "$(EE_PACKAGES)" "$(TESTS)" "$(TESTFLAGS)" "$(GOBIN)" "20m" "count"
|
||||
|
||||
test-server-quick: check-prereqs-enterprise ## Runs only quick tests.
|
||||
ifeq ($(BUILD_ENTERPRISE_READY),true)
|
||||
|
||||
@@ -9,14 +9,18 @@ PACKAGES=$3
|
||||
TESTS=$4
|
||||
TESTFLAGS=$5
|
||||
GOBIN=$6
|
||||
TIMEOUT=$7
|
||||
COVERMODE=$8
|
||||
|
||||
PACKAGES_COMMA=$(echo $PACKAGES | tr ' ' ',')
|
||||
|
||||
echo "Packages to test: $PACKAGES"
|
||||
echo "GOFLAGS: $GOFLAGS"
|
||||
|
||||
find . -name 'cprofile*.out' -exec sh -c 'rm "{}"' \;
|
||||
find . -type d -name data -not -path './vendor/*' -not -path './data' | xargs rm -rf
|
||||
|
||||
$GO test $GOFLAGS -run=$TESTS $TESTFLAGS -v -timeout=20m -covermode=count -coverpkg=$PACKAGES_COMMA -exec $DIR/test-xprog.sh $PACKAGES 2>&1 > >( tee output )
|
||||
$GO test $GOFLAGS -run=$TESTS $TESTFLAGS -v -timeout=$TIMEOUT -covermode=$COVERMODE -coverpkg=$PACKAGES_COMMA -exec $DIR/test-xprog.sh $PACKAGES 2>&1 > >( tee output )
|
||||
EXIT_STATUS=$?
|
||||
|
||||
cat output | $GOBIN/go-junit-report > report.xml
|
||||
|
||||
Reference in New Issue
Block a user