-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from validatedpatterns/run_tests
Updates to include vp-qe-test-common code and non-pipeline CI runner
- Loading branch information
Showing
11 changed files
with
223 additions
and
732 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,19 @@ | ||
# Running tests | ||
|
||
## Steps | ||
|
||
* install oc client at ~/oc_client/oc | ||
* create python3 venv, clone patterns repository | ||
* export KUBECONFIG=\<path to hub kubeconfig file> | ||
* export KUBECONFIG_EDGE=\<path to edge kubeconfig file> | ||
* export INFRA_PROVIDER=\<infra platform description> | ||
* (optional) export WORKSPACE=\<dir to save test results to> (defaults to /tmp) | ||
* cd \<pattern dir>/tests/interop | ||
* pip install -r requirements.txt | ||
* ./run_tests.sh | ||
|
||
## Results | ||
|
||
* results .xml files will be placed at $WORKSPACE | ||
* test logs will be placed at $WORKSPACE/.results/test_execution_logs/ | ||
* CI badge file will be placed at $WORKSPACE |
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,51 +1,2 @@ | ||
import os | ||
|
||
import pytest | ||
from kubernetes import config | ||
from kubernetes.client import Configuration | ||
from openshift.dynamic import DynamicClient | ||
|
||
from . import __loggername__ | ||
from .css_logger import CSS_Logger | ||
|
||
|
||
def pytest_addoption(parser): | ||
parser.addoption( | ||
"--kubeconfig", | ||
action="store", | ||
default=None, | ||
help="The full path to the kubeconfig file to be used", | ||
) | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def get_kubeconfig(request): | ||
if request.config.getoption("--kubeconfig"): | ||
k8config = request.config.getoption("--kubeconfig") | ||
elif "KUBECONFIG" in os.environ.keys() and os.environ["KUBECONFIG"]: | ||
k8config = os.environ["KUBECONFIG"] | ||
else: | ||
raise ValueError( | ||
"A kubeconfig file was not provided. Please provide one either " | ||
"via the --kubeconfig command option or by setting a KUBECONFIG " | ||
"environment variable" | ||
) | ||
return k8config | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def kube_config(get_kubeconfig): | ||
kc = Configuration | ||
config.load_kube_config(config_file=get_kubeconfig, client_configuration=kc) | ||
return kc | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def openshift_dyn_client(get_kubeconfig): | ||
return DynamicClient(client=config.new_client_from_config(get_kubeconfig)) | ||
|
||
|
||
@pytest.fixture(scope="session", autouse=True) | ||
def setup_logger(): | ||
logger = CSS_Logger(__loggername__) | ||
return logger | ||
from validatedpatterns_tests.interop.conftest_logger import * # noqa: F401, F403 | ||
from validatedpatterns_tests.interop.conftest_openshift import * # noqa: F401, F403 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pytest | ||
kubernetes | ||
openshift | ||
openshift-python-wrapper | ||
git+https://github.com/validatedpatterns/vp-qe-test-common.git@development#egg=vp-qe-test-common |
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,27 @@ | ||
#!/usr/bin/bash | ||
|
||
export EXTERNAL_TEST="true" | ||
|
||
if [ -z "${KUBECONFIG}" ]; then | ||
echo "No kubeconfig file set for hub cluster" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "${KUBECONFIG_EDGE}" ]; then | ||
echo "No kubeconfig file set for edge cluster" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "${WORKSPACE}" ]; then | ||
export WORKSPACE=/tmp | ||
fi | ||
|
||
pytest -lv --disable-warnings test_subscription_status_hub.py --kubeconfig $KUBECONFIG --junit-xml $WORKSPACE/test_subscription_status_hub.xml | ||
|
||
pytest -lv --disable-warnings test_subscription_status_edge.py --kubeconfig $KUBECONFIG_EDGE --junit-xml $WORKSPACE/test_subscription_status_edge.xml | ||
|
||
pytest -lv --disable-warnings test_validate_hub_site_components.py --kubeconfig $KUBECONFIG --junit-xml $WORKSPACE/test_validate_hub_site_components.xml | ||
|
||
KUBECONFIG=$KUBECONFIG_EDGE pytest -lv --disable-warnings test_validate_edge_site_components.py --kubeconfig $KUBECONFIG_EDGE --junit-xml $WORKSPACE/test_validate_edge_site_components.xml | ||
|
||
pytest -lv --disable-warnings test_validate_pipelineruns.py --kubeconfig $KUBECONFIG --junit-xml $WORKSPACE/test_validate_pipelineruns.xml |
Oops, something went wrong.