From acd44b0d7495364a9be01bca932731ad21c1d29d Mon Sep 17 00:00:00 2001
From: Michal Konečný <mkonecny@redhat.com>
Date: Jun 07 2023 11:03:19 +0000
Subject: Update test containers


This updates test containers for CentOS to CentOS Stream 8 and 9 and Fedora test
containers to F37 and F38.

Signed-off-by: Michal Konečný <mkonecny@redhat.com>

---

diff --git a/Makefile b/Makefile
index 4598ab1..a714905 100644
--- a/Makefile
+++ b/Makefile
@@ -144,53 +144,53 @@ quickrun: container-quickrun
 	docker run -v `pwd`:/code:z -t --rm -it -p 8080 ipsilon-quickrun
 
 # Testing within containers
-container-centos7:
-	@echo "Building CentOS 7 container ..."
-	@(cat tests/containers/Dockerfile-base tests/containers/Dockerfile-centos tests/containers/Dockerfile-rpm tests/containers/Dockerfile-rpm-py2; echo "USER testuser") | sed -e 's/BASE/centos:7/' | docker build -f - -q -t ipsilon-centos7 .
-	@echo "CentOS 7 container built"
-
-container-centos8:
-	@echo "Building CentOS 8 container ..."
-	@(cat tests/containers/Dockerfile-base tests/containers/Dockerfile-centos tests/containers/Dockerfile-rpm tests/containers/Dockerfile-rpm-py3; echo "USER testuser") | sed -e 's/BASE/centos:8/' | docker build -f - -q -t ipsilon-centos8 .
-	@echo "CentOS 8 container built"
-
-container-fedora35:
-	@echo "Building Fedora 35 container ..."
-	@(cat tests/containers/Dockerfile-base tests/containers/Dockerfile-fedora tests/containers/Dockerfile-rpm tests/containers/Dockerfile-rpm-py3; echo "USER testuser") | sed -e 's/BASE/fedora:35/' | docker build -f - -t ipsilon-fedora35 .
-	@echo "Fedora 35 container built"
-
-container-fedora36:
-	@echo "Building Fedora 36 container ..."
-	@(cat tests/containers/Dockerfile-base tests/containers/Dockerfile-fedora tests/containers/Dockerfile-rpm tests/containers/Dockerfile-rpm-py3; echo "USER testuser") | sed -e 's/BASE/fedora:36/' | docker build -f - -t ipsilon-fedora36 .
-	@echo "Fedora 36 container built"
-
-containers: container-centos7 container-fedora35 container-fedora36
+container-centos8-stream:
+	@echo "Building CentOS 8 Stream container ..."
+	@(cat tests/containers/Dockerfile-base tests/containers/Dockerfile-centos8 tests/containers/Dockerfile-rpm tests/containers/Dockerfile-rpm-py3; echo "USER testuser") | sed -e 's/BASE/centos:stream8/' | docker build -f - -q -t ipsilon-centos8-stream .
+	@echo "CentOS 8 Stream container built"
+
+container-centos9-stream:
+	@echo "Building CentOS 9 Stream container ..."
+	@(cat tests/containers/Dockerfile-base tests/containers/Dockerfile-centos9 tests/containers/Dockerfile-rpm tests/containers/Dockerfile-rpm-py3; echo "USER testuser") | sed -e 's/BASE/centos:stream9/' | docker build -f - -q -t ipsilon-centos9-stream .
+	@echo "CentOS 9 Stream container built"
+
+container-fedora37:
+	@echo "Building Fedora 37 container ..."
+	@(cat tests/containers/Dockerfile-base tests/containers/Dockerfile-fedora tests/containers/Dockerfile-rpm tests/containers/Dockerfile-rpm-py3; echo "USER testuser") | sed -e 's/BASE/fedora:37/' | docker build -f - -t ipsilon-fedora37 .
+	@echo "Fedora 37 container built"
+
+container-fedora38:
+	@echo "Building Fedora 38 container ..."
+	@(cat tests/containers/Dockerfile-base tests/containers/Dockerfile-fedora tests/containers/Dockerfile-rpm tests/containers/Dockerfile-rpm-py3; echo "USER testuser") | sed -e 's/BASE/fedora:38/' | docker build -f - -t ipsilon-fedora38 .
+	@echo "Fedora 38 container built"
+
+containers: container-centos9-stream container-fedora37 container-fedora38
 	@echo "Containers built"
 
-containertest-centos7: container-centos7
-	@echo "Starting CentOS 7 tests ..."
-	@docker run -v `pwd`:/code:z -t --rm ipsilon-centos7
-	@echo "CentOS 7 passed"
+containertest-centos8-stream: container-centos8-stream
+	@echo "Starting CentOS 8 Stream tests ..."
+	@docker run -v `pwd`:/code:z -t --rm ipsilon-centos8-stream
+	@echo "CentOS 8 Stream passed"
 
-containertest-centos8: container-centos8
-	@echo "Starting CentOS 8 tests ..."
-	@docker run -v `pwd`:/code:z -t --rm ipsilon-centos8
-	@echo "CentOS 8 passed"
+containertest-centos9-stream: container-centos9-stream
+	@echo "Starting CentOS 9 Stream tests ..."
+	@docker run -v `pwd`:/code:z -t --rm ipsilon-centos9-stream
+	@echo "CentOS 9 Stream passed"
 
-containertest-fedora35: container-fedora35
-	@echo "Starting Fedora 35 tests ..."
-	@docker run -v `pwd`:/code:z -t --rm ipsilon-fedora35
-	@echo "Fedora 35 passed"
+containertest-fedora37: container-fedora37
+	@echo "Starting Fedora 37 tests ..."
+	@docker run -v `pwd`:/code:z -t --rm ipsilon-fedora37
+	@echo "Fedora 37 passed"
 
-containertest-fedora36: container-fedora36
-	@echo "Starting Fedora 36 tests ..."
-	@docker run -v `pwd`:/code:z -t --rm ipsilon-fedora36
-	@echo "Fedora 36 passed"
+containertest-fedora38: container-fedora38
+	@echo "Starting Fedora 38 tests ..."
+	@docker run -v `pwd`:/code:z -t --rm ipsilon-fedora38
+	@echo "Fedora 38 passed"
 
-containertest-lint: container-fedora35
+containertest-lint: container-fedora37
 	@echo "Starting code lint tests ..."
-	@docker run -v `pwd`:/code:z -t --rm --entrypoint /usr/bin/make ipsilon-fedora35 lint security
+	@docker run -v `pwd`:/code:z -t --rm --entrypoint /usr/bin/make ipsilon-fedora37 lint security
 	@echo "Code lint tests passed"
 
-containertest: containertest-lint containertest-centos7 containertest-fedora35 containertest-fedora36
+containertest: containertest-lint containertest-centos9-stream containertest-centos8-stream containertest-fedora37 containertest-fedora38
 	@echo "Container tests passed"
diff --git a/tests/containers/Dockerfile-centos b/tests/containers/Dockerfile-centos
deleted file mode 100644
index 7e7e72b..0000000
--- a/tests/containers/Dockerfile-centos
+++ /dev/null
@@ -1 +0,0 @@
-RUN yum install -y epel-release
diff --git a/tests/containers/Dockerfile-centos8 b/tests/containers/Dockerfile-centos8
new file mode 100644
index 0000000..73c9f02
--- /dev/null
+++ b/tests/containers/Dockerfile-centos8
@@ -0,0 +1,2 @@
+RUN dnf install -y epel-release
+RUN dnf config-manager --set-enabled powertools
diff --git a/tests/containers/Dockerfile-centos9 b/tests/containers/Dockerfile-centos9
new file mode 100644
index 0000000..83fdc82
--- /dev/null
+++ b/tests/containers/Dockerfile-centos9
@@ -0,0 +1,3 @@
+RUN dnf install -y epel-release
+RUN dnf install -y dnf-plugins-core
+RUN dnf config-manager --set-enabled crb
diff --git a/tests/containers/Dockerfile-rpm-py3 b/tests/containers/Dockerfile-rpm-py3
index ac13c5b..5be6c45 100644
--- a/tests/containers/Dockerfile-rpm-py3
+++ b/tests/containers/Dockerfile-rpm-py3
@@ -3,6 +3,7 @@ RUN yum install -y python3-pylint python3-flake8 python3-openid python3-openid-t
         python3-sqlalchemy python3-ldap python3-pam python3-fedora \
         python3-ipalib python3-mod_wsgi python3-jinja2 python3-psycopg2 \
         python3-requests-kerberos python3-lesscpy python3-sssdconfig \
-	python3-jwcrypto python3-jwcrypto python3-six
-RUN yum erase -y python2
+	python3-jwcrypto python3-jwcrypto python3-six python3-pip
 RUN yum install -y make
+# This is unfortunatelly not packaged in CentOS Stream yet
+RUN pip-3 install filetype

