def test1_Instance(self): """Instance checks including reachability and ephemeral storage""" for instance in self.reservation.instances: self.assertTrue( self.tester.wait_for_reservation(self.reservation) ,'Instance did not go to running') self.assertNotEqual( instance.public_dns_name, instance.private_ip_address, 'Public and private IP are the same') self.assertTrue( self.tester.ping(instance.public_dns_name), 'Could not ping instance') instance_ssh = Eucaops( hostname=instance.public_dns_name, keypath= self.keypath) self.assertTrue( instance_ssh.found("ls -1 " + self.ephemeral, self.ephemeral), 'Did not find ephemeral storage at ' + self.ephemeral) self.assertTrue( self.tester.terminate_instances(self.reservation), 'Failure when terminating instance')
#! ../share/python_lib/vic-dev/bin/python from eucaops import Eucaops if __name__ == "__main__": tester = Eucaops(config_file="../input/2b_tested.lst", password="******") if not tester.found( ". eucarc && " + tester.eucapath + "/usr/sbin/euca-modify-property -p bootstrap.webservices.use_instance_dns=false", "was", ): tester.fail("Unable to reset use instance_dns") if not tester.found( ". eucarc && " + tester.eucapath + "/usr/sbin/euca-modify-property -r system.dns.dnsdomain", "was" ): tester.fail("Unable to reset dns subdomain") tester.do_exit()
for instance in reservation.instances: ## Update instance info instance.update() if instance.state != "running": tester.fail("Instance did not go to running state") options.runs -= 1 continue if instance.public_dns_name == instance.private_ip_address: tester.fail("Did not get a private IP") options.runs -= 1 continue ### Ping the instance if local.found("ping " + instance.public_dns_name + " -c 1", "0 received") == True: tester.fail("Instance was not pingable after going to running") options.runs -= 1 continue ###Create an ssh session to the instance using a eutester object instance_ssh = Eucaops( hostname=instance.public_dns_name, keypath=keypath) ### Ensure we know what device are on the instance before the attachment of a volume before_attach = instance_ssh.sys("ls -1 /dev/ | grep " + options.device_prefix) ### Check that the ephemeral is available to the VM if options.device_prefix + "a2\n" in before_attach: print "Found ephemeral device" else: instance.terminate()