-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·57 lines (45 loc) · 1.39 KB
/
test.sh
File metadata and controls
executable file
·57 lines (45 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
set -eux
IMAGE_NAME="centos7-test-image"
# Build the docker image
docker build -t "${IMAGE_NAME}" .
# Run tests inside the container
docker run --rm -i "${IMAGE_NAME}" /bin/bash -s <<'EOF'
set -eux
# 1. Check if repo files exist
echo "--> Checking for repository files..."
test -f /etc/yum.repos.d/CentOS-SCLo-rh.repo
test -f /etc/yum.repos.d/CentOS-SCLo-scl.repo
test -f /etc/yum.repos.d/CentOS-Vault.repo
test -f /etc/yum.repos.d/EPEL-Vault.repo
echo "--> Repository files are present."
# 2. Check yum repolist
echo "--> Checking yum repolist..."
yum repolist
yum repolist | grep -q "Vault-base"
yum repolist | grep -q "centos-sclo-rh"
yum repolist | grep -q "centos-sclo-scl"
yum repolist | grep -q "epel"
echo "--> Repositories are enabled."
# 3. Test installing packages from repositories
echo "--> Testing package installation from repositories..."
# Install 'which' command to test for executables
yum install -y which
# Test EPEL
echo "--> Testing EPEL repository..."
yum install -y htop
which htop
yum remove -y htop
# Test SCLo rh
echo "--> Testing SCLo rh repository..."
yum install -y rh-python38
scl enable rh-python38 'python --version'
yum remove -y rh-python38
# Test SCLo scl
echo "--> Testing SCLo scl repository..."
yum install -y python27
scl enable python27 'python --version'
yum remove -y python27
echo "--> Package installation tests passed."
echo "All tests passed!"
EOF