public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-docker] epel10.2: package tests, run integr tests in CI
@ 2026-10-13 18:26 Tomas Tomecek
  0 siblings, 0 replies; only message in thread
From: Tomas Tomecek @ 2026-10-13 18:26 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/python-docker
            Branch : epel10.2
            Commit : 832ae4252514440d73b0e682f48d64ad019592da
            Author : Tomas Tomecek <ttomecek@redhat.com>
            Date   : 2017-11-28T12:23:33+01:00
            Stats  : +101/-1 in 5 file(s)
            URL    : https://src.fedoraproject.org/rpms/python-docker/c/832ae4252514440d73b0e682f48d64ad019592da?branch=epel10.2

            Log:
            package tests, run integr tests in CI

Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>

---
diff --git a/.gitignore b/.gitignore
index cb983ca..62913c8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,3 +7,6 @@
 /docker-2.5.1.tar.gz
 /docker-2.6.0.tar.gz
 /docker-2.6.1.tar.gz
+tests/artifacts/
+tests/tests.retry
+tests/atomic.qcow2

diff --git a/python-docker.spec b/python-docker.spec
index d715fec..4f5e620 100644
--- a/python-docker.spec
+++ b/python-docker.spec
@@ -11,7 +11,7 @@
 
 Name:           python-%{srcname}
 Version:        2.6.1
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        A Python library for the Docker Engine API
 License:        ASL 2.0
 URL:            https://pypi.python.org/pypi/%{srcname}
@@ -74,6 +74,23 @@ Obsoletes:      python-docker-py < 2
 It lets you do anything the docker command does, but from within Python apps –
 run containers, manage containers, manage Swarms, etc.
 
+%package tests
+Summary:        Unit tests and integration tests for python-docker
+Requires:       python2-%{srcname}
+Requires:       python2-mock >= 1.0.1
+Requires:       %{?fedora:python2-}pytest >= 2.9.1
+Requires:       python%{?fedora:2}-coverage >= 3.7.1
+Requires:       python2-pytest-cov >= 2.1.0
+Requires:       python%{?fedora:2}-flake8 >= 2.4.1
+Requires:       python%{?fedora:2}-requests >= 2.5.2
+Requires:       python%{?fedora:2}-six >= 1.4.0
+Requires:       python-websocket-client >= 0.32.0
+Requires:       python%{?fedora:2}-docker-pycreds >= 0.2.1
+Requires:       python%{?fedora:2}-backports-ssl_match_hostname >= 3.5
+Requires:       python-ipaddress >= 1.0.16
+%description tests
+Upstream test-suite (unit, integration) packaged as RPM.
+
 %if %{with python3}
 %package -n python3-%{srcname}
 Summary:        A Python library for the Docker Engine API
@@ -126,6 +143,10 @@ rm -fr docker.egg-info
 %py3_install
 %endif # with_python3
 
+# copy tests to /usr/libexec/installed-tests
+mkdir -p %{buildroot}%{_libexecdir}/installed-tests/%{name}
+cp -avr tests/ %{buildroot}%{_libexecdir}/installed-tests/%{name}/
+
 %check
 %if %{with tests}
 %{__python2} -m pytest -v tests/unit/
@@ -150,7 +171,13 @@ rm -fr docker.egg-info
 %{python3_sitelib}/*
 %endif # with_python3
 
+%files tests
+%{_libexecdir}/installed-tests
+
 %changelog
+* Tue Nov 28 2017 Tomas Tomecek <ttomecek@redhat.com> - 2.6.1-2
+- Package tests
+
 * Thu Nov 09 2017 Tomas Tomecek <ttomecek@redhat.com> - 2.6.1-1
 - new upstream release: 2.6.1
 

diff --git a/tests/TODO b/tests/TODO
new file mode 100644
index 0000000..caf0dd0
--- /dev/null
+++ b/tests/TODO
@@ -0,0 +1 @@
+* build RPMs locally and inject them inside atomic host VM (local testing should not rely on repositories)

diff --git a/tests/integration.yml b/tests/integration.yml
new file mode 100644
index 0000000..6a47a35
--- /dev/null
+++ b/tests/integration.yml
@@ -0,0 +1,67 @@
+---
+- hosts: localhost
+  vars:
+  - artifacts: ./artifacts
+  - remote_artifacts: /root/artifacts
+  tasks:
+  - name: Make local artifacts directory
+    file: path={{ artifacts }} state=directory owner=root mode=755 recurse=yes
+    tags:
+      - classic
+
+  - name: Make artifacts directory on Atomic Host
+    file: path={{ remote_artifacts }} state=directory owner=root mode=755 recurse=yes
+    tags:
+      - atomic
+
+  - name: Install pytest and the test-suite locally
+    dnf:
+      name: "{{ item }}"
+      state: present
+    tags:
+      - classic
+    with_items:
+      - python-docker-tests
+      - python2-pytest
+
+  - name: Install pytest and the test-suite on Atomic Host
+    shell: rpm-ostree install python2-pytest python-docker-tests && rpm-ostree ex livefs
+    tags:
+      - atomic
+
+  - name: Ensure dockerd is running
+    service:
+      name: docker
+      state: started
+    tags:
+      - atomic
+      - classic
+
+  - name: Atomic Host test block
+    block:
+      - name: Run integration test-suite on Atomic Host
+        # -k "test_create_with_restart_policy" for local testing
+        shell: py.test -v ./tests/integration/ | tee {{ remote_artifacts }}/test.log
+        args:
+          chdir: /usr/libexec/installed-tests/python-docker/
+    always:
+      - name: Pull out the artifacts
+        fetch:
+          dest: "{{ artifacts }}/"
+          src: "{{ remote_artifacts }}/test.log"
+    tags:
+      - atomic
+
+  - name: Get abspath of artifacts dir
+    command: realpath {{ artifacts }}
+    register: artifacts_abs
+    tags:
+      - classic
+
+  - name: Run integration test-suite locally
+    # -k "test_create_with_restart_policy" for local testing
+    shell: py.test -v ./tests/integration/ | tee {{ artifacts_abs.stdout }}/test.log
+    args:
+      chdir: /usr/libexec/installed-tests/python-docker/
+    tags:
+      - classic

diff --git a/tests/tests.yml b/tests/tests.yml
new file mode 100644
index 0000000..1d85990
--- /dev/null
+++ b/tests/tests.yml
@@ -0,0 +1,2 @@
+- name: Run the tests
+  import_playbook: integration.yml

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-13 18:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-13 18:26 [rpms/python-docker] epel10.2: package tests, run integr tests in CI Tomas Tomecek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox