This repository was archived by the owner on Jun 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 678
Various improvements to unit test running #1120
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
*.egg-info | ||
*.dist-info | ||
flask | ||
jinja2 | ||
markupsafe | ||
werkzeug | ||
itsdangerous.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
To upload newer version: | ||
|
||
``` | ||
pip install -r requirements.txt -t . | ||
appcfg.py update . | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
flask |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,58 @@ | ||
#!/bin/bash | ||
|
||
go get github.com/weaveworks/weave/testing/cover | ||
set -e | ||
|
||
if [ -n "$COVERDIR" ] ; then | ||
coverdir="$COVERDIR" | ||
else | ||
coverdir=$(mktemp -d coverage.XXXXXXXXXX) | ||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
SLOW=${SLOW-} | ||
GO_TEST_ARGS="-tags netgo -cpu 4" | ||
if [ -n "$SLOW" -o "$1" = "-slow" ]; then | ||
GO_TEST_ARGS="$GO_TEST_ARGS -race -covermode=atomic" | ||
|
||
if [ -n "$COVERDIR" ] ; then | ||
coverdir="$COVERDIR" | ||
else | ||
coverdir=$(mktemp -d coverage.XXXXXXXXXX) | ||
fi | ||
|
||
mkdir -p $coverdir | ||
fi | ||
|
||
mkdir -p $coverdir | ||
fail=0 | ||
|
||
for dir in $(find . -type f -name '*_test.go' | xargs -n1 dirname | grep -v prog | sort -u); do | ||
go get -t -tags netgo $dir | ||
output=$(mktemp $coverdir/unit.XXXXXXXXXX) | ||
if ! go test -cpu 4 -tags netgo -covermode=count -coverprofile=$output $dir ; then | ||
fail=1 | ||
fi | ||
TESTDIRS=$(find . -type f -name '*_test.go' | xargs -n1 dirname | grep -v prog | sort -u) | ||
|
||
# If running on circle, use the scheduler to work out what tests to run on what shard | ||
if [ -n "$CIRCLECI" -a -z "$NO_SCHEDULER" ]; then | ||
TESTDIRS=$(echo $TESTDIRS | "$DIR/sched" sched units-$CIRCLE_BUILD_NUM $CIRCLE_NODE_TOTAL $CIRCLE_NODE_INDEX) | ||
echo $TESTDIRS | ||
fi | ||
|
||
for dir in $TESTDIRS; do | ||
|
||
GO_TEST_ARGS_RUN="$GO_TEST_ARGS" | ||
if [ -n "$SLOW" ]; then | ||
go get -t -tags netgo $dir | ||
output=$(mktemp $coverdir/unit.XXXXXXXXXX) | ||
GO_TEST_ARGS_RUN="$GO_TEST_ARGS -coverprofile=$output" | ||
fi | ||
|
||
START=$(date +%s) | ||
if ! go test $GO_TEST_ARGS_RUN $dir ; then | ||
fail=1 | ||
fi | ||
RUNTIME=$(( $(date +%s) - $START )) | ||
|
||
# Report test runtime when running on circle, to help scheduler | ||
if [ -n "$CIRCLECI" -a -z "$NO_SCHEDULER" ]; then | ||
"$DIR/sched" time $dir $RUNTIME | ||
fi | ||
done | ||
|
||
if [ -z "$COVERDIR" ] ; then | ||
cover $coverdir/* >profile.cov | ||
rm -rf $coverdir | ||
go tool cover -html=profile.cov -o=coverage.html | ||
if [ -n "$SLOW" -a -z "$COVERDIR" ] ; then | ||
$DIR/../testing/cover/cover $coverdir/* >profile.cov | ||
rm -rf $coverdir | ||
go tool cover -html=profile.cov -o=coverage.html | ||
go tool cover -func=profile.cov | tail -n1 | ||
fi | ||
|
||
exit $fail |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This comment was marked as abuse.
Sorry, something went wrong.