From Fedora Project Wiki
= SysV initscript upgraded to systemd unit file =

== Setup ==
[Pass]
$ rsync -arv fedorapeople.org:public_html/systemd/ .
$ # Or:
$ wget -r -nd -l 1 http://toshio.fedorapeople.org/systemd/ .
$ rpm -q supervisor
package supervisor is not installed
$ sudo rpm -ivh supervisor-3.0-0.3.a8.fc15.noarch.rpm
$ ps ax|grep super
$ # No supervisord running
$ chkconfig --list supervisord
[...]
supervisord  0:off 1:off 2:off 3:off 4:off 5:off 6:off
$ sudo shutdown -r now
[...]
$ ps ax|grep super
$ # No supervisord running
$ chkconfig --list supervisord
supervisord  0:off 1:off 2:off 3:off 4:off 5:off 6:off

=== Variant -- no run sysv ===
[Pass] 
$ sudo rpm -Uvh supervisor-3.0-0.5.a8.fc14.noarch.rpm
$ ls -al /etc/rc.d/*/*super*
ls: cannot access /etc/rc.d/*/*super*: No such file or directory
$ # passed -- testing that there are no dangling systemV symlinks
$ ls -al /etc/systemd/system/*wants*/ |grep super
$ # No supervisord set to start
$ ps ax|grep super
$ # No supervisord running
$ sudo shutdown -r now
[...]
$ ps ax|grep supervisor
$ # No supervisord running
$ ls -al /etc/systemd/system/*wants*/ |grep super
$ # No supervisord set to start


=== Variant -- running sysv ===
[FAIL]
* supervisor wasn't registered with systemd -- probably caused by chkconfig problem
  : https://bugzilla.redhat.com/show_bug.cgi?id=616857
* Supervisor wasn't restarted -- unknown cause, possibly need a try-restart in the package scriptlets  need to resolve chkconfig failure first
* Other failures related to the service not being registered with systemd -- need to solve chkconfig bug first

$ chkconfig --levels 345 supervisord on
$ ps ax| grep super
$ # No supervisor running
$ chkconfig --list supervisord
[...]
supervisord     0:off   1:off   2:off   3:on    4:on    5:on    6:off
$ sudo shutdown -r now
$ ps ax|grep supervisor
  997 ?        Ss     0:00 /usr/bin/python /usr/bin/supervisord
$ # Supervisord is running
$ sudo rpm -Uvh supervisor-3.0-0.5.a8.fc15.noarch.rpm
$ ps ax|grep supervisor
  997 ?        Ss     0:00 /usr/bin/python /usr/bin/supervisord
$ # Looks like failure.. supervisor didn't restart
$ sudo supervisorctl version
3.0a8
$ # Confirm failure, the service is the old version
$ ls -al /etc/systemd/system/*wants*|grep super
$ # Also failure we should have seen the supervisor service symlinked here
$ sudo shutdown -r now
$ ps ax|grep supervisor
$ # Failure no supervisor running
$ sudo supervisorctl version
unix:///var/tmp/supervisor.sock no such file
$ # Confirm failure, the service isn't running; expected the new version
$ ls -al /etc/systemd/system/*wants*|grep super
$ # Also failure we should have seen the supervisor service symlinked here
$ sudo systemctl status supervisord.service
supervisord.service - Start jobs, make sure they're running, and automatically restart them.
          Loaded: loaded (/lib/systemd/system/supervisord.service)
          Active: inactive (dead)
          CGroup: name=systemd:/system/supervisord.service
$ # unit file installed in correct place but not linked to the proper targets


= Package w/ systemd unit file upgraded to systemd unit file =

== Setup ==
[Pass]
$ rpm -q supervisor
package supervisor is not installed
$ sudo rpm -Uvh supervisor-3.0-0.4.a8.fc15.noarch.rpm
$ ps ax|grep super
$ # No supervisord running
$ ls -al /etc/systemd/system/*wants/*super*
ls: cannot access /etc/systemd/system/*wants/*super*: No such file or directory
$ # pass: systemd is not set to start the service
$ sudo shutdown -r now
[...]
$ ps ax|grep super
$ # No supervisord running
$ ls -al /etc/systemd/system/*wants/*super*
ls: cannot access /etc/systemd/system/*wants/*super*: No such file or directory


== Variant -- no run systemd ==
[PASS]
$ sudo rpm -Uvh supervisor-3.0-0.5.a8.fc15.noarch.rpm
$ ps ax|grep supervisor
$ # No supervisor running
$ ls -al /etc/systemd/system/*wants/*super*
ls: cannot access /etc/systemd/system/*wants/*super*: No such file or directory
$ sudo shutdown -r now
[...] 
$ ps ax|grep supervisor
$ # No supervisor running
$ ls -al /etc/systemd/system/*wants/*super*
ls: cannot access /etc/systemd/system/*wants/*super*: No such file or directory

== Variant -- running systemd ==
[PASS]
$ systemctl enable supervisord.service
$ sudo systemctl enable supervisord.service
ln -s '/lib/systemd/system/supervisord.service' '/etc/systemd/system/multi-user.target.wants/supervisord.service'
$ ps ax|grep super
$ # Pass no supervisor running
$ ls -al /etc/systemd/system/*wants/*super*
lrwxrwxrwx. 1 root root 39 Feb 23 21:44 /etc/systemd/system/multi-user.target.wants/supervisord.service -> /lib/systemd/system/supervisord.service
$ # Pass setup the symlink in etc to the service file
$ sudo shutdown -r now
$ ps ax|grep superviso
  629 ?        Ss     0:00 /usr/bin/python /usr/bin/supervisord -n -c /etc/supervisord.conf
$ # Pass -- supervisor running
$ sudo rpm -Uvh supervisor-3.0-0.5.a8.fc15.noarch.rpm
$ ps ax|grep supervisor
 1123 ?        Ss     0:00 /usr/bin/python /usr/bin/supervisord -n -c /etc/supervisord.conf
$ # Looking good, new supervisord pid
$ sudo supervisorctl version
3.0b1
$ # Verified -- new version is running
$ sudo shutdown -r now
[...]
$ ps ax|grep supervisor
  648 ?        Ss     0:00 /usr/bin/python /usr/bin/supervisord -n -c /etc/supervisord.conf
$ # Pass supervisor came up at reboot
$ systemctl status supervisord.service
supervisord.service - Start jobs, make sure they're running, and automatically restart them.
          Loaded: loaded (/lib/systemd/system/supervisord.service)
          Active: active (running) since Wed, 23 Feb 2011 21:51:17 -0800; 1min 35s ago
        Main PID: 648 (supervisord)
          CGroup: name=systemd:/system/supervisord.service
                  └ 648 /usr/bin/python /usr/bin/supervisord -n -c /etc/supervisord.conf


= Test autostart services work SysV => systemd =
[DID NOT TEST]: Note: expect these to have some failures until chkconfig bug fixed
*** Perform tests in: SysV initscript upgraded to systemd unit file
*** But with the autostart %post
*** And expecting some different values.
*** If the service is not running, should not be running after
*** If the service is running, should only be running in those runlevels after


= Test autostart services work systemd => systemd =
[DID NOT TEST]: Note: Hope that these will all pass -- only depends on how good the %post is
*** Perform tests in: Package w/ systemd unit file upgraded to systemd unit file
*** But with autostart %post
*** And expecting some different values
*** If systemd service is installed from scratch, the service is autostarted according to what's in the unit file
*** If service is not running, should not be running after
*** If service is running, should only be running in those runlevels afterwards


= Test -- systemd reinstall =
== No autostart ==
[PASS]
$ sudo rpm -Uvh supervisor-3.0-0.5.a8.fc15.noarch.rpm
$ systemctl enable supervisord.service
$ sudo shutdown -r now
[...]
$ ps ax |grep super
$ # Verified that supervisord is running
$ sudo rpm -e supervisor
$ ps ax|grep super
$ # Pass: verified that supervisor is not running
$ ls -al /etc/systemd/systemd/*wants*/*super*
$ # Pass: verified that it's not set to run
$ sudo rpm -Uvh supervisor-3.0-0.5.a8.fc15.noarch.rpm
$ ps ax|grep super
$ # Pass: verified that supervisor is not running
$ ls -al /etc/systemd/systemd/*wants*/*super*
ls: cannot access /etc/systemd/systemd/*wants*/*super*: No such file or directory
$ # Pass: verified that it's not set to run
$ sudo shutdown -r now
[...]
$ ps ax|grep super
$ # Pass: verified that supervisor is not running

== autostart ==
*** Something like the above case but check that only the targets configured by the package are autostarted

== May have to test variants of the above that have activated services (hw activated? dependency activated?  Socket activated?  Need lennart to clarify what activation methods exist) ==
*** something like the above cases where services are activated rather than explicit.