File: instance_tests.rb

package info (click to toggle)
ruby-fog-rackspace 0.1.6-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,652 kB
  • sloc: ruby: 27,055; sh: 4; makefile: 3
file content (43 lines) | stat: -rw-r--r-- 1,187 bytes parent folder | download | duplicates (5)
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
Shindo.tests('Fog::Rackspace::Databases | instance', ['rackspace']) do

  pending if Fog.mocking?

  service = Fog::Rackspace::Databases.new
  options = {
    :name => "fog_instance_#{Time.now.to_i.to_s}",
    :flavor_id => 1,
    :volume_size => 1
  }

  model_tests(service.instances, options, false) do
    @instance.wait_for { ready? }
    tests('root_user_enabled before user is enabled').returns(false) do
      @instance.root_user_enabled?
    end

    @instance.wait_for { ready? }
    tests('enable_root_user sets root user and password').succeeds do
      @instance.enable_root_user
      returns(false) { @instance.root_user.nil? }
      returns(false) { @instance.root_password.nil? }
    end

    @instance.wait_for { ready? }
    tests('restarts instance').succeeds do
      @instance.restart
      returns('REBOOT') { @instance.state }
    end

    @instance.wait_for { ready? }
    tests('resizes instance').succeeds do
      @instance.resize(2)
      returns('RESIZE') { @instance.state }
    end

    @instance.wait_for { ready? }
    tests('restarts instance').succeeds do
      @instance.resize_volume(2)
      returns('RESIZE') { @instance.state }
    end
  end
end