# container-ci-suite
[![Run Tox tests on container-ci-suite](https://github.com/sclorg/container-ci-suite/actions/workflows/python-tests.yml/badge.svg)](https://github.com/sclorg/container-ci-suite/actions/workflows/python-tests.yml)
This repo is used for testing SCL containers. For container execution `docker` or `podman` commands are used.
No Python bidings. The same for OpenShift tests. `oc` command is used.
## How to use Container CI Suite for testing containers
Install this suite by command:
```bash
pip3 install git+https://github.com/phracek/container-ci-suite
```
### Run a test with Container-CI-Suite
```python
import os
import pytest
from container_ci_suite.api import ContainerCISuite
image_name = os.environ.get("IMAGE_NAME", "nginx-container")
test_dir = os.path.abspath(os.path.dirname(__file__))
class TestDummyImage(object):
def test_s2i_usage(self):
ccs = ContainerCISuite(image_name=image_name)
ccs.s2i_usage()
```
### Run a test with Container-CI-Suite for Example repositories
```python
import os
import pytest
from container_ci_suite.openshift import OpenShiftAPI
test_dir = os.path.abspath(os.path.dirname(__file__))
IS_RUBY = OpenShiftAPI.get_raw_url_for_json(container="s2i-ruby-container", dir="imagestreams", filename="ruby-rhel.json")
IS_POSTGRESQL = OpenShiftAPI.get_raw_url_for_json(container="postgresql-container", dir="imagestreams", filename="postgresql-rhel.json")
TEMPLATE_RAILS_POSTGRESQL = OpenShiftAPI.get_raw_url_for_json(container="s2i-ruby-container", dir="examples", filename="rails-postgresql-persistent.json")
class TestRubyEx:
def setup_method(self):
self.oc_api = OpenShiftAPI(namespace="test-ruby-ex")
# Reference https://github.com/sclorg/s2i-nodejs-container/blob/master/test/test-lib-nodejs.sh#L561 (ct_os_test_template_app_func)
def test_deployment_template(self):
self.oc_api.create(IS_RUBY)
self.oc_api.create(IS_POSTGRESQL)
assert self.oc_api.check_is_exists(is_name="ruby", version_to_check="2.5-ubi8")
assert self.oc_api.check_is_exists(is_name="postgresql", version_to_check="10-el8")
self.oc_api.process_file(TEMPLATE_RAILS_POSTGRESQL)
self.oc_api.new_app(image_name="ruby:2.5-ubi8", github_repo="https://github.com/sclorg/ruby-ex")
self.oc_api.is_pod_ready(pod_name="")
self.oc_api.ct_os_check_service_image_info()
#oc process -f rails-postgresql.json -p NAMESPACE=$(oc project -q) | oc create -f -
# Reference https://github.com/sclorg/s2i-nodejs-container/blob/master/test/test-lib-nodejs.sh#L554 (ct_os_test_s2i_app_func)
# ct_os_deploy_s2i_image
def test_s2i_app_func(self):
self.oc_api.create(IS_RUBY)
self.oc_api.create(IS_POSTGRESQL)
assert self.oc_api.check_is_exists(is_name="ruby", version_to_check="2.5-ubi8")
assert self.oc_api.check_is_exists(is_name="postgresql", version_to_check="10-el8")
self.oc_api.process_file(TEMPLATE_RAILS_POSTGRESQL)
self.oc_api.new_app("ruby-ex-tests/ruby:2.5-ubi8~https://github.com/sclorg/ruby-ex")
self.oc_api.start-build() # service-name, --from-dir
self.oc_api.is_pod_ready()
self.oc_api.ct_os_check_service_image_info()
#oc process -f rails-postgresql.json -p NAMESPACE=$(oc project -q) | oc create -f -
# Reference https://github.com/sclorg/s2i-nodejs-container/blob/master/test/test-lib-nodejs.sh#L533 (ct_os_test_image_stream_quickstart)
# ct_os_deploy_s2i_image
def test_iamgestream_quicstart(self):
self.oc_api.create(IS_RUBY)
self.oc_api.create(IS_POSTGRESQL)
assert self.oc_api.check_is_exists(is_name="ruby", version_to_check="2.5-ubi8")
assert self.oc_api.check_is_exists(is_name="postgresql", version_to_check="10-el8")
self.oc_api.process_file(TEMPLATE_RAILS_POSTGRESQL)
self.oc_api.create()
self.oc_api.ct_os_test_template_app("ruby-ex-tests/ruby:2.5-ubi8~https://github.com/sclorg/ruby-ex")
self.oc_api.start-build() # service-name, --from-dir
self.oc_api.is_pod_ready()
self.oc_api.ct_os_check_service_image_info()
#oc process -f rails-postgresql.json -p NAMESPACE=$(oc project -q) | oc create -f -
```
## Run a test with Container-CI-Suite for Helm charts
```python
import os
import pytest
from container_ci_suite.helm import HelmChartsAPI
test_dir = os.path.abspath(os.path.dirname(__file__))
class TestHelmPostgresqlImageStreams:
def setup_method(self):
package_name = "postgresql-imagestreams"
path = os.path.join(test_dir, "../charts/redhat", package_name)
self.hc_api = HelmChartsAPI(path=path, package_name=package_name, version="0.0.1")
def test_package_imagestream(self):
self.hc_api.helm_package()
```
## OpenShift tests
* [ ] ct_os_cleanup
* [ ] ct_os_check_compulsory_vars
* [ ] ct_os_get_status
* [ ] ct_os_print_logs
* [ ] ct_os_enable_print_logs
* [ ] ct_get_public_ip
* [ ] ct_os_run_in_pod
* [ ] ct_os_get_service_ip
* [ ] ct_os_get_all_pods_status
* [ ] ct_os_get_all_pods_name
* [ ] ct_os_get_pod_status
* [ ] ct_os_get_build_pod_status
* [ ] ct_os_get_buildconfig_pod_name
* [ ] ct_os_get_pod_name
* [ ] ct_os_get_pod_ip
* [ ] ct_os_get_sti_build_logs
* [ ] ct_os_check_pod_readiness
* [ ] ct_os_wait_pod_ready
* [ ] ct_os_wait_rc_ready
* [ ] ct_os_deploy_pure_image
* [ ] ct_os_deploy_s2i_image
* [ ] ct_os_deploy_template_image
* [ ] _ct_os_get_uniq_project_name
* [ ] ct_os_new_project
* [ ] ct_os_delete_project
* [ ] ct_delete_all_objects
* [ ] ct_os_docker_login
* [ ] ct_os_upload_image
* [ ] ct_os_is_tag_exists
* [ ] ct_os_template_exists
* [ ] ct_os_install_in_centos
* [ ] ct_os_cluster_up
* [ ] ct_os_cluster_down
* [ ] ct_os_cluster_running
* [ ] ct_os_logged_in
* [ ] ct_os_set_path_oc
* [ ] ct_os_get_latest_ver
* [ ] ct_os_download_upstream_oc
* [ ] ct_os_test_s2i_app_func
* [ ] ct_os_test_s2i_app
* [ ] ct_os_test_template_app_func
* [ ] ct_os_test_template_app
* [ ] ct_os_test_image_update
* [ ] ct_os_deploy_cmd_image
* [ ] ct_os_cmd_image_run
* [ ] ct_os_test_response_internal
* [ ] ct_os_get_image_from_pod
* [ ] ct_os_check_cmd_internal
* [ ] ct_os_test_image_stream_template
* [ ] ct_os_wait_stream_ready
* [ ] ct_os_test_image_stream_s2i
* [ ] ct_os_test_image_stream_quickstart
* [ ] ct_os_service_image_info
Raw data
{
"_id": null,
"home_page": "https://github.com/sclorg/container-ci-suite",
"name": "container-ci-suite",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "tool, containers, images, tests",
"author": "Petr Hracek",
"author_email": "phracek@redhat.com",
"download_url": "https://files.pythonhosted.org/packages/76/2f/07145a0267b4de103aa39b6972eefbc603c890482429d745f064b59a5745/container_ci_suite-0.4.0.tar.gz",
"platform": null,
"description": "# container-ci-suite\n\n[![Run Tox tests on container-ci-suite](https://github.com/sclorg/container-ci-suite/actions/workflows/python-tests.yml/badge.svg)](https://github.com/sclorg/container-ci-suite/actions/workflows/python-tests.yml)\n\n\nThis repo is used for testing SCL containers. For container execution `docker` or `podman` commands are used.\nNo Python bidings. The same for OpenShift tests. `oc` command is used.\n\n## How to use Container CI Suite for testing containers\n\nInstall this suite by command:\n\n```bash\npip3 install git+https://github.com/phracek/container-ci-suite\n```\n\n### Run a test with Container-CI-Suite\n\n```python\nimport os\n\nimport pytest\n\nfrom container_ci_suite.api import ContainerCISuite\n\nimage_name = os.environ.get(\"IMAGE_NAME\", \"nginx-container\")\ntest_dir = os.path.abspath(os.path.dirname(__file__))\n\n\nclass TestDummyImage(object):\n def test_s2i_usage(self):\n ccs = ContainerCISuite(image_name=image_name)\n ccs.s2i_usage()\n\n```\n\n### Run a test with Container-CI-Suite for Example repositories\n\n```python\nimport os\n\nimport pytest\n\nfrom container_ci_suite.openshift import OpenShiftAPI\n\ntest_dir = os.path.abspath(os.path.dirname(__file__))\n\nIS_RUBY = OpenShiftAPI.get_raw_url_for_json(container=\"s2i-ruby-container\", dir=\"imagestreams\", filename=\"ruby-rhel.json\")\nIS_POSTGRESQL = OpenShiftAPI.get_raw_url_for_json(container=\"postgresql-container\", dir=\"imagestreams\", filename=\"postgresql-rhel.json\")\nTEMPLATE_RAILS_POSTGRESQL = OpenShiftAPI.get_raw_url_for_json(container=\"s2i-ruby-container\", dir=\"examples\", filename=\"rails-postgresql-persistent.json\")\n\nclass TestRubyEx:\n def setup_method(self):\n self.oc_api = OpenShiftAPI(namespace=\"test-ruby-ex\")\n\n # Reference https://github.com/sclorg/s2i-nodejs-container/blob/master/test/test-lib-nodejs.sh#L561 (ct_os_test_template_app_func)\n def test_deployment_template(self):\n self.oc_api.create(IS_RUBY)\n self.oc_api.create(IS_POSTGRESQL)\n assert self.oc_api.check_is_exists(is_name=\"ruby\", version_to_check=\"2.5-ubi8\")\n assert self.oc_api.check_is_exists(is_name=\"postgresql\", version_to_check=\"10-el8\")\n self.oc_api.process_file(TEMPLATE_RAILS_POSTGRESQL)\n self.oc_api.new_app(image_name=\"ruby:2.5-ubi8\", github_repo=\"https://github.com/sclorg/ruby-ex\")\n self.oc_api.is_pod_ready(pod_name=\"\")\n self.oc_api.ct_os_check_service_image_info()\n #oc process -f rails-postgresql.json -p NAMESPACE=$(oc project -q) | oc create -f -\n\n # Reference https://github.com/sclorg/s2i-nodejs-container/blob/master/test/test-lib-nodejs.sh#L554 (ct_os_test_s2i_app_func)\n # ct_os_deploy_s2i_image\n def test_s2i_app_func(self):\n self.oc_api.create(IS_RUBY)\n self.oc_api.create(IS_POSTGRESQL)\n assert self.oc_api.check_is_exists(is_name=\"ruby\", version_to_check=\"2.5-ubi8\")\n assert self.oc_api.check_is_exists(is_name=\"postgresql\", version_to_check=\"10-el8\")\n self.oc_api.process_file(TEMPLATE_RAILS_POSTGRESQL)\n self.oc_api.new_app(\"ruby-ex-tests/ruby:2.5-ubi8~https://github.com/sclorg/ruby-ex\")\n self.oc_api.start-build() # service-name, --from-dir\n self.oc_api.is_pod_ready()\n self.oc_api.ct_os_check_service_image_info()\n #oc process -f rails-postgresql.json -p NAMESPACE=$(oc project -q) | oc create -f -\n\n # Reference https://github.com/sclorg/s2i-nodejs-container/blob/master/test/test-lib-nodejs.sh#L533 (ct_os_test_image_stream_quickstart)\n # ct_os_deploy_s2i_image\n def test_iamgestream_quicstart(self):\n self.oc_api.create(IS_RUBY)\n self.oc_api.create(IS_POSTGRESQL)\n assert self.oc_api.check_is_exists(is_name=\"ruby\", version_to_check=\"2.5-ubi8\")\n assert self.oc_api.check_is_exists(is_name=\"postgresql\", version_to_check=\"10-el8\")\n self.oc_api.process_file(TEMPLATE_RAILS_POSTGRESQL)\n self.oc_api.create()\n self.oc_api.ct_os_test_template_app(\"ruby-ex-tests/ruby:2.5-ubi8~https://github.com/sclorg/ruby-ex\")\n self.oc_api.start-build() # service-name, --from-dir\n self.oc_api.is_pod_ready()\n self.oc_api.ct_os_check_service_image_info()\n #oc process -f rails-postgresql.json -p NAMESPACE=$(oc project -q) | oc create -f -\n\n```\n\n## Run a test with Container-CI-Suite for Helm charts\n\n```python\nimport os\n\nimport pytest\n\nfrom container_ci_suite.helm import HelmChartsAPI\n\ntest_dir = os.path.abspath(os.path.dirname(__file__))\n\n\nclass TestHelmPostgresqlImageStreams:\n def setup_method(self):\n package_name = \"postgresql-imagestreams\"\n path = os.path.join(test_dir, \"../charts/redhat\", package_name)\n self.hc_api = HelmChartsAPI(path=path, package_name=package_name, version=\"0.0.1\")\n def test_package_imagestream(self):\n self.hc_api.helm_package()\n\n```\n\n## OpenShift tests\n\n* [ ] ct_os_cleanup\n* [ ] ct_os_check_compulsory_vars\n* [ ] ct_os_get_status\n* [ ] ct_os_print_logs\n* [ ] ct_os_enable_print_logs\n* [ ] ct_get_public_ip\n* [ ] ct_os_run_in_pod\n* [ ] ct_os_get_service_ip\n* [ ] ct_os_get_all_pods_status\n* [ ] ct_os_get_all_pods_name\n* [ ] ct_os_get_pod_status\n* [ ] ct_os_get_build_pod_status\n* [ ] ct_os_get_buildconfig_pod_name\n* [ ] ct_os_get_pod_name\n* [ ] ct_os_get_pod_ip\n* [ ] ct_os_get_sti_build_logs\n* [ ] ct_os_check_pod_readiness\n* [ ] ct_os_wait_pod_ready\n* [ ] ct_os_wait_rc_ready\n* [ ] ct_os_deploy_pure_image\n* [ ] ct_os_deploy_s2i_image\n* [ ] ct_os_deploy_template_image\n* [ ] _ct_os_get_uniq_project_name\n* [ ] ct_os_new_project\n* [ ] ct_os_delete_project\n* [ ] ct_delete_all_objects\n* [ ] ct_os_docker_login\n* [ ] ct_os_upload_image\n* [ ] ct_os_is_tag_exists\n* [ ] ct_os_template_exists\n* [ ] ct_os_install_in_centos\n* [ ] ct_os_cluster_up\n* [ ] ct_os_cluster_down\n* [ ] ct_os_cluster_running\n* [ ] ct_os_logged_in\n* [ ] ct_os_set_path_oc\n* [ ] ct_os_get_latest_ver\n* [ ] ct_os_download_upstream_oc\n* [ ] ct_os_test_s2i_app_func\n* [ ] ct_os_test_s2i_app\n* [ ] ct_os_test_template_app_func\n* [ ] ct_os_test_template_app\n* [ ] ct_os_test_image_update\n* [ ] ct_os_deploy_cmd_image\n* [ ] ct_os_cmd_image_run\n* [ ] ct_os_test_response_internal\n* [ ] ct_os_get_image_from_pod\n* [ ] ct_os_check_cmd_internal\n* [ ] ct_os_test_image_stream_template\n* [ ] ct_os_wait_stream_ready\n* [ ] ct_os_test_image_stream_s2i\n* [ ] ct_os_test_image_stream_quickstart\n* [ ] ct_os_service_image_info\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A python3 container CI tool for testing images.",
"version": "0.4.0",
"project_urls": {
"Homepage": "https://github.com/sclorg/container-ci-suite"
},
"split_keywords": [
"tool",
" containers",
" images",
" tests"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "aa85460f2760c53a913a44cfacda9d7e637afe31e106ebadcab35041b81231c9",
"md5": "39d32f4eb38ead9ee9eb9a1431999cb1",
"sha256": "6802c7feee4cf3854ef40fc680481923106f88855e0faa1328a56c7c5f9a83b5"
},
"downloads": -1,
"filename": "container_ci_suite-0.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "39d32f4eb38ead9ee9eb9a1431999cb1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 33291,
"upload_time": "2024-09-03T11:43:30",
"upload_time_iso_8601": "2024-09-03T11:43:30.075622Z",
"url": "https://files.pythonhosted.org/packages/aa/85/460f2760c53a913a44cfacda9d7e637afe31e106ebadcab35041b81231c9/container_ci_suite-0.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "762f07145a0267b4de103aa39b6972eefbc603c890482429d745f064b59a5745",
"md5": "6f5e2fdda2516dad3708d467cf0c8ee9",
"sha256": "c133d3ba511638c5fe17a3b31679d146bfb47f1914886bf0dfef83b9de793fdb"
},
"downloads": -1,
"filename": "container_ci_suite-0.4.0.tar.gz",
"has_sig": false,
"md5_digest": "6f5e2fdda2516dad3708d467cf0c8ee9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 28949,
"upload_time": "2024-09-03T11:43:31",
"upload_time_iso_8601": "2024-09-03T11:43:31.541021Z",
"url": "https://files.pythonhosted.org/packages/76/2f/07145a0267b4de103aa39b6972eefbc603c890482429d745f064b59a5745/container_ci_suite-0.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-03 11:43:31",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sclorg",
"github_project": "container-ci-suite",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "pytest",
"specs": []
},
{
"name": "flexmock",
"specs": []
},
{
"name": "GitPython",
"specs": []
},
{
"name": "requests",
"specs": []
},
{
"name": "PyYAML",
"specs": []
}
],
"tox": true,
"lcname": "container-ci-suite"
}