diff --git a/tests/interop/run_tests.sh b/tests/interop/run_tests.sh index 54222cb59..a1af3b4be 100755 --- a/tests/interop/run_tests.sh +++ b/tests/interop/run_tests.sh @@ -31,4 +31,6 @@ pytest -lv --disable-warnings test_validate_hub_site_components.py --kubeconfig 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_modify_web_content.py --kubeconfig $KUBECONFIG --junit-xml $WORKSPACE/test_modify_web_content.xml + python3 create_ci_badge.py diff --git a/tests/interop/test_modify_web_content.py b/tests/interop/test_modify_web_content.py new file mode 100644 index 000000000..44cf045c3 --- /dev/null +++ b/tests/interop/test_modify_web_content.py @@ -0,0 +1,89 @@ +import logging +import os +import re +import subprocess +import time + +import pytest +import requests +from ocp_resources.route import Route +from openshift.dynamic.exceptions import NotFoundError +from validatedpatterns_tests.interop.edge_util import modify_file_content + +from . import __loggername__ + +logger = logging.getLogger(__loggername__) + + +@pytest.mark.modify_web_content +def test_modify_web_content(openshift_dyn_client): + logger.info("Find the url for the hello-world route") + try: + for route in Route.get( + dyn_client=openshift_dyn_client, + namespace="hello-world", + name="hello-world", + ): + logger.info(route.instance.spec.host) + except NotFoundError: + err_msg = "hello-world url/route is missing in hello-world namespace" + logger.error(f"FAIL: {err_msg}") + assert False, err_msg + + url = "http://" + route.instance.spec.host + response = requests.get(url) + logger.info(f"Current page content: {response.content}") + + if os.getenv("EXTERNAL_TEST") != "true": + chart = ( + f"{os.environ['HOME']}" + + "/validated_patterns/multicloud-gitops/charts/" + + "all/hello-world/templates/hello-world-cm.yaml" + ) + else: + chart = "../../charts/all/hello-world/templates/hello-world-cm.yaml" + + logger.info("Modify the file content") + orig_heading = "