예제 #1
0
    def _oc_command(self, args):
        """
        return oc command to run

        :param args: list of str, arguments and options passed to oc binary
        :return: list of str
        """
        oc_command_exists()
        return ["oc"] + args
예제 #2
0
# SPDX-License-Identifier: MIT
#
"""
Tests for OpenShift backend
"""

import logging
import pytest

from conu import OpenshiftBackend
from conu.utils import get_oc_api_token, oc_command_exists, is_oc_cluster_running
from ..constants import CENTOS_MARIADB_10_2, CENTOS_PYTHON_3, MY_PROJECT,\
    CENTOS_POSTGRES_9_6, CENTOS_POSTGRES_9_6_TAG, DJANGO_POSTGRES_TEMPLATE, INTERNAL_REGISTRY_URL


@pytest.mark.skipif(not oc_command_exists(),
                    reason="OpenShift is not installed!")
@pytest.mark.skipif(not is_oc_cluster_running(),
                    reason="OpenShift cluster is not running!")
class TestOpenshift(object):
    def test_get_project_name(self):
        api_key = get_oc_api_token()
        with OpenshiftBackend(
                api_key=api_key,
                logging_level=logging.DEBUG) as openshift_backend:
            assert openshift_backend.get_current_project() == MY_PROJECT

    def test_import_image(self):
        api_key = get_oc_api_token()
        with OpenshiftBackend(
                api_key=api_key,
예제 #3
0
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

"""
Tests for OpenShift backend
"""

import logging
import pytest

from conu.backend.origin.backend import OpenshiftBackend
from conu.backend.docker.backend import DockerBackend
from conu.utils import get_oc_api_token, oc_command_exists, is_oc_cluster_running


@pytest.mark.skipif(not oc_command_exists(), reason="OpenShift is not installed!")
@pytest.mark.skipif(not is_oc_cluster_running(), reason="OpenShift cluster is not running!")
class TestOpenshift(object):

    def test_oc_s2i_remote(self):
        api_key = get_oc_api_token()
        with OpenshiftBackend(api_key=api_key, logging_level=logging.DEBUG) as openshift_backend:

            with DockerBackend(logging_level=logging.DEBUG) as backend:
                python_image = backend.ImageClass("centos/python-36-centos7")

                OpenshiftBackend.login_to_registry('developer')

                app_name = openshift_backend.new_app(
                    python_image,
                    source="https://github.com/openshift/django-ex.git",