<> == Smoke Tests == Smoke should be run before any other, to check for the sanity of the image. == User Data Scripts == Please run the test even if there's no user data script present. So if the test says test LAMP, install the LAMP task from tasksel, etc. We're looking for obvious bugs so ignore the script thing and just get that service up and running. ##ec2-001 === Register === '''Case ID: ''' ec2-001 1. Register an instance of the image to test 1. Expected results: the image exists and it can be registered. {{{ $ ec2-describe-instances }}} ##ec2-002 === Root login === ''' Case ID: ''' ec2-002 1. Try to ssh the new instance as root {{{ ssh -i /path/to/ec2-keypair.pem root@ }}} 1.#2 Expected results. The login is refused and you get the error message: {{{ Please login as the ubuntu user rather than root user. }}} ##ec2-003 === Ubuntu login === ''' Case ID: ''' ec2-003 1. Try to ssh the new instance as the ubuntu user {{{ ssh -i /path/to/ec2-keypair.pem ubuntu@ }}} 1.#2 Expected results: 1. The login is accepted and you log into the new instance 1. Password less sudo access is available for the ubuntu user: {{{ $ sudo -l User ubuntu may run the following commands on this host: (ALL) NOPASSWD:ALL }}} == Availability Regions == EC2 instances run in different data centres in two regions: * us-east-1 - East coast of the United States (probably near Washington, DC) * eu-west-1 - Western Europe (probably near Dublin, Ireland) ##ec2-004 === Changing the default region === '''Case ID: ''' ec2-004 1. Get a list of the available zones: {{{ ec2-describe-availability-zones }}} 1.#2 Register an instance of the image to test, changing the zone using the {{{-z}}} parameter. 1. Expected results: 1. The image exists and it is registered in the selected zone. 1. APT is setup to use the EC2 archive mirrors corresponding to the instance availability zone (eg. us zones use the us mirror) in /etc/apt/sources.list == Rebundle == EC2 allows to rebundle a running EC2 instance into a new AMI, and use this new AMI to create new instances based on it. ##ec2-005 === Small rebundle === '''Case ID: ''' ec2-005 1. In your running instance, create a small text file in the $HOME folder called test.rebundle 1. Rebundle the image following the instructions at [[http://alestic.com/2009/06/ec2-ami-bundle]] 1. Create an instance using the newly created image and ssh to it. 1. Expected results: 1. The instance can be created and the test.rebundle is available in the $HOME folder. ##ec2-006 === Big rebundle === '''Case ID: ''' ec2-006 [TBC] What kind of applications should be installed in this kind of test? == User Data == ##ec2-007 === Basic User Data === '''Case ID: ''' ec2-007 1. Create a file 'user-data.sh' with the following contents: {{{ printf "%s\n%s\n" '#!/bin/sh' \ "echo ========= HELLO ========= | tee /tmp/user-data.out" > /tmp/user-data.sh }}} 1.#2 Pass a --user-data script to the new instance: {{{ ec2-run-instances --user-data-file /tmp/user-data.sh ${ami_id} }}} 1.#3 Expected results: Make sure it was run on the first boot. Reboot and make sure it was not run on the second boot. With the user-data script below, the file /tmp/user-data.out should be created on first boot. It should not be recreated on the second boot. ##ec2-008 === Bind9 === '''Case ID: ''' SWI-008 [TBC] Create a user data script that installs and runs bind9 (Not ready yet) 1. Confirm that bind is running: * {{{ pgrep named}}} should return the pid of named. 1. Confirm that bind is listening for IPv4 and IPv6: * {{{ sudo netstat -atuvpn | egrep '(127.0.0.1|::):53 .*' | egrep -v ESTABLISHED}}} should list named is listening on port 53 for tcp, tcp6, udp and udp6. 1. If the system can access the outside world, dns queries against the server at localhost should work * {{{ host www.ubuntu.com localhost}}} * {{{ host -T www.ubuntu.com localhost}}} * {{{ host -6 www.ubuntu.com ip6-localhost}}} * {{{ host -T -6 www.ubuntu.com ip6-localhost}}} ##ec2-009 === LAMP === '''Case ID: ''' ec2-009 [TBC] Create a user data script that installs and runs a LAMP stack (Not ready yet) 1. '''Test Apache:''' * Execute {{{ w3m http://127.0.0.1/}}} in a terminal and verify that it's not a 404 error page. 1. '''Test MySQL''' * Execute {{{ mysql -u root -p}}} in a terminal. You should then be presented with a mysql prompt {{{mysql> }}} where you can enter mysql commands. Some commands you can use to verify the installation are {{{show databases;}}}, {{{connect mysql;}}}, {{{show tables;}}}, and {{{select * from user;}}}: {{{ show databases; connect mysql; show tables; select * from user; }}} ##ec2-010 === Mail server === '''Case ID: ''' ec2-010 [TBC] Create a user data script that installs and runs Postfix mail server (Not ready yet) 1. Confirm that postfix is running: * {{{ telnet 127.0.0.1 25}}} should connect to postfix. Type "quit" to disconnect. 1. Confirm that dovecot pop3 and imap servers are running: * {{{ sudo netstat -ltnp | grep dovecot}}} should list 4 dovecot instances (port 110, 143, 993 and 995). 1. Send a test email: * {{{ echo foo | mail -s 'test' ${USER} }}} * Start {{{ mutt}}} - the test email should be in the inbox. ##ec2-012 === PostgreSQL Database Server === '''Case ID: ''' ec2-012 [TBC] Create a user data script that installs and runs PostgreSQL Database Server (Not ready yet) 1. Check that the database is running: {{{ sudo -u postgres psql -l}}} should return a list of databases. 1. Create a database user: {{{ sudo -u postgres createuser -DRS ${USER} }}} should create a user. 1. Create a database: {{{ sudo -u postgres createdb -O ${USER} ${USER}_db}}} should create a database. 1. Connect to the database: {{{ psql ${USER}_db}}} should start a psql shell connected to the database. ##ec2-013 === Print server === '''Case ID: ''' ec2-013 [TBC] Create a user data script that installs and runs CUPS print server (Not ready yet) 1. '''Test cups:''' * {{{ sudo /etc/init.d/cups status}}} should state the cupsd is running. 2. Verify that CUPS has started the management web interface: * Execute {{{ w3m http://127.0.0.1:631/ }}} and make sure it shows the CUPS pages. ##ec2-014 === Samba server === '''Case ID: ''' ec2-014 [TBC] Create a user data script that installs and runs Samba server (Not ready yet) 1. Confirm that samba is running: * {{{pgrep smbd}}}, {{{pgrep nmbd}}}, {{{pgrep winbindd}}} should return the pid of the different processes: {{{ pgrep smbd; pgrep nmbd; pgrep winbindd }}} * You should see at least 5 processes. 2. Verify that the basic shares are published: * Run {{{smbtree}}}. When asked for the password for the '''ubuntu''' user, press the ''Enter'' key. The output should be similar to the following: {{{ WORKGROUP \\DOMU-11-22-33-44 domU-11-22-33-44-55-66 server (Samba, Ubuntu) \\DOMU-11-22-33-44\IPC$ IPC Service (domU-11-22-33-44-55-66 server (Samba, Ubuntu)) \\DOMU-11-22-33-44\print$ Printer Drivers }}} ##ec2-015 === Tomcat server === '''Case ID: ''' ec2-015 [TBC] Create a user data script that installs and runs Tomcat (Not ready yet) 1. Confirm that Tomcat is running: * {{{ sudo netstat -ltnp | grep jsvc}}} should show a jsvc instance listening on port 8080. 1. Confirm that Tomcat is working properly: * {{{ w3m http://127.0.0.1:8080}}} should bring up a "It works !" page * {{{ w3m http://localhost:8080/examples/servlets/servlet/HelloWorldExample}}} should bring up a "Hello World!" page. * {{{ w3m http://localhost:8080/examples/jsp/jsp2/el/basic-arithmetic.jsp}}} should bring a page containing basic arithmetics. NB: w3m basics: moving cursor and hit to follow links, to come back to the previous page, to quit ##endcases