add distgit-centos7 machine config, add possibility to test against it, add more (direct) tests

This commit is contained in:
clime 2018-02-19 11:48:00 +01:00
parent dd8715d3a4
commit 84b5223c41
3 changed files with 118 additions and 27 deletions

117
Vagrantfile vendored
View file

@ -3,7 +3,7 @@
Vagrant.configure(2) do |config|
### distgit ###################################################
### distgit Fedora ###################################################
config.vm.define "distgit" do |distgit|
distgit.vm.box = "fedora/27-cloud-base"
@ -12,7 +12,16 @@ Vagrant.configure(2) do |config|
distgit.vm.provision "shell",
inline: "echo 'nameserver 8.8.8.8' >> /etc/resolv.conf"
# Update the system
# Copy config files
distgit.vm.provision "shell",
inline: "rm -rf /tmp/pkgs-files",
run: "always"
distgit.vm.provision "file",
source: "./beaker-tests/pkgs-files", destination: "/tmp/",
run: "always"
# update the system & install the packages
distgit.vm.provision "shell",
inline: "dnf clean all && dnf -y update || true" # || true cause dnf might return non-zero status (probly delta rpm rebuilt failed)
@ -35,6 +44,19 @@ Vagrant.configure(2) do |config|
inline: "dnf install -y /tmp/tito/noarch/*.rpm",
run: "always"
distgit.vm.provision "shell",
inline: "dnf install -y python-grokmirror",
run: "always"
# setup config files
distgit.vm.provision "shell",
inline: "mv /tmp/pkgs-files/ssl.conf /etc/httpd/conf.d/ssl.conf && restorecon -R /etc/httpd/conf.d/ssl.conf",
run: "always"
distgit.vm.provision "shell",
inline: "mv /tmp/pkgs-files/lookaside-upload.conf /etc/httpd/conf.d/dist-git/ && restorecon -R /etc/httpd/conf.d/dist-git/",
run: "always"
# setup test user
distgit.vm.provision "shell",
inline: "useradd clime -G packager"
@ -42,22 +64,7 @@ Vagrant.configure(2) do |config|
distgit.vm.provision "shell",
inline: "echo 'clime ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers"
distgit.vm.provision "shell",
inline: "rm -rf /tmp/pkgs-files",
run: "always"
distgit.vm.provision "file",
source: "./beaker-tests/pkgs-files", destination: "/tmp/pkgs-files",
run: "always"
distgit.vm.provision "shell",
inline: "mv /tmp/pkgs-files/lookaside-upload.conf /etc/httpd/conf.d/dist-git/ && restorecon -R /etc/httpd/conf.d/dist-git/",
run: "always"
distgit.vm.provision "shell",
inline: "mv /tmp/pkgs-files/ssl.conf /etc/httpd/conf.d/ssl.conf && restorecon -R /etc/httpd/conf.d/ssl.conf",
run: "always"
# start services
distgit.vm.provision "shell",
inline: "systemctl enable dist-git.socket && systemctl restart dist-git.socket",
run: "always"
@ -66,9 +73,81 @@ Vagrant.configure(2) do |config|
inline: "systemctl enable httpd && systemctl restart httpd",
run: "always"
end
### distgit CentOS ###################################################
config.vm.define "distgit-centos" do |distgit|
distgit.vm.box = "centos/7"
distgit.vm.synced_folder ".", "/vagrant", type: "rsync"
distgit.vm.provision "shell",
inline: "dnf install -y python-grokmirror",
inline: "echo 'nameserver 8.8.8.8' >> /etc/resolv.conf"
# Copy config files
distgit.vm.provision "shell",
inline: "rm -rf /tmp/pkgs-files",
run: "always"
distgit.vm.provision "file",
source: "./beaker-tests/pkgs-files", destination: "/tmp/",
run: "always"
# enable epel7 repo
distgit.vm.provision "shell",
inline: "yum install -y epel-release",
run: "always"
# update the system & install the packages
distgit.vm.provision "shell",
inline: "yum clean all && yum -y update || true"
distgit.vm.provision "shell",
inline: "yum install -y tito wget net-tools"
distgit.vm.provision "shell",
inline: "yum-builddep -y /vagrant/dist-git.spec",
run: "always"
distgit.vm.provision "shell",
inline: "rm -rf /tmp/tito/noarch",
run: "always"
distgit.vm.provision "shell",
inline: "cd /vagrant/ && tito build --test --rpm",
run: "always"
distgit.vm.provision "shell",
inline: "yum install -y /tmp/tito/noarch/*.rpm || true",
run: "always"
distgit.vm.provision "shell",
inline: "yum install -y python-grokmirror",
run: "always"
# setup config files
distgit.vm.provision "shell",
inline: "mv /tmp/pkgs-files/ssl.conf /etc/httpd/conf.d/ssl.conf && restorecon -R /etc/httpd/conf.d/ssl.conf",
run: "always"
distgit.vm.provision "shell",
inline: "mv /tmp/pkgs-files/lookaside-upload.conf /etc/httpd/conf.d/dist-git/ && restorecon -R /etc/httpd/conf.d/dist-git/",
run: "always"
# setup test user
distgit.vm.provision "shell",
inline: "useradd clime -G packager"
distgit.vm.provision "shell",
inline: "echo 'clime ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers"
# start services
distgit.vm.provision "shell",
inline: "systemctl enable dist-git.socket && systemctl restart dist-git.socket",
run: "always"
distgit.vm.provision "shell",
inline: "systemctl enable httpd && systemctl restart httpd",
run: "always"
end
end

View file

@ -33,16 +33,20 @@ systemctl start virtlogd.socket # this is currently needed in f25 for vagrant to
cd $DISTGITROOTDIR
if [ -z $DISTGIT_FLAVOR ]; then
DISTGIT_FLAVOR=distgit
fi
DISTGITSTATUS=`mktemp`
vagrant status distgit | tee $DISTGITSTATUS
if grep -q 'not created' $DISTGITSTATUS; then
vagrant up distgit
vagrant up $DISTGIT_FLAVOR
else
vagrant reload distgit
vagrant reload $DISTGIT_FLAVOR
fi
rm $DISTGITSTATUS
IPADDR=`vagrant ssh -c "ifconfig eth0 | grep -E 'inet\s' | sed 's/\s*inet\s*\([0-9.]*\).*/\1/'"`
IPADDR=`vagrant ssh -c "ifconfig eth0 | grep -E 'inet\s' | sed 's/\s*inet\s*\([0-9.]*\).*/\1/'" $DISTGIT_FLAVOR`
echo "$IPADDR pkgs.example.org" >> /etc/hosts
if ! [ -f ~/.ssh/id_rsa ]; then
@ -51,7 +55,7 @@ if ! [ -f ~/.ssh/id_rsa ]; then
fi
PUBKEY=`cat ~/.ssh/id_rsa.pub`
vagrant ssh -c "echo $PUBKEY > /tmp/id_rsa.pub.remote"
vagrant ssh -c "echo $PUBKEY > /tmp/id_rsa.pub.remote" $DISTGIT_FLAVOR
vagrant ssh -c '
sudo mkdir -p /home/clime/.ssh
@ -59,13 +63,13 @@ sudo cp /tmp/id_rsa.pub.remote /home/clime/.ssh/authorized_keys
sudo chown -R clime:clime /home/clime/.ssh
sudo chmod 700 /home/clime/.ssh
sudo chmod 600 /home/clime/.ssh/authorized_keys
' distgit
' $DISTGIT_FLAVOR
vagrant ssh -c '
sudo mkdir -p /root/.ssh
sudo cp /tmp/id_rsa.pub.remote /root/.ssh/authorized_keys
sudo chmod 700 /root/.ssh
sudo chmod 600 /root/.ssh/authorized_keys
' distgit
' $DISTGIT_FLAVOR
cd $SCRIPTPATH

View file

@ -35,11 +35,15 @@ rlJournalStart
resp=`curl --silent -X POST http://pkgs.example.org/repo/pkgs/upload.cgi -F name=prunerepo -F sha512sum=a5f31ae7586dae8dc1ca9a91df208893a0c3ab0032ab153c12eb4255f7219e4baec4c7581f353295c52522fee155c64f1649319044fd1bbb40451f123496b6b3 -F filename=prunerepo-1.1-1.fc23.src.rpm`
rlRun "grep -q 'Available' <<< '$resp'"
# test that md5 is forbidden by default
# test an error is raised on a non-existing module
resp=`curl --silent -X POST http://pkgs.example.org/repo/pkgs/upload.cgi -F name=foo -F md5sum=80e541f050d558424d62743195481595 -F file=@"$SCRIPTDIR/../../data/prunerepo-1.1-1.fc23.src.rpm"`
rlRun "grep -q 'Module \"rpms/foo\" does not exist!' <<< '$resp'"
# test that md5 is forbidden by default
resp=`curl --silent -X POST http://pkgs.example.org/repo/pkgs/upload.cgi -F name=prunerepo -F md5sum=80e541f050d558424d62743195481595 -F file=@"$SCRIPTDIR/../../data/prunerepo-1.1-1.fc23.src.rpm"`
rlRun "grep -q 'Uploads with md5 are no longer allowed.' <<< '$resp'"
# try operate without default namespacing
### try operating without default namespacing
scp -o 'StrictHostKeyChecking no' $SCRIPTDIR/dist-git-no-namespace.conf root@pkgs.example.org:/etc/dist-git/dist-git.conf
pkgs_cmd '/usr/share/dist-git/setup_git_package prunerepo'
@ -51,6 +55,10 @@ rlJournalStart
# test of presence of the uploaded file
rlRun 'wget http://pkgs.example.org/repo/pkgs/prunerepo/prunerepo-1.1-1.fc23.src.rpm/sha512/a5f31ae7586dae8dc1ca9a91df208893a0c3ab0032ab153c12eb4255f7219e4baec4c7581f353295c52522fee155c64f1649319044fd1bbb40451f123496b6b3/prunerepo-1.1-1.fc23.src.rpm'
# test an error is raised on a non-existing module
resp=`curl --silent -X POST http://pkgs.example.org/repo/pkgs/upload.cgi -F name=foo -F md5sum=80e541f050d558424d62743195481595 -F file=@"$SCRIPTDIR/../../data/prunerepo-1.1-1.fc23.src.rpm"`
rlRun "grep -q 'Module \"foo\" does not exist!' <<< '$resp'"
cd $CWD
rlPhaseEnd