-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: set of fixes and improvements for vega-market-sim (#471)
--------- Co-authored-by: Tom McLean <[email protected]>
- Loading branch information
1 parent
237a86f
commit bfc8439
Showing
10 changed files
with
228 additions
and
63 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,17 @@ | ||
import os | ||
import logging | ||
|
||
|
||
# ref: https://pytest-xdist.readthedocs.io/en/latest/how-to.html#creating-one-log-file-for-each-worker | ||
def pytest_configure(config): | ||
path = "test_logs" | ||
if not os.path.exists(path): | ||
os.makedirs(path) | ||
|
||
worker_id = os.environ.get("PYTEST_XDIST_WORKER") | ||
if worker_id is not None: | ||
logging.basicConfig( | ||
format=config.getini("log_file_format"), | ||
filename=f"{path}/tests_{worker_id}.test.log", | ||
level=os.getenv("LOG_LEVEL", config.getini("log_file_level")), | ||
) |
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,3 +1,8 @@ | ||
[pytest] | ||
markers = | ||
integration: mark a test as requiring a full vega sim infrastructure with running backend | ||
integration: mark a test as requiring a full vega sim infrastructure with running backend | ||
|
||
log_file_format=%(asctime)s.%(msecs)03d %(threadName)s %(processName)s (%(filename)s:%(funcName)s:%(lineno)s):%(message)s | ||
log_file_date_format=%Y-%m-%d %H:%M:%S | ||
|
||
log_file_level = INFO |
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,9 +1,21 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
|
||
# Default values for environment variables. Those variables may be exported with bash `export <ENV_NAME>=value` | ||
# Jenkins provides definition of the below variables | ||
: "${PARALLEL_WORKERS:=0}" | ||
: "${TEST_FUNCTION:=}" | ||
: "${LOG_LEVEL:=INFO}" | ||
|
||
WORK_DIR="$(realpath "$(dirname "$0")/..")" | ||
RESULT_DIR="${WORK_DIR}/test_logs/$(date '+%F_%H%M%S')-integration" | ||
mkdir -p "${RESULT_DIR}" | ||
|
||
pytest -s -v -m integration --junitxml ${RESULT_DIR}/integration-test-results.xml --log-cli-level INFO | ||
|
||
set -x | ||
pytest -s -v -m integration \ | ||
--junitxml ${RESULT_DIR}/integration-test-results.xml \ | ||
--log-cli-level "${LOG_LEVEL}" \ | ||
-n "${PARALLEL_WORKERS}" \ | ||
-k "${TEST_FUNCTION}" |
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
Oops, something went wrong.