Sha256: e786315674d973beff2a1f2010e207e034c4336a253a0361d9e27fe5c77c695b

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

require 'pp'

Shindo.tests('Fog::Compute[oraclecloud] | instance requests', 'instances') do
	
	tests("#instance-create", "create") do
		sshkey = Fog::Compute[:oraclecloud].ssh_keys.first.name
		new_instance = Fog::Compute[:oraclecloud].instances.create(
			:name=>'Test123', 
			:shape=>'oc3', 
			:imagelist=>'/oracle/public/oel_6.4_2GB_v1',
			:label=>'dev-vm',
			:sshkeys=>[sshkey]
		)
		test "can create an instance" do
			new_instance.is_a? Fog::Compute::Oracle::Instance
		end
		test "is being built" do
			new_instance.state != "running"
		end
		new_instance.wait_for { ready? }

		test "is built" do
			new_instance.state == 'running'
		end

		new_instance.destroy()
		test "can delete instance" do
			check = Fog::Compute[:oraclecloud].instances.get(new_instance.name)
			check.state == 'stopping'
		end
	end

	tests('#instances-read') do
		instances = Fog::Compute[:oraclecloud].instances
		test "returns an Array" do
			instances.is_a? Array
		end
		instances.each do |ins|
			puts "#{ins.name} - #{ins.state}"
		end
		test "should return records" do
			instances.size >= 1
		end

		test "should return a valid name" do
			instances.first.name.is_a? String
		end

		instance = Fog::Compute[:oraclecloud].instances.get(instances.first.name)
		test "should return an instance" do
			instance.name.is_a? String
		end
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-oraclecloud-0.1.1 tests/requests/instance_tests.rb