Sha256: 63bd4c1e405913c0aabf62c10afd21bf5577f5691ccc4ef603336f440e591f37

Contents?: true

Size: 1.6 KB

Versions: 66

Compression:

Stored size: 1.6 KB

Contents

# frozen_string_literal: true

require 'test_plugin_helper'

# Tests for testing the ignore list
class IgnoreRolesTest < ActiveSupport::TestCase
  include ForemanAnsible::AnsibleRolesDataPreparations

  role1 = AnsibleRole.new(:name => 'foo')
  role2 = AnsibleRole.new(:name => 'bar')
  role3 = AnsibleRole.new(:name => 'hello.txt')
  role4 = AnsibleRole.new(:name => 'hello.yml')
  role5 = AnsibleRole.new(:name => 'foo.yml')

  describe 'It should Ignore Role' do
    test 'If role starts with h' do
      Setting.stubs(:[]).with(:ansible_roles_to_ignore).returns(['h*'])
      assert_not role_match_excluded_roles(role1.name)
      assert_not role_match_excluded_roles(role2.name)
      assert role_match_excluded_roles(role3.name)
      assert role_match_excluded_roles(role4.name)
      assert_not role_match_excluded_roles(role5.name)
    end

    test 'If role ends with .yml' do
      Setting.stubs(:[]).with(:ansible_roles_to_ignore).returns(['*.yml'])
      assert_not role_match_excluded_roles(role1.name)
      assert_not role_match_excluded_roles(role2.name)
      assert_not role_match_excluded_roles(role3.name)
      assert role_match_excluded_roles(role4.name)
      assert role_match_excluded_roles(role5.name)
    end

    test 'If role have o char in the middle' do
      Setting.stubs(:[]).with(:ansible_roles_to_ignore).returns(['*o*'])
      assert role_match_excluded_roles(role1.name)
      assert_not role_match_excluded_roles(role2.name)
      assert role_match_excluded_roles(role3.name)
      assert role_match_excluded_roles(role4.name)
      assert role_match_excluded_roles(role5.name)
    end
  end
end

Version data entries

66 entries across 66 versions & 1 rubygems

Version Path
foreman_ansible-15.0.3 test/unit/ignore_roles_test.rb
foreman_ansible-15.0.2 test/unit/ignore_roles_test.rb
foreman_ansible-15.0.1 test/unit/ignore_roles_test.rb
foreman_ansible-15.0.0 test/unit/ignore_roles_test.rb
foreman_ansible-14.2.2 test/unit/ignore_roles_test.rb
foreman_ansible-14.2.1 test/unit/ignore_roles_test.rb
foreman_ansible-13.0.7 test/unit/ignore_roles_test.rb
foreman_ansible-14.2.0 test/unit/ignore_roles_test.rb
foreman_ansible-14.1.1 test/unit/ignore_roles_test.rb
foreman_ansible-14.1.0 test/unit/ignore_roles_test.rb
foreman_ansible-13.0.5 test/unit/ignore_roles_test.rb
foreman_ansible-14.0.0 test/unit/ignore_roles_test.rb
foreman_ansible-13.0.4 test/unit/ignore_roles_test.rb
foreman_ansible-13.0.3 test/unit/ignore_roles_test.rb
foreman_ansible-13.0.2 test/unit/ignore_roles_test.rb
foreman_ansible-13.0.1 test/unit/ignore_roles_test.rb
foreman_ansible-13.0.0 test/unit/ignore_roles_test.rb
foreman_ansible-12.0.7 test/unit/ignore_roles_test.rb
foreman_ansible-10.4.4 test/unit/ignore_roles_test.rb
foreman_ansible-7.1.8 test/unit/ignore_roles_test.rb