-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit tests for the benchmark repo (#147)
- Loading branch information
Showing
27 changed files
with
2,566 additions
and
1,599 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[run] | ||
include = scripts/* | ||
|
||
[report] | ||
fail_under = 80 |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,5 +1,5 @@ | ||
import os | ||
import json | ||
import os | ||
|
||
from google.cloud import storage | ||
|
||
|
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,24 @@ | ||
#!/bin/bash | ||
# | ||
# Run unit tests | ||
# | ||
# NOTE: This script expects to be run from the project root with | ||
# ./scripts/run_tests.sh | ||
set -o pipefail | ||
|
||
function display_result { | ||
RESULT=$1 | ||
EXIT_STATUS=$2 | ||
TEST=$3 | ||
|
||
if [ $RESULT -ne 0 ]; then | ||
echo -e "\033[31m$TEST failed\033[0m" | ||
exit $EXIT_STATUS | ||
else | ||
echo -e "\033[32m$TEST passed\033[0m" | ||
fi | ||
} | ||
|
||
py.test --cov-config=.coveragerc --cov --cov-report html | ||
|
||
display_result $? 3 "Unit tests" |
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
Empty file.
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,42 @@ | ||
import pytest | ||
|
||
from scripts.get_summary import get_results | ||
|
||
EXPECTED_OUTPUT_SINGLE_FOLDER = ( | ||
'---\n' | ||
'Percentile Averages:\n' | ||
'50th: 58ms\n' | ||
'90th: 96ms\n' | ||
'95th: 173ms\n' | ||
'99th: 301ms\n' | ||
'99.9th: 477ms\n' | ||
'---\n' | ||
'GETs (99th): 380ms\n' | ||
'POSTs (99th): 211ms\n' | ||
'---\n' | ||
'Total Requests: 70,640\n' | ||
'Total Failures: 1\n' | ||
'Error Percentage: 0.0%\n' | ||
) | ||
|
||
EXPECTED_OUTPUT_MULTIPLE_FOLDERS = ( | ||
'---\n' | ||
'Percentile Averages:\n' | ||
'50th: 58ms\n' | ||
'90th: 98ms\n' | ||
'95th: 176ms\n' | ||
'99th: 313ms\n' | ||
'99.9th: 595ms\n' | ||
'---\n' | ||
'GETs (99th): 383ms\n' | ||
'POSTs (99th): 234ms\n' | ||
'---\n' | ||
'Total Requests: 211,841\n' | ||
'Total Failures: 2\n' | ||
'Error Percentage: 0.0%\n' | ||
) | ||
|
||
|
||
@pytest.fixture | ||
def get_results_single_file(): | ||
return get_results(folders=["./tests/mock_stats/2024-02-07T03:09:41"]) |
Oops, something went wrong.