Sha256: 9ca997b3b9f824d04aeb4d977c7a06507ab0f513b89e519c40e32e251fc6701f

Contents?: true

Size: 1.22 KB

Versions: 40

Compression:

Stored size: 1.22 KB

Contents

Shindo.tests('Fog::Compute[:vsphere] | rules collection', ['vsphere']) do
  
  compute = Fog::Compute[:vsphere]
  cluster = compute.datacenters.first.clusters.get('Solutionscluster')
  servers = compute.servers
  rules = cluster.rules
  
  tests('The rules collection') do
    test('should not be empty') { not rules.empty? }
    test('should be a kind of Fog::Compute::Vsphere::Rules') { rules.kind_of? Fog::Compute::Vsphere::Rules }
    test('should get rules') { rules.get('anti-affinity-foo').key == 4242 }
    test('should destroy rules') { rules.first.destroy; rules.reload; rules.empty? }
    test('should create rules') do
      r = rules.new({
        name: 'affinity-foo',
        enabled: true,
        type: RbVmomi::VIM::ClusterAffinityRuleSpec
      })
      r.vms = [servers.get('5032c8a5-9c5e-ba7a-3804-832a03e16381'), servers.get('502916a3-b42e-17c7-43ce-b3206e9524dc')]
      r.save
      rules.reload
      rules.get('affinity-foo').key > 0
    end
    raises(ArgumentError, 'should not create rules with <2 vms') do
      rules.create({
        name: 'affinity-foo',
        enabled: true,
        type: RbVmomi::VIM::ClusterAffinityRuleSpec,
        vm_ids: ['5032c8a5-9c5e-ba7a-3804-832a03e16381']
      })
    end
  end
  
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
fog-vsphere-2.1.1 tests/models/compute/rules_tests.rb
fog-vsphere-2.1.0 tests/models/compute/rules_tests.rb
fog-vsphere-2.0.1 tests/models/compute/rules_tests.rb
fog-vsphere-2.0.0 tests/models/compute/rules_tests.rb
fog-vsphere-1.13.1 tests/models/compute/rules_tests.rb
fog-vsphere-1.13.0 tests/models/compute/rules_tests.rb
fog-vsphere-1.12.0 tests/models/compute/rules_tests.rb
fog-vsphere-1.11.3 tests/models/compute/rules_tests.rb
fog-vsphere-1.11.2 tests/models/compute/rules_tests.rb
fog-vsphere-1.11.1 tests/models/compute/rules_tests.rb
fog-vsphere-1.11.0 tests/models/compute/rules_tests.rb
fog-vsphere-1.10.0 tests/models/compute/rules_tests.rb
fog-vsphere-1.9.2 tests/models/compute/rules_tests.rb
fog-vsphere-1.9.1 tests/models/compute/rules_tests.rb
fog-vsphere-1.9.0 tests/models/compute/rules_tests.rb
fog-vsphere-1.8.0 tests/models/compute/rules_tests.rb
fog-vsphere-1.7.1 tests/models/compute/rules_tests.rb
fog-vsphere-1.7.0 tests/models/compute/rules_tests.rb
fog-vsphere-1.6.0 tests/models/compute/rules_tests.rb
fog-vsphere-1.5.2 tests/models/compute/rules_tests.rb