-
Notifications
You must be signed in to change notification settings - Fork 11
/
76_machine_instance_tryouts.rb
76 lines (64 loc) · 1.83 KB
/
76_machine_instance_tryouts.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
library :rudy, 'lib'
group "Metadata"
tryout "Rudy::Machine Instance API" do
set :test_domain, Rudy::DEFAULT_DOMAIN #'test_' << Rudy::Utils.strand(4)
set :test_env, 'stage' #'env_' << Rudy::Utils.strand(4)
setup do
#Rudy.enable_debug
Rudy::Huxtable.global.offline = true
Rudy::Huxtable.update_config # Read config files
global = Rudy::Huxtable.global
global.environment = test_env
akey, skey, region = global.accesskey, global.secretkey, global.region
Rudy::Metadata.connect akey, skey, region
Rudy::AWS::EC2.connect akey, skey, region
Rudy::Routines::Handlers::Keypair.create
Rudy::Routines::Handlers::Group.create
end
clean do
Rudy::Routines::Handlers::Keypair.unregister
Rudy::Routines::Handlers::Keypair.delete_pkey
Rudy::Routines::Handlers::Group.destroy
if Rudy.debug?
puts $/, "Rudy Debugging:"
Rudy::Huxtable.logger.rewind
puts Rudy::Huxtable.logger.read unless Rudy::Huxtable.logger.closed_read?
end
end
dream :instid, nil
drill "machine instid is nil by default" do
Rudy::Machine.new '02'
end
dream :nil?, false
dream :class, String
drill "create machine with instance" do
mach = Rudy::Machine.new '02'
mach.create
Rudy::Utils.waiter {
mach.instance_running?
}
mach.instid
end
dream :nil?, false
drill "refresh machine" do
mach = Rudy::Machine.new '02'
mach.refresh!
mach.dns_public
end
dream [true, true]
drill "knows about the state of the instance" do
mach = Rudy::Machine.new '02'
mach.refresh!
[mach.instance_exists?, mach.instance_running?]
end
dream true
drill "destroy machine with instance" do
mach = Rudy::Machine.new '02'
mach.refresh!
ret = mach.destroy
Rudy::Utils.waiter {
!mach.instance_running?
}
ret
end
end