Files
mattermost/scripts/test.sh
Agniva De Sarker fc60a1e8dd MM-30988 - Fix racy test ServerSystemdNotification (#16431)
* MM-30988 - Fix racy test ServerSystemdNotification

The translateFunc is a global variable which was unguarded.
So we convert that into an atomic variable to prevent against races.

https://mattermost.atlassian.net/browse/MM-30988

```release-note
NONE
```

* fix tests

* move call upwards

* use race

* after translations init

* guard with a sync.Once

* missed import

* revert race

* update timeout
2020-12-02 14:22:41 +05:30

29 lines
763 B
Bash
Executable File

#!/usr/bin/env bash
set -o pipefail
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
GO=$1
GOFLAGS=$2
PACKAGES=$3
TESTS=$4
TESTFLAGS=$5
GOBIN=$6
PACKAGES_COMMA=$(echo $PACKAGES | tr ' ' ',')
echo "Packages to test: $PACKAGES"
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 )
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
exit $EXIT_STATUS