TestCases
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.
Register
Case ID: ec2-001
- Register an instance of the image to test
- Expected results: the image exists and it can be registered.
$ ec2-describe-instances
Root login
Case ID: ec2-002
- Try to ssh the new instance as root
ssh -i /path/to/ec2-keypair.pem root@<external-host-name>
- Expected results. The login is refused and you get the error message:
Please login as the ubuntu user rather than root user.
Ubuntu login
Case ID: ec2-003
- Try to ssh the new instance as the ubuntu user
ssh -i /path/to/ec2-keypair.pem ubuntu@<external-host-name>
- Expected results:
- The login is accepted and you log into the new instance
- 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)
Changing the default region
Case ID: ec2-004
- Get a list of the available zones:
ec2-describe-availability-zones
Register an instance of the image to test, changing the zone using the -z parameter.
- Expected results:
- The image exists and it is registered in the selected zone.
- 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.
Small rebundle
Case ID: ec2-005
- In your running instance, create a small text file in the $HOME folder called test.rebundle
Rebundle the image following the instructions at http://alestic.com/2009/06/ec2-ami-bundle
- Create an instance using the newly created image and ssh to it.
- Expected results:
- The instance can be created and the test.rebundle is available in the $HOME folder.
Big rebundle
Case ID: ec2-006
[TBC] What kind of applications should be installed in this kind of test?
User Data
Basic User Data
Case ID: ec2-007
- 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
- Pass a --user-data script to the new instance:
ec2-run-instances --user-data-file /tmp/user-data.sh ${ami_id}
- 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.
Bind9
Case ID: SWI-008
[TBC] Create a user data script that installs and runs bind9 (Not ready yet)
- Confirm that bind is running:
pgrep named
should return the pid of named.
- 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.
- 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
LAMP
Case ID: ec2-009
[TBC] Create a user data script that installs and runs a LAMP stack (Not ready yet)
Test Apache:
Execute
w3m http://127.0.0.1/
in a terminal and verify that it's not a 404 error page.
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;
Mail server
Case ID: ec2-010
[TBC] Create a user data script that installs and runs Postfix mail server (Not ready yet)
- Confirm that postfix is running:
telnet 127.0.0.1 25
should connect to postfix. Type "quit" to disconnect.
- 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).
- Send a test email:
echo foo | mail -s 'test' ${USER}
Start
mutt
- the test email should be in the inbox.
PostgreSQL Database Server
Case ID: ec2-012
[TBC] Create a user data script that installs and runs PostgreSQL Database Server (Not ready yet)
- Check that the database is running:
sudo -u postgres psql -l
should return a list of databases. - Create a database user:
sudo -u postgres createuser -DRS ${USER}
should create a user.
- Create a database:
sudo -u postgres createdb -O ${USER} ${USER}_db
should create a database.
- Connect to the database:
psql ${USER}_db
should start a psql shell connected to the database.
Print server
Case ID: ec2-013
[TBC] Create a user data script that installs and runs CUPS print server (Not ready yet)
Test cups:
sudo /etc/init.d/cups status
should state the cupsd is running.
- 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.
Samba server
Case ID: ec2-014
[TBC] Create a user data script that installs and runs Samba server (Not ready yet)
- 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.
- 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
Tomcat server
Case ID: ec2-015
[TBC] Create a user data script that installs and runs Tomcat (Not ready yet)
- Confirm that Tomcat is running:
sudo netstat -ltnp | grep jsvc
should show a jsvc instance listening on port 8080.
- Confirm that Tomcat is working properly:
w3m http://127.0.0.1:8080
should bring up a "It works !" pagew3m 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 <Enter> to follow links, <B> to come back to the previous page, <q> to quit
Testing/EC2/TestCases (last edited 2009-10-23 00:18:31 by modemcable249)