A python3 container CI tool for testing images.
Project description
container-ci-suite
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 from PyPi:
pip3 install container-ci-suite
Install this suite from GitHub repository:
pip3 install git+https://github.com/sclorg/container-ci-suite
Run a test with Container-CI-Suite
import os
import pytest
from container_ci_suite.container import ContainerAPI
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 = ContainerAPI(image_name=image_name)
ccs.s2i_usage()
Run a test with Container-CI-Suite for Example repositories
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
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)
def test_package_imagestream(self):
self.hc_api.helm_package()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file container_ci_suite-0.11.2.tar.gz.
File metadata
- Download URL: container_ci_suite-0.11.2.tar.gz
- Upload date:
- Size: 88.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
217df5ee47f24a33d363eeb5d33f377a8d5efcdea4e4002b47f28bce69843efb
|
|
| MD5 |
1e99a0cf6ec198c3589cbdaeeaa964cd
|
|
| BLAKE2b-256 |
a25ad943bbc334c5443c38298e85eb6967f08ae9f80f7ffbf17365694ae49a82
|
File details
Details for the file container_ci_suite-0.11.2-py3-none-any.whl.
File metadata
- Download URL: container_ci_suite-0.11.2-py3-none-any.whl
- Upload date:
- Size: 87.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02566ffb43f6892b88f2f129a169e185348df552286fecfa8db1351dd94c64b2
|
|
| MD5 |
0be028ec8a36232af68ad3d9274e7901
|
|
| BLAKE2b-256 |
7cb2077fd8475e21960f5adb4bbeeff27c63453bf4d30c7bd719ff685ed436aa
|