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.


Case ID: ec2-001

  1. Register an instance of the image to test
  2. Expected results: the image exists and it can be registered.

$ ec2-describe-instances

Root login

Case ID: ec2-002

  1. Try to ssh the new instance as root

ssh -i /path/to/ec2-keypair.pem root@<external-host-name>
  1. 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

  1. Try to ssh the new instance as the ubuntu user

ssh -i /path/to/ec2-keypair.pem ubuntu@<external-host-name>
  1. Expected results:
    1. The login is accepted and you log into the new instance
    2. Password less sudo access is available for the ubuntu user:

$ sudo -l
User ubuntu may run the following commands on this host:

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

  1. Get a list of the available zones:

  1. Register an instance of the image to test, changing the zone using the -z parameter.

  2. Expected results:
    1. The image exists and it is registered in the selected zone.
    2. 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


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

  1. In your running instance, create a small text file in the $HOME folder called test.rebundle
  2. Rebundle the image following the instructions at http://alestic.com/2009/06/ec2-ami-bundle

  3. Create an instance using the newly created image and ssh to it.
  4. Expected results:
    1. 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

  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. Pass a --user-data script to the new instance:

ec2-run-instances --user-data-file /tmp/user-data.sh ${ami_id}
  1. 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.


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.
  2. Confirm that bind is listening for IPv4 and IPv6:
    • sudo netstat -atuvpn | egrep '(|::):53 .*' | egrep -v ESTABLISHED
      should list named is listening on port 53 for tcp, tcp6, udp and udp6.
  3. 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


Case ID: ec2-009

[TBC] Create a user data script that installs and runs a LAMP stack (Not ready yet)

  1. Test Apache:

    • Execute

      in a terminal and verify that it's not a 404 error page.
  2. 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)

  1. Confirm that postfix is running:
    • telnet 25
      should connect to postfix. Type "quit" to disconnect.
  2. 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).
  3. Send a test email:
    • echo foo | mail -s 'test' ${USER} 
    • Start

      - 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)

  1. Check that the database is running:
    sudo -u postgres psql -l
    should return a list of databases.
  2. Create a database user:
    • sudo -u postgres createuser -DRS ${USER} 
      should create a user.
  3. Create a database:
    • sudo -u postgres createdb -O ${USER} ${USER}_db
      should create a database.
  4. Connect to the database:
    • psql ${USER}_db
      should start a psql shell connected to the database.

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  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)

  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:

              \\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)

  1. Confirm that Tomcat is running:
    • sudo netstat -ltnp | grep jsvc
      should show a jsvc instance listening on port 8080.
  2. Confirm that Tomcat is working properly:
    • w3m
      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 <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 mathieu-tl)