I’m working through the issues getting the unit tests to run cleanly. Here’s my setup:
My Laptop run F13. I have a git repo at ~/devel/freeipa
After doing a git checkout, plus possibly a git clean -fd, I run
make rpms
The rpms I then deploy to a virtual machine I have running in kvm on my laptop. The VM has the hostname of ipa which is resolvable from the vm via dnscache. This means that the value of the DHCP address assigned to the vm is assigned to the hostname inside /etc/hosts:
192.168.100.12Â ipa.ayoung.boston.devel.redhat.com ipa
Here’s my deployment script:
export IPASERVER=ipa export IPAROOT=/home/ayoung/devel/freeipa export IPAPASSWORD= export IPA_RPMS="ipa-client ipa-server-selinux ipa-python ipa-server ipa-debuginfo ipa-admintools" ipa-pushd(){ pushd $IPAROOT } ipa-uninstall(){ ssh root@$IPASERVER "ipa-server-install -U --uninstall -p $IPAPASSWORD" } ipa-build-deploy(){ ipa-pushd git clean -fd make rpms ipa-uninstall ssh root@$IPASERVER "rpm -e $IPA_RPMS" IPATEMP=`ssh root@$IPASERVER mktemp -d` scp dist/rpms/*rpm root@$IPASERVER:$IPATEMP echo rpms uploaded to $IPATEMP ssh root@$IPASERVER "cd $IPATEMP ; ls | xargs yum localinstall --nogpgcheck -y " ssh root@$IPASERVER "ipa-server-install -U -r AYOUNG.BOSTON.DEVEL.REDHAT.COM -p $IPAPASSWORD -a $IPAPASSWORD -u admin" &&\ zenity --info --text "rpm build and deploy completed. Better check for errors." popd }
I have all this, plus a few more functions, in a file that I source in at the start of each bash session.
Lets take it by the numbers:
Lines 1-4 are variables used elsewhere in the script, for the directory that holds my source and for the server host name. I’ve elected not to show the value of my other variable, $IPAPASSWORD, although I use a throwaway password for this that is only for development machines.
The pushd based function on line 5 merely gets me statement completion, but I use it constantly. If it is stupid but it works…
The uninstall line is often useful on its own. Like most standalone functions, this one started off inline. I extracted it into its own function once I decided I wanted to be able to call it on its own.
line 13: WARNING! git clean -fd will delete any files that git does not know about. I make it a point to, at a minimum, run git add for any files I have added to the the repo. Yes, I’ve burnt myself on this one a few times.
Line 16: Although I am a fan of running rpm -U, our rpm naming scheme is based off the hash from git, and is not monotonically increasing. This instead uninstalls the old set of rpms, and then lines 17 creates a temp directory used in line 18 for uploading the newly built rpms. Note that line 17 captures the name of the directory created, a useful technique for maintaining some semblance of state over multiple ssh calls.
Line 20: Use Yum to install the rpms. While it might be tempting to do an rpm -U, using yum this way allows me to install the dependencies from the appropriate repositories. Aside from the 389 Directory server, I get python-nss from a team specific repository as well. Yum ensures I have the lates builds of both.
Line 21: Run the ipa-server-install script in untended mode, providing the required passwords on the command line. Good for testing, probably not how you would want to do it for a live install.
Line 22: Use zenity to report that all has been completed. This gives a modal popup window that also causes the bash shells icon in my toolbar to change color, snapping me out of my torpor, ready for action.
I test that the server is up and running with:
ssh root@ipa
kinit admin
ipa user_find
In order to run the tests on the vm, I have exported my devel directory in /etc/exports:
/home/ayoung/devel         *(no_root_squash,rw,insecure,sync)
I’m not a fan of making it read/write, but for the tests, I (suspect I) need to be able to write into that directory. The no_root_squash is also required as I run the tests as root on the vm.
On the vm, I mount the devel directory via an entry in /etc/fstab:
192.168.100.1:/home/ayoung/devel /home/ayoung/devel nfs rsize=8192,wsize=8192,timeo=14,intr
The last setup issue prior to running the tests is to run
export IPASERVER=ipa ipa_pushed make make -C install/po test_lang\ popd
The second make command is only necessary to get the language file populated for the translation test, but is included for completeness.
To run the tests, I have two consoles windows open on the vm. In both, I start with
pushd /home/ayoung/devel/freeipa
In one I run the lite-server with debugging:
./lite-server.py -d
and in the other I run the tests:
./make-test > /tmp/test.log 2>&1
At this point, I still have errors. I’ll update this post once I get the tests running at 100%.
Update:Â Rob Critten just updated the testing page. Once I made those changes:
Ran 673 tests in 310.559s
FAILED (SKIP=12, errors=1, failures=6)
Getting closer