Version 10 (modified by ibaldin, 8 years ago)


Testing NEuca/EC2 handler


Testing NEuca standalone handler from tools/cmdline

From tools cmdline, after you prepare handlers for testing:

  • To test 'join':
    # ant test.handler -Dtarget=join -Demulation=false -Dhandler=handlers/ec2/handler.xml -Dec2.keys=/absolute/path/to/ec2/keys/directory -Dunit.vlan.tag=200 -Dconfig.ssh.key="string containing public key of the user, there is one in tools/cmdline/keys/ "
    • If ImageProxy is enabled, you should add the following parameters
      -Dconfig.image.url=http://url.of.the.image -Dconfig.image.guid=<image guid>
  • You should be able to login to the instance at the reported ip/port combination using tools/cmdline/keys/test-key:
    # ssh -i keys/test-key -p port root@ip
  • To test 'leave':
    # ant test.handler -Dtarget=leave -Demulation=false -Dhandler=handlers/ec2/handler.xml -Dec2.keys=/absolute/path/to/ec2/keys/directory -Dunit.ec2.instance=<instance id reported in the join step above>

Testing complete full lease cycle with broker/site/SM

You can use a test config file - tools/cmdline/tests/euca.xml to test the NEuca handler without deploying webapp. The steps are the following.

  • Make a new directory tools/cmdline/ec2 . Copy the contents of your ec2.keys dir (See section on Eucalyptus keys) into tools/cmdlime/ec2 .
  • Edit tools/cmdline/tests/euca.xml by uncommenting the line with 'ec2.keys' and providing the ABSOLUTE path to tools/cmdline/ec2. For example, that line might look like : <property name="ec2.keys" value="/home/orca/orca-trunk/trunk/tools/cmdline/ec2" /> .
  • Set "emulation=false" in tools/cmdline/config/
  • Edit ant/tests.xml . Go to the section that starts with '<target name="test.euca">' and change the following property "<property name="leaseLength" value="30" />" to "<property name="leaseLength" value="300" />".
  • In tools/config, run 'ant get.packages'.
  • Run 'ant test.euca' . This should fire up one instance on your euca-installation. If things go fine, you should be able to login to the instance at the ip specified in unit.manage.ip in the output using your key keys/test-key. Do
    ssh -i keys/test-key -p <unit.manage.port> root@<unit.manage.ip>.

NOTE: In Bella 2.2 handler scripts ( that invoke ec2 scripts) produce log file /tmp/ec2.handler.log on failure that can contain useful information). Obsoleted in Camano-3.x (error messages are shown in regular logs).