File: lb_pool_tests.rb

package info (click to toggle)
ruby-fog-openstack 1.1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,784 kB
  • sloc: ruby: 47,937; makefile: 5; sh: 4
file content (58 lines) | stat: -rw-r--r-- 1,457 bytes parent folder | download
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
require "test_helper"
require "helpers/network_helper"

describe "Fog::OpenStack::Network | lb_pool" do
  describe "success" do
    before do
      @lb_health_monitor = network.lb_health_monitors.create(
        :type        => 'PING',
        :delay       => 1,
        :timeout     => 5,
        :max_retries => 10
      )

      @instance = network.lb_pools.create(
        :subnet_id      => 'subnet_id',
        :protocol       => 'HTTP',
        :lb_method      => 'ROUND_ROBIN',
        :name           => 'test-pool',
        :description    => 'Test Pool',
        :admin_state_up => true,
        :tenant_id      => 'tenant_id'
      )
    end

    after do
      @lb_health_monitor.destroy
    end

    it "#create" do
      @instance.id.wont_be_nil
    end

    it "#update" do
      @instance.name = 'new-test-pool'
      @instance.description = 'New Test Pool'
      @instance.lb_method = 'LEAST_CONNECTIONS'
      @instance.admin_state_up = false
      @instance.update.status.must_equal "ACTIVE"
    end

    it "#stats" do
      @instance.stats
      @instance.active_connections.wont_be_nil
    end

    it "#associate_health_monitor" do
      @instance.associate_health_monitor(@lb_health_monitor.id).must_equal true
    end

    it "#disassociate_health_monitor" do
      @instance.disassociate_health_monitor(@lb_health_monitor.id).must_equal true
    end

    it "#destroy" do
      @instance.destroy.must_equal true
    end
  end
end