-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: deprecate splunk-hec-token default value and break test executio…
…n on exception (#806) Changes: - deprecate default value of splunk-hec-token - give a warning when it's used - add console handler to logger - warnings and errors beside being logged to pytest_splunk_addon.log are also logged to console - other minor refactors from PR-803 Already released on develop and tested on couple of repos. splunk/splunk-add-on-for-google-workspace#515 References: https://splunk.atlassian.net/browse/ADDON-66599 https://github.com/splunk/pytest-splunk-addon/pull/803/files --------- Co-authored-by: mkolasinski-splunk <105011638+mkolasinski-splunk@users.noreply.github.com>
- Loading branch information
1 parent
4a2d5c3
commit 7cc8880
Showing
6 changed files
with
130 additions
and
9 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
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 |
---|---|---|
|
@@ -35,3 +35,4 @@ test_report.md | |
*.pickle | ||
*_events.lock | ||
*_events | ||
.venv |
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,44 @@ | ||
import os | ||
import pytest | ||
import requests | ||
|
||
pytest_plugins = "pytester" | ||
|
||
|
||
def pytest_configure(config): | ||
config.addinivalue_line("markers", "external: Test search time only") | ||
config.addinivalue_line("markers", "docker: Test search time only") | ||
config.addinivalue_line("markers", "doc: Test Sphinx docs") | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def docker_compose_files(request): | ||
""" | ||
Get an absolute path to the `docker-compose.yml` file. Override this | ||
fixture in your tests if you need a custom location. | ||
Returns: | ||
string: the path of the `docker-compose.yml` file | ||
""" | ||
docker_compose_path = os.path.join( | ||
str(request.config.invocation_dir), "docker-compose.yml" | ||
) | ||
# LOGGER.info("docker-compose path: %s", docker_compose_path) | ||
|
||
return [docker_compose_path] | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def docker_services_project_name(pytestconfig): | ||
rootdir = str(pytestconfig.rootdir) | ||
docker_compose_v2_rootdir = rootdir.lower().replace("/", "") | ||
return f"pytest{docker_compose_v2_rootdir}" | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def splunk_hec_uri(splunk, request): | ||
splunk_session = requests.Session() | ||
splunk_session.headers = {"Authorization": f"Splunk test-token"} | ||
uri = f'{request.config.getoption("splunk_hec_scheme")}://{splunk["forwarder_host"]}:{splunk["port_hec"]}/services/collector' | ||
return splunk_session, uri |
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