foreman_puppet 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +619 -0
- data/README.md +38 -0
- data/Rakefile +31 -0
- data/app/assets/stylesheets/foreman_puppet.scss +117 -0
- data/app/controllers/concerns/foreman_puppet/api/import_puppetclasses_common_controller.rb +139 -0
- data/app/controllers/concerns/foreman_puppet/environments_import.rb +61 -0
- data/app/controllers/concerns/foreman_puppet/extensions/api_hostgroups_controller.rb +40 -0
- data/app/controllers/concerns/foreman_puppet/extensions/api_template_combinations_controller.rb +23 -0
- data/app/controllers/concerns/foreman_puppet/extensions/api_v2_hosts_controller.rb +48 -0
- data/app/controllers/concerns/foreman_puppet/extensions/hostgroups_controller_extensions.rb +58 -0
- data/app/controllers/concerns/foreman_puppet/extensions/hosts_controller_extensions.rb +228 -0
- data/app/controllers/concerns/foreman_puppet/extensions/operatingsystems_controller.rb +11 -0
- data/app/controllers/concerns/foreman_puppet/extensions/parameters_host.rb +75 -0
- data/app/controllers/concerns/foreman_puppet/extensions/parameters_hostgroup.rb +70 -0
- data/app/controllers/concerns/foreman_puppet/extensions/parameters_template_combination.rb +21 -0
- data/app/controllers/concerns/foreman_puppet/parameters/config_group.rb +17 -0
- data/app/controllers/concerns/foreman_puppet/parameters/environment.rb +21 -0
- data/app/controllers/concerns/foreman_puppet/parameters/puppetclass.rb +24 -0
- data/app/controllers/concerns/foreman_puppet/parameters/puppetclass_lookup_key.rb +24 -0
- data/app/controllers/foreman_puppet/api/v2/base_controller.rb +26 -0
- data/app/controllers/foreman_puppet/api/v2/config_groups_controller.rb +57 -0
- data/app/controllers/foreman_puppet/api/v2/environments_controller.rb +91 -0
- data/app/controllers/foreman_puppet/api/v2/host_classes_controller.rb +59 -0
- data/app/controllers/foreman_puppet/api/v2/hostgroup_classes_controller.rb +46 -0
- data/app/controllers/foreman_puppet/api/v2/lookups_common_controller.rb +114 -0
- data/app/controllers/foreman_puppet/api/v2/override_values_controller.rb +99 -0
- data/app/controllers/foreman_puppet/api/v2/puppetclasses_controller.rb +99 -0
- data/app/controllers/foreman_puppet/api/v2/smart_class_parameters_controller.rb +76 -0
- data/app/controllers/foreman_puppet/config_groups_controller.rb +46 -0
- data/app/controllers/foreman_puppet/environments_controller.rb +51 -0
- data/app/controllers/foreman_puppet/puppet_smart_proxies_controller.rb +39 -0
- data/app/controllers/foreman_puppet/puppetclass_lookup_keys_controller.rb +33 -0
- data/app/controllers/foreman_puppet/puppetclasses_controller.rb +113 -0
- data/app/controllers/foreman_puppet/react_controller.rb +19 -0
- data/app/helpers/concerns/foreman_puppet/template_renderer_scope.rb +14 -0
- data/app/helpers/foreman_puppet/environments_helper.rb +17 -0
- data/app/helpers/foreman_puppet/hosts_and_hostgroups_helper.rb +96 -0
- data/app/helpers/foreman_puppet/hosts_helper.rb +32 -0
- data/app/helpers/foreman_puppet/puppet_smart_proxies_helper.rb +8 -0
- data/app/helpers/foreman_puppet/puppetclass_lookup_keys_helper.rb +135 -0
- data/app/helpers/foreman_puppet/puppetclasses_and_environments_helper.rb +55 -0
- data/app/helpers/foreman_puppet/puppetclasses_helper.rb +59 -0
- data/app/helpers/foreman_puppet/template_combinations_helper.rb +33 -0
- data/app/models/concerns/foreman_puppet/extensions/host.rb +88 -0
- data/app/models/concerns/foreman_puppet/extensions/hostgroup.rb +40 -0
- data/app/models/concerns/foreman_puppet/extensions/nic_managed.rb +11 -0
- data/app/models/concerns/foreman_puppet/extensions/operatingsystem.rb +11 -0
- data/app/models/concerns/foreman_puppet/extensions/provisioning_template.rb +64 -0
- data/app/models/concerns/foreman_puppet/extensions/report.rb +11 -0
- data/app/models/concerns/foreman_puppet/extensions/taxonomy.rb +19 -0
- data/app/models/concerns/foreman_puppet/extensions/template_combination.rb +23 -0
- data/app/models/concerns/foreman_puppet/extensions/user.rb +22 -0
- data/app/models/concerns/foreman_puppet/host_common.rb +90 -0
- data/app/models/concerns/foreman_puppet/puppet_lookup_value_extensions.rb +13 -0
- data/app/models/foreman_puppet/config_group.rb +45 -0
- data/app/models/foreman_puppet/config_group_class.rb +19 -0
- data/app/models/foreman_puppet/environment.rb +63 -0
- data/app/models/foreman_puppet/environment_class.rb +40 -0
- data/app/models/foreman_puppet/host_class.rb +23 -0
- data/app/models/foreman_puppet/host_config_group.rb +15 -0
- data/app/models/foreman_puppet/host_puppet_facet.rb +130 -0
- data/app/models/foreman_puppet/hostgroup_class.rb +23 -0
- data/app/models/foreman_puppet/hostgroup_puppet_facet.rb +98 -0
- data/app/models/foreman_puppet/puppetclass.rb +132 -0
- data/app/models/foreman_puppet/puppetclass_lookup_key.rb +58 -0
- data/app/services/foreman_puppet/host_info_providers/config_groups_info.rb +10 -0
- data/app/services/foreman_puppet/host_info_providers/puppet_info.rb +92 -0
- data/app/services/foreman_puppet/input_type/puppet_parameter_input.rb +35 -0
- data/app/services/foreman_puppet/proxy_status/puppet.rb +17 -0
- data/app/services/foreman_puppet/puppet_class_importer.rb +355 -0
- data/app/views/api/v2/template_combinations/base.json.erb +9 -0
- data/app/views/foreman_puppet/api/v2/config_groups/base.json.rabl +3 -0
- data/app/views/foreman_puppet/api/v2/config_groups/create.json.rabl +3 -0
- data/app/views/foreman_puppet/api/v2/config_groups/index.json.rabl +3 -0
- data/app/views/foreman_puppet/api/v2/config_groups/main.json.rabl +8 -0
- data/app/views/foreman_puppet/api/v2/config_groups/show.json.rabl +3 -0
- data/app/views/foreman_puppet/api/v2/config_groups/update.json.rabl +3 -0
- data/app/views/foreman_puppet/api/v2/environments/base.json.rabl +3 -0
- data/app/views/foreman_puppet/api/v2/environments/create.json.rabl +3 -0
- data/app/views/foreman_puppet/api/v2/environments/index.json.rabl +3 -0
- data/app/views/foreman_puppet/api/v2/environments/main.json.rabl +5 -0
- data/app/views/foreman_puppet/api/v2/environments/show.json.rabl +15 -0
- data/app/views/foreman_puppet/api/v2/environments/update.json.rabl +3 -0
- data/app/views/foreman_puppet/api/v2/host_puppet_facets/base.json.rabl +1 -0
- data/app/views/foreman_puppet/api/v2/host_puppet_facets/host_single.json.rabl +17 -0
- data/app/views/foreman_puppet/api/v2/host_puppet_facets/show.json.rabl +11 -0
- data/app/views/foreman_puppet/api/v2/hostgroup_puppet_facets/base.json.rabl +5 -0
- data/app/views/foreman_puppet/api/v2/hostgroup_puppet_facets/hostgroup_single.json.rabl +16 -0
- data/app/views/foreman_puppet/api/v2/hostgroup_puppet_facets/show.json.rabl +11 -0
- data/app/views/foreman_puppet/api/v2/import_puppetclasses/index.json.rabl +3 -0
- data/app/views/foreman_puppet/api/v2/import_puppetclasses/show.json.rabl +36 -0
- data/app/views/foreman_puppet/api/v2/override_values/create.json.rabl +3 -0
- data/app/views/foreman_puppet/api/v2/override_values/index.json.rabl +3 -0
- data/app/views/foreman_puppet/api/v2/override_values/show.json.rabl +3 -0
- data/app/views/foreman_puppet/api/v2/override_values/update.json.rabl +3 -0
- data/app/views/foreman_puppet/api/v2/puppetclasses/base.json.rabl +3 -0
- data/app/views/foreman_puppet/api/v2/puppetclasses/create.json.rabl +3 -0
- data/app/views/foreman_puppet/api/v2/puppetclasses/index.json.rabl +4 -0
- data/app/views/foreman_puppet/api/v2/puppetclasses/list.json.rabl +3 -0
- data/app/views/foreman_puppet/api/v2/puppetclasses/main.json.rabl +5 -0
- data/app/views/foreman_puppet/api/v2/puppetclasses/show.json.rabl +15 -0
- data/app/views/foreman_puppet/api/v2/puppetclasses/update.json.rabl +3 -0
- data/app/views/foreman_puppet/api/v2/smart_class_parameters/base.json.rabl +4 -0
- data/app/views/foreman_puppet/api/v2/smart_class_parameters/create.json.rabl +3 -0
- data/app/views/foreman_puppet/api/v2/smart_class_parameters/destroy.json.rabl +3 -0
- data/app/views/foreman_puppet/api/v2/smart_class_parameters/index.json.rabl +3 -0
- data/app/views/foreman_puppet/api/v2/smart_class_parameters/main.json.rabl +23 -0
- data/app/views/foreman_puppet/api/v2/smart_class_parameters/show.json.rabl +19 -0
- data/app/views/foreman_puppet/api/v2/smart_class_parameters/update.json.rabl +3 -0
- data/app/views/foreman_puppet/config_groups/_config_group.html.erb +34 -0
- data/app/views/foreman_puppet/config_groups/_config_groups_selection.html.erb +36 -0
- data/app/views/foreman_puppet/config_groups/_form.html.erb +9 -0
- data/app/views/foreman_puppet/config_groups/edit.html.erb +3 -0
- data/app/views/foreman_puppet/config_groups/index.html.erb +31 -0
- data/app/views/foreman_puppet/config_groups/new.html.erb +3 -0
- data/app/views/foreman_puppet/config_groups/welcome.html.erb +12 -0
- data/app/views/foreman_puppet/environments/_form.html.erb +20 -0
- data/app/views/foreman_puppet/environments/edit.html.erb +8 -0
- data/app/views/foreman_puppet/environments/index.html.erb +32 -0
- data/app/views/foreman_puppet/environments/new.html.erb +7 -0
- data/app/views/foreman_puppet/environments/welcome.html.erb +16 -0
- data/app/views/foreman_puppet/layouts/application_react.html.erb +15 -0
- data/app/views/foreman_puppet/puppet_smart_proxies/_dashboard.html.erb +9 -0
- data/app/views/foreman_puppet/puppet_smart_proxies/_environments.html.erb +30 -0
- data/app/views/foreman_puppet/puppetclass_lookup_keys/edit.html.erb +3 -0
- data/app/views/foreman_puppet/puppetclass_lookup_keys/index.html.erb +22 -0
- data/app/views/foreman_puppet/puppetclass_lookup_keys/welcome.html.erb +9 -0
- data/app/views/foreman_puppet/puppetclasses/_class_parameters.html.erb +37 -0
- data/app/views/foreman_puppet/puppetclasses/_class_selection.html.erb +70 -0
- data/app/views/foreman_puppet/puppetclasses/_classes.html.erb +22 -0
- data/app/views/foreman_puppet/puppetclasses/_classes_in_groups.html.erb +5 -0
- data/app/views/foreman_puppet/puppetclasses/_classes_parameters.html.erb +16 -0
- data/app/views/foreman_puppet/puppetclasses/_form.html.erb +62 -0
- data/app/views/foreman_puppet/puppetclasses/_selected_classes.html.erb +4 -0
- data/app/views/foreman_puppet/puppetclasses/edit.html.erb +4 -0
- data/app/views/foreman_puppet/puppetclasses/index.html.erb +47 -0
- data/app/views/hosts/_form_puppet_enc_tab.html.erb +24 -0
- data/app/views/hosts/foreman_puppet/_form_main_tab_fields.html.erb +1 -0
- data/app/views/hosts/select_multiple_environment.html.erb +8 -0
- data/app/views/provisioning_templates/_combination.html.erb +5 -0
- data/app/views/provisioning_templates/_combinations.html.erb +6 -0
- data/app/views/smart_proxies/plugins/_puppet.html.erb +24 -0
- data/config/api_routes.rb +81 -0
- data/config/routes.rb +89 -0
- data/db/migrate/20101121140000_add_environment_to_template_combinations.foreman_puppet.rb +9 -0
- data/db/migrate/20200720123005_migrate_puppet_core_types.foreman_puppet.rb +19 -0
- data/db/migrate/20200722171017_create_host_puppet_facet.foreman_puppet.rb +10 -0
- data/db/migrate/20200803113531_create_hostgroup_puppet_facet.foreman_puppet.rb +10 -0
- data/db/migrate/20200803113803_migrate_environment_to_puppet_facet.foreman_puppet.rb +22 -0
- data/db/migrate/20200803113903_migrate_host_type_in_host_config_groups.foreman_puppet.rb +29 -0
- data/db/migrate/20201125113903_migrate_puppetclasses_to_facets.foreman_puppet.rb +47 -0
- data/db/migrate_foreman/20090722141107_create_environments.rb +17 -0
- data/db/migrate_foreman/20120905095532_create_environment_classes.rb +15 -0
- data/db/migrate_foreman/20140407161817_create_config_groups.rb +9 -0
- data/db/migrate_foreman/20140407162007_create_config_group_classes.rb +10 -0
- data/db/migrate_foreman/20140407162059_create_host_config_groups.rb +11 -0
- data/db/migrate_foreman/20161205142618_delete_orphaned_smart_class_parameters.rb +10 -0
- data/db/migrate_foreman/20170109115157_fix_lookup_key_auditable_type.rb +15 -0
- data/db/migrate_foreman/20180816134832_cast_lookup_key_values.rb +35 -0
- data/db/migrate_foreman/20181023112532_add_environment_puppetclass_id.rb +7 -0
- data/db/migrate_foreman/20181224174419_add_index_to_environment_class_by_lookup_key_and_puppetclass.rb +6 -0
- data/db/seeds.d/111_puppet_proxy_feature.rb +8 -0
- data/lib/foreman_puppet.rb +10 -0
- data/lib/foreman_puppet/engine.rb +82 -0
- data/lib/foreman_puppet/register.rb +218 -0
- data/lib/foreman_puppet/version.rb +3 -0
- data/lib/tasks/foreman_puppet_tasks.rake +31 -0
- data/locale/Makefile +60 -0
- data/locale/action_names.rb +5 -0
- data/locale/en/foreman_puppet.edit.po +911 -0
- data/locale/en/foreman_puppet.po +690 -0
- data/locale/en/foreman_puppet.po.time_stamp +0 -0
- data/locale/foreman_puppet.pot +1076 -0
- data/locale/gemspec.rb +2 -0
- data/test/controllers/foreman_puppet/api/v2/config_groups_controller_test.rb +28 -0
- data/test/controllers/foreman_puppet/api/v2/environments_controller_test.rb +346 -0
- data/test/controllers/foreman_puppet/api/v2/host_classes_controller_test.rb +48 -0
- data/test/controllers/foreman_puppet/api/v2/hostgroup_classes_controller_test.rb +41 -0
- data/test/controllers/foreman_puppet/api/v2/hostgroups_controller_test.rb +79 -0
- data/test/controllers/foreman_puppet/api/v2/hosts_controller_test.rb +101 -0
- data/test/controllers/foreman_puppet/api/v2/lookups_common_controller_test.rb +29 -0
- data/test/controllers/foreman_puppet/api/v2/override_values_controller_test.rb +169 -0
- data/test/controllers/foreman_puppet/api/v2/puppetclasses_controller_test.rb +144 -0
- data/test/controllers/foreman_puppet/api/v2/smart_class_parameters_controller_test.rb +557 -0
- data/test/controllers/foreman_puppet/api/v2/template_combinations_controller_test.rb +81 -0
- data/test/controllers/foreman_puppet/config_groups_controller_test.rb +47 -0
- data/test/controllers/foreman_puppet/environments_controller_test.rb +230 -0
- data/test/controllers/foreman_puppet/hostgroups_controller_test.rb +72 -0
- data/test/controllers/foreman_puppet/hosts_controller_test.rb +346 -0
- data/test/controllers/foreman_puppet/puppet_smart_proxies_controller_test.rb +29 -0
- data/test/controllers/foreman_puppet/puppetclass_lookup_keys_controller_test.rb +59 -0
- data/test/controllers/foreman_puppet/puppetclasses_controller_test.rb +235 -0
- data/test/controllers/provisioning_templates_controller_test.rb +70 -0
- data/test/factories/foreman_puppet_factories.rb +134 -0
- data/test/factories/host_puppet_enhancements.rb +61 -0
- data/test/factories/proxy_puppet_enhancements.rb +33 -0
- data/test/helpers/foreman_puppet/hosts_and_hostgroups_helper_test.rb +65 -0
- data/test/helpers/foreman_puppet/puppetclasses_helper_test.rb +33 -0
- data/test/integration/foreman_puppet/environment_js_test.rb +27 -0
- data/test/integration/foreman_puppet/host_js_test.rb +371 -0
- data/test/integration/foreman_puppet/hostgroup_js_test.rb +100 -0
- data/test/integration/foreman_puppet/puppetclass_js_test.rb +37 -0
- data/test/integration/foreman_puppet/smartclass_parameter_js_test.rb +84 -0
- data/test/models/foreman_puppet/config_group_class_test.rb +9 -0
- data/test/models/foreman_puppet/config_group_test.rb +8 -0
- data/test/models/foreman_puppet/environment_test.rb +92 -0
- data/test/models/foreman_puppet/host_config_group_test.rb +39 -0
- data/test/models/foreman_puppet/host_puppet_facet_test.rb +116 -0
- data/test/models/foreman_puppet/host_test.rb +288 -0
- data/test/models/foreman_puppet/hostgroup_puppet_facet_test.rb +200 -0
- data/test/models/foreman_puppet/hostgroup_test.rb +14 -0
- data/test/models/foreman_puppet/lookup_value_test.rb +69 -0
- data/test/models/foreman_puppet/provisioning_template_test.rb +124 -0
- data/test/models/foreman_puppet/puppetclass_lookup_key_test.rb +81 -0
- data/test/models/foreman_puppet/puppetclass_test.rb +144 -0
- data/test/models/foreman_puppet/smart_proxy_test.rb +28 -0
- data/test/qraphql/queries/host_puppet_query_test.rb +36 -0
- data/test/qraphql/queries/hostgroup_puppet_query_test.rb +36 -0
- data/test/services/foreman_puppet/host_info_providers/puppet_info_test.rb +791 -0
- data/test/services/foreman_puppet/input_type/puppet_parameter_input_test.rb +14 -0
- data/test/test_puppet_helper.rb +30 -0
- data/test/unit/foreman_puppet/access_permissions_test.rb +16 -0
- data/test/unit/foreman_puppet/puppet_class_importer_test.rb +247 -0
- data/test/unit/foreman_puppet/template_rendering_test.rb +20 -0
- data/test/unit/foreman_puppet_test.rb +11 -0
- data/webpack/__mocks__/foremanReact/common/I18n.js +7 -0
- data/webpack/__mocks__/foremanReact/components/Layout/LayoutActions.js +2 -0
- data/webpack/__mocks__/foremanReact/readme.md +11 -0
- data/webpack/__mocks__/foremanReact/redux/API/APISelectors.js +10 -0
- data/webpack/__mocks__/foremanReact/redux/API/index.js +10 -0
- data/webpack/__mocks__/foremanReact/redux/actions/toasts.js +8 -0
- data/webpack/__mocks__/foremanReact/redux/index.js +1 -0
- data/webpack/__mocks__/foremanReact/redux/middlewares/IntervalMiddleware.js +5 -0
- data/webpack/fills_index.js +30 -0
- data/webpack/index.js +18 -0
- data/webpack/src/ForemanPuppet.js +11 -0
- data/webpack/src/Router/__snapshots__/routes.test.js.snap +3 -0
- data/webpack/src/Router/index.js +14 -0
- data/webpack/src/Router/routes.js +3 -0
- data/webpack/src/Router/routes.test.js +16 -0
- data/webpack/src/foreman_class_edit.js +224 -0
- data/webpack/src/foreman_puppet_host_form.js +140 -0
- data/webpack/src/foreman_puppet_host_form.test.js +65 -0
- data/webpack/src/index.js +1 -0
- data/webpack/src/reducers.js +7 -0
- metadata +340 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
require 'test_puppet_helper'
|
|
2
|
+
|
|
3
|
+
module ForemanPuppet
|
|
4
|
+
class HostgroupTest < ActiveSupport::TestCase
|
|
5
|
+
let(:hostgroup) { FactoryBot.create(:hostgroup, :with_puppet_enc, :with_config_group) }
|
|
6
|
+
|
|
7
|
+
test 'search hostgroups by config group' do
|
|
8
|
+
config_group = hostgroup.puppet.config_groups.first
|
|
9
|
+
hostgroups = ::Hostgroup.search_for("config_group = #{config_group.name}")
|
|
10
|
+
assert_equal 1, hostgroups.count
|
|
11
|
+
assert_equal hostgroups.pluck(:id).sort, hostgroups.map(&:id).sort
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
require_relative '../../test_puppet_helper'
|
|
2
|
+
|
|
3
|
+
module ForemanPuppet
|
|
4
|
+
class LookupValueTest < ActiveSupport::TestCase
|
|
5
|
+
let(:boolean_lookup_key) { FactoryBot.create(:puppetclass_lookup_key, :boolean, path: "hostgroup\nfqdn\nhostgroup,domain") }
|
|
6
|
+
|
|
7
|
+
test 'boolean lookup value should not allow for nil value' do
|
|
8
|
+
lookup_value = LookupValue.new(value: nil, match: 'hostgroup=Common', lookup_key_id: boolean_lookup_key.id)
|
|
9
|
+
assert_not lookup_value.valid?
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
test 'boolean lookup value should allow nil value if omit is true' do
|
|
13
|
+
lookup_value = LookupValue.new(value: nil, match: 'hostgroup=Common', lookup_key_id: boolean_lookup_key.id, omit: true)
|
|
14
|
+
assert_valid lookup_value
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
test "shouldn't save with empty boolean matcher for smart class parameter" do
|
|
18
|
+
lookup_key = FactoryBot.create(:puppetclass_lookup_key, :boolean, override: true, description: 'description')
|
|
19
|
+
lookup_value = FactoryBot.build_stubbed(:lookup_value, lookup_key: lookup_key, match: 'os=fake', value: '')
|
|
20
|
+
assert_not lookup_value.valid?
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
test 'impact parameter delete attribute' do
|
|
24
|
+
hostgroup_name = RFauxFactory.gen_alpha
|
|
25
|
+
puppetclass = FactoryBot.create(:puppetclass)
|
|
26
|
+
environment = FactoryBot.create(:environment)
|
|
27
|
+
hostgroup = FactoryBot.create(:hostgroup, :with_puppet_enc, name: hostgroup_name, environment: environment, puppetclasses: [puppetclass])
|
|
28
|
+
match = "hostgroup=#{hostgroup_name}"
|
|
29
|
+
match_value = RFauxFactory.gen_alpha
|
|
30
|
+
lookup_key = FactoryBot.create(:puppetclass_lookup_key, default_value: 'list', puppetclass: FactoryBot.create(:puppetclass))
|
|
31
|
+
FactoryBot.create(:lookup_value, lookup_key: lookup_key, value: match_value, match: match)
|
|
32
|
+
lookup_key = LookupKey.unscoped.find_by(id: lookup_key.id)
|
|
33
|
+
assert_equal lookup_key.override_values.first.match, match
|
|
34
|
+
assert_equal lookup_key.override_values.first.value, match_value
|
|
35
|
+
hostgroup.destroy
|
|
36
|
+
lookup_key.reload
|
|
37
|
+
assert_equal(0, lookup_key.override_values.length)
|
|
38
|
+
FactoryBot.create(:hostgroup, :with_puppet_enc, name: hostgroup_name, environment: environment, puppetclasses: [puppetclass])
|
|
39
|
+
assert_equal(0, lookup_key.override_values.count)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
context 'when key is a boolean and default_value is a string' do
|
|
43
|
+
let(:puppet_boolean_string) do
|
|
44
|
+
FactoryBot.create(:puppetclass_lookup_key, override: true, key_type: 'boolean',
|
|
45
|
+
default_value: 'whatever', omit: true)
|
|
46
|
+
end
|
|
47
|
+
let(:lookup_value) { LookupValue.new(value: 'abc', match: 'hostgroup=Common', lookup_key_id: puppet_boolean_string.id, omit: true) }
|
|
48
|
+
|
|
49
|
+
test 'value is not validated if omit is true' do
|
|
50
|
+
assert_valid lookup_value
|
|
51
|
+
lookup_value.omit = false
|
|
52
|
+
refute_valid lookup_value
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
context 'when key type is puppetclass lookup and value is empty' do
|
|
57
|
+
let(:puppet_string_empty) do
|
|
58
|
+
FactoryBot.create(:puppetclass_lookup_key, :with_override, :with_omit, path: "hostgroup\ncomment", key_type: 'string')
|
|
59
|
+
end
|
|
60
|
+
let(:lookup_value) { LookupValue.new(value: '', match: 'hostgroup=Common', lookup_key_id: puppet_string_empty.id, omit: true) }
|
|
61
|
+
|
|
62
|
+
test 'value is validated if omit is true' do
|
|
63
|
+
assert_valid lookup_value
|
|
64
|
+
lookup_value.omit = false
|
|
65
|
+
refute_valid lookup_value
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
require 'test_puppet_helper'
|
|
2
|
+
|
|
3
|
+
module ForemanPuppet
|
|
4
|
+
class ProvisioningTemplateTest < ActiveSupport::TestCase
|
|
5
|
+
let(:environment) { FactoryBot.create(:environment) }
|
|
6
|
+
|
|
7
|
+
test 'should save assoications if not snippet' do
|
|
8
|
+
tmplt = ProvisioningTemplate.new
|
|
9
|
+
tmplt.name = 'Some finish script'
|
|
10
|
+
tmplt.template = 'echo $HOME'
|
|
11
|
+
tmplt.template_kind = template_kinds(:finish)
|
|
12
|
+
tmplt.snippet = false # this is the default, but it helps show the case
|
|
13
|
+
tmplt.hostgroups << hostgroups(:common)
|
|
14
|
+
tmplt.environments << environment
|
|
15
|
+
as_admin do
|
|
16
|
+
assert tmplt.save
|
|
17
|
+
end
|
|
18
|
+
assert_equal template_kinds(:finish), tmplt.template_kind
|
|
19
|
+
assert_equal [hostgroups(:common)], tmplt.hostgroups
|
|
20
|
+
assert_equal [environment], tmplt.environments
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
test 'should not save assoications if snippet' do
|
|
24
|
+
tmplt = ProvisioningTemplate.new
|
|
25
|
+
tmplt.name = 'Default Kickstart'
|
|
26
|
+
tmplt.template = 'Some kickstart goes here'
|
|
27
|
+
tmplt.snippet = true
|
|
28
|
+
tmplt.template_kind = template_kinds(:ipxe)
|
|
29
|
+
tmplt.hostgroups << hostgroups(:common)
|
|
30
|
+
tmplt.environments << environment
|
|
31
|
+
as_admin do
|
|
32
|
+
assert tmplt.save
|
|
33
|
+
end
|
|
34
|
+
assert_nil tmplt.template_kind
|
|
35
|
+
assert_equal [], tmplt.hostgroups
|
|
36
|
+
assert_equal [], tmplt.environments
|
|
37
|
+
assert_equal [], tmplt.template_combinations
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
describe 'Association cascading' do
|
|
41
|
+
setup do
|
|
42
|
+
@arch = FactoryBot.create(:architecture)
|
|
43
|
+
medium = FactoryBot.create(:medium, name: 'combo_medium', path: 'http://www.example.com/m')
|
|
44
|
+
@os1 = FactoryBot.create(:rhel7_5, media: [medium], architectures: [@arch])
|
|
45
|
+
@hg1 = FactoryBot.create(:hostgroup, name: 'hg1', operatingsystem: @os1, architecture: @arch, medium: @os1.media.first)
|
|
46
|
+
@hg2 = FactoryBot.create(:hostgroup, name: 'hg2', operatingsystem: @os1, architecture: @arch)
|
|
47
|
+
@hg3 = FactoryBot.create(:hostgroup, name: 'hg3', operatingsystem: @os1, architecture: @arch)
|
|
48
|
+
@ev1 = FactoryBot.create(:environment, name: 'env1')
|
|
49
|
+
@ev2 = FactoryBot.create(:environment, name: 'env2')
|
|
50
|
+
@ev3 = FactoryBot.create(:environment, name: 'env3')
|
|
51
|
+
|
|
52
|
+
@tk = TemplateKind.find_by(name: 'provision')
|
|
53
|
+
|
|
54
|
+
# Most specific template association
|
|
55
|
+
@ct1 = FactoryBot.create(:provisioning_template, name: 'ct1', template_kind: @tk, operatingsystems: [@os1])
|
|
56
|
+
@ct1.template_combinations.create(hostgroup: @hg1, environment: @ev1)
|
|
57
|
+
|
|
58
|
+
# HG only
|
|
59
|
+
# We add an association on HG2/EV2 to ensure that we're not just blindly
|
|
60
|
+
# selecting all template_combinations where environment_id => nil
|
|
61
|
+
@ct2 = FactoryBot.create(:provisioning_template, name: 'ct2', template_kind: @tk, operatingsystems: [@os1])
|
|
62
|
+
@ct2.template_combinations.create(hostgroup: @hg1, environment: nil)
|
|
63
|
+
@ct2.template_combinations.create(hostgroup: @hg2, environment: @ev2)
|
|
64
|
+
|
|
65
|
+
# Env only
|
|
66
|
+
# We add an association on HG2/EV2 to ensure that we're not just blindly
|
|
67
|
+
# selecting all template_combinations where hostgroup_id => nil
|
|
68
|
+
@ct3 = FactoryBot.create(:provisioning_template, name: 'ct3', template_kind: @tk, operatingsystems: [@os1])
|
|
69
|
+
@ct3.template_combinations.create(hostgroup: nil, environment: @ev1)
|
|
70
|
+
@ct3.template_combinations.create(hostgroup: @hg2, environment: @ev2)
|
|
71
|
+
|
|
72
|
+
# Default template for the OS
|
|
73
|
+
@ctd = FactoryBot.create(:provisioning_template, name: 'ctd', template_kind: @tk, operatingsystems: [@os1])
|
|
74
|
+
@ctd.os_default_templates.create(operatingsystem: @os1, template_kind_id: @ctd.template_kind_id)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
test 'find_template finds a matching template with hg and env' do
|
|
78
|
+
assert_equal @ct1.name,
|
|
79
|
+
ProvisioningTemplate.find_template({ kind: @tk.name,
|
|
80
|
+
operatingsystem_id: @os1.id,
|
|
81
|
+
hostgroup_id: @hg1.id,
|
|
82
|
+
environment_id: @ev1.id }).name
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
test 'find_template finds a matching template with hg only' do
|
|
86
|
+
assert_equal @ct2.name,
|
|
87
|
+
ProvisioningTemplate.find_template({ kind: @tk.name,
|
|
88
|
+
operatingsystem_id: @os1.id,
|
|
89
|
+
hostgroup_id: @hg1.id }).name
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
test 'find_template finds a matching template with hg and mismatched env' do
|
|
93
|
+
assert_equal @ct2.name,
|
|
94
|
+
ProvisioningTemplate.find_template({ kind: @tk.name,
|
|
95
|
+
operatingsystem_id: @os1.id,
|
|
96
|
+
hostgroup_id: @hg1.id,
|
|
97
|
+
environment_id: @ev3.id }).name
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
test 'find_template finds a matching template with env only' do
|
|
101
|
+
assert_equal @ct3.name,
|
|
102
|
+
ProvisioningTemplate.find_template({ kind: @tk.name,
|
|
103
|
+
operatingsystem_id: @os1.id,
|
|
104
|
+
environment_id: @ev1.id }).name
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
test 'find_template finds a matching template with env and mismatched hg' do
|
|
108
|
+
assert_equal @ct3.name,
|
|
109
|
+
ProvisioningTemplate.find_template({ kind: @tk.name,
|
|
110
|
+
operatingsystem_id: @os1.id,
|
|
111
|
+
hostgroup_id: @hg3.id,
|
|
112
|
+
environment_id: @ev1.id }).name
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
test 'find_template finds the default template when hg and env do not match' do
|
|
116
|
+
assert_equal @ctd.name,
|
|
117
|
+
ProvisioningTemplate.find_template({ kind: @tk.name,
|
|
118
|
+
operatingsystem_id: @os1.id,
|
|
119
|
+
hostgroup_id: @hg3.id,
|
|
120
|
+
environment_id: @ev3.id }).name
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
end
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
require 'test_puppet_helper'
|
|
2
|
+
|
|
3
|
+
module ForemanPuppet
|
|
4
|
+
class PuppetclassLookupKeyTest < ActiveSupport::TestCase
|
|
5
|
+
test 'should not update default value unless override is true' do
|
|
6
|
+
lookup_key = FactoryBot.create(:puppetclass_lookup_key, override: false, default_value: 'test123')
|
|
7
|
+
assert_not lookup_key.override
|
|
8
|
+
lookup_key.default_value = '33333'
|
|
9
|
+
assert_not lookup_key.valid?
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
test 'default_value is only validated if omit is false' do
|
|
13
|
+
lookup_key = FactoryBot.create(:puppetclass_lookup_key, :boolean, override: true, omit: true)
|
|
14
|
+
lookup_key.default_value = 'whatever'
|
|
15
|
+
assert lookup_key.valid?
|
|
16
|
+
lookup_key.omit = false
|
|
17
|
+
assert_not lookup_key.valid?
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
test 'should update description when override is false' do
|
|
21
|
+
lookup_key = FactoryBot.create(:puppetclass_lookup_key, override: false, description: 'description')
|
|
22
|
+
assert_not lookup_key.override
|
|
23
|
+
lookup_key.description = 'new_description'
|
|
24
|
+
assert lookup_key.valid?
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
test 'should save without changes when override is false' do
|
|
28
|
+
lookup_key = FactoryBot.create(:puppetclass_lookup_key, override: false,
|
|
29
|
+
default_value: 'test123',
|
|
30
|
+
description: 'description')
|
|
31
|
+
assert_not lookup_key.override
|
|
32
|
+
assert lookup_key.valid?
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
test 'should allow to uncheck override' do
|
|
36
|
+
lookup_key = FactoryBot.create(:puppetclass_lookup_key, override: true)
|
|
37
|
+
|
|
38
|
+
lookup_key.override = false
|
|
39
|
+
assert lookup_key.valid?
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
test 'should be smart class parameter #puppet? => true' do
|
|
43
|
+
assert_not_deprecated do
|
|
44
|
+
assert FactoryBot.create(:puppetclass_lookup_key).puppet?
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
context 'delete params with class' do
|
|
49
|
+
let(:environment) { FactoryBot.create(:environment) }
|
|
50
|
+
let(:puppetclass) { FactoryBot.create(:puppetclass, environments: [environment]) }
|
|
51
|
+
let(:lookup_key) { FactoryBot.create(:puppetclass_lookup_key, puppetclass: puppetclass, override: true) }
|
|
52
|
+
|
|
53
|
+
test 'deleting puppetclass should delete smart class parameters' do
|
|
54
|
+
env2 = FactoryBot.create(:environment)
|
|
55
|
+
FactoryBot.create(:environment_class, puppetclass: puppetclass, environment: env2, puppetclass_lookup_key: lookup_key)
|
|
56
|
+
|
|
57
|
+
puppetclass.destroy
|
|
58
|
+
assert_not ForemanPuppet::PuppetclassLookupKey.where(key: lookup_key.key).present?
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
test 'deleting only environment a smart class parameters is in should delete the parameter' do
|
|
62
|
+
lookup_key
|
|
63
|
+
environment.destroy
|
|
64
|
+
assert_not ForemanPuppet::PuppetclassLookupKey.where(key: lookup_key.key).present?
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
test 'deleting only one environment a smart class parameters is in should not delete the parameter' do
|
|
68
|
+
env2 = FactoryBot.create(:environment)
|
|
69
|
+
FactoryBot.create(:environment_class, puppetclass: puppetclass, environment: env2, puppetclass_lookup_key: lookup_key)
|
|
70
|
+
|
|
71
|
+
environment.destroy
|
|
72
|
+
assert ForemanPuppet::PuppetclassLookupKey.where(key: lookup_key.key).present?
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
test 'should have auditable_type as PuppetclassLookupKey and not LookupKey' do
|
|
77
|
+
ForemanPuppet::PuppetclassLookupKey.create(key: 'test_audit_parameter', default_value: 'test123')
|
|
78
|
+
assert_equal 'ForemanPuppet::PuppetclassLookupKey', Audit.unscoped.last.auditable_type
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
require 'test_puppet_helper'
|
|
2
|
+
|
|
3
|
+
module ForemanPuppet
|
|
4
|
+
class PuppetclassTest < ActiveSupport::TestCase
|
|
5
|
+
setup do
|
|
6
|
+
User.current = users(:admin)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
should validate_presence_of(:name)
|
|
10
|
+
should validate_uniqueness_of(:name)
|
|
11
|
+
|
|
12
|
+
test 'name strips leading and trailing white spaces' do
|
|
13
|
+
puppet_class = Puppetclass.new name: ' testclass '
|
|
14
|
+
assert puppet_class.save
|
|
15
|
+
assert_not puppet_class.name.ends_with?(' ')
|
|
16
|
+
assert_not puppet_class.name.starts_with?(' ')
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
test 'looking for a nonexistent host returns no puppetclasses' do
|
|
20
|
+
assert_equal [], Puppetclass.search_for('host = imaginaryhost.nodomain.what')
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
test 'Puppetclass singularize from custom inflection' do
|
|
24
|
+
assert_equal 'Puppetclass', 'Puppetclass'.singularize
|
|
25
|
+
assert_equal 'Puppetclass', 'Puppetclasses'.singularize
|
|
26
|
+
assert_equal 'puppetclass', 'puppetclass'.singularize
|
|
27
|
+
assert_equal 'puppetclass', 'puppetclasses'.singularize
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
test 'Puppetclass classify from custom inflection' do
|
|
31
|
+
assert_equal 'Puppetclass', 'Puppetclass'.classify
|
|
32
|
+
assert_equal 'Puppetclass', 'Puppetclasses'.classify
|
|
33
|
+
assert_equal 'Puppetclass', 'puppetclass'.classify
|
|
34
|
+
assert_equal 'Puppetclass', 'puppetclasses'.classify
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
context 'all_hostgroups should show hostgroups and their descendants' do
|
|
38
|
+
setup do
|
|
39
|
+
@class = FactoryBot.create(:puppetclass)
|
|
40
|
+
@hg1 = FactoryBot.create(:hostgroup, :with_puppet_enc)
|
|
41
|
+
@hg2 = FactoryBot.create(:hostgroup, :with_puppet_enc, parent_id: @hg1.id)
|
|
42
|
+
@hg3 = FactoryBot.create(:hostgroup, :with_puppet_enc, parent_id: @hg2.id)
|
|
43
|
+
@config_group = FactoryBot.create(:config_group)
|
|
44
|
+
@hg1.puppet.config_groups << @config_group
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
it 'when added directly' do
|
|
48
|
+
assert_difference('@class.all_hostgroups.count', 3) do
|
|
49
|
+
@class.hostgroup_puppet_facets << @hg1.puppet
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
it 'when added directly and called without descendants' do
|
|
54
|
+
assert_difference(-> { @class.all_hostgroups(with_descendants: false).count }, 1) do
|
|
55
|
+
@class.hostgroup_puppet_facets << @hg1.puppet
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
it 'when added via config group' do
|
|
60
|
+
assert_difference('@class.all_hostgroups.count', 3) do
|
|
61
|
+
@class.config_groups << @config_group
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
it 'when added directly and called without descendants' do
|
|
66
|
+
assert_difference(-> { @class.all_hostgroups(with_descendants: false).count }, 1) do
|
|
67
|
+
@class.config_groups << @config_group
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
context 'host counting' do
|
|
73
|
+
setup do
|
|
74
|
+
@env = FactoryBot.create(:environment)
|
|
75
|
+
@class = FactoryBot.create(:puppetclass)
|
|
76
|
+
@parent_hg = FactoryBot.create(:hostgroup, :with_puppet_enc)
|
|
77
|
+
@hostgroup = FactoryBot.create(:hostgroup, :with_puppet_enc, parent: @parent_hg)
|
|
78
|
+
@config_group = FactoryBot.create(:config_group, puppetclasses: [@class])
|
|
79
|
+
@host = FactoryBot.create(:host, :with_puppet_enc, environment: @env)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
test 'correctly counts direct hosts' do
|
|
83
|
+
@host.puppet.puppetclasses << @class
|
|
84
|
+
assert_equal 1, @class.hosts_count
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
test 'correctly counts hosts via config group' do
|
|
88
|
+
@host.puppet.config_groups << @config_group
|
|
89
|
+
assert_equal 1, @class.hosts_count
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
test 'correctly counts hosts via hostgroup' do
|
|
93
|
+
@hostgroup.puppet.puppetclasses << @class
|
|
94
|
+
@host.update(hostgroup_id: @hostgroup.id)
|
|
95
|
+
assert_equal 1, @class.hosts_count
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
test 'correctly counts hosts via parent hostgroup' do
|
|
99
|
+
@host.update(hostgroup_id: @hostgroup.id)
|
|
100
|
+
@parent_hg.puppet.puppetclasses << @class
|
|
101
|
+
assert_equal 1, @class.hosts_count
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
test 'correctly counts hosts via hostgroup config group' do
|
|
105
|
+
@host.update(hostgroup_id: @hostgroup.id)
|
|
106
|
+
@hostgroup.puppet.config_groups << @config_group
|
|
107
|
+
assert_equal 1, @class.hosts_count
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
test 'correctly counts hosts via parent hostgroup config group' do
|
|
111
|
+
@host.update(hostgroup_id: @hostgroup.id)
|
|
112
|
+
@parent_hg.puppet.config_groups << @config_group
|
|
113
|
+
assert_equal 1, @class.hosts_count
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
test 'only count host once even if it has multiple connections to puppetclass' do
|
|
117
|
+
@host.puppet.puppetclasses << @class
|
|
118
|
+
@host.puppet.config_groups << @config_group
|
|
119
|
+
@hostgroup.puppet.puppetclasses << @class
|
|
120
|
+
@hostgroup.puppet.config_groups << @config_group
|
|
121
|
+
@parent_hg.puppet.puppetclasses << @class
|
|
122
|
+
@parent_hg.puppet.config_groups << @config_group
|
|
123
|
+
@host.update(hostgroup_id: @hostgroup.id)
|
|
124
|
+
assert_equal 1, @class.hosts_count
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
context 'search in puppetclasses' do
|
|
129
|
+
setup do
|
|
130
|
+
@class = FactoryBot.create(:puppetclass)
|
|
131
|
+
@hostgroup = FactoryBot.create(:hostgroup, :with_puppet_enc, puppetclasses: [@class])
|
|
132
|
+
@config_group = FactoryBot.create(:config_group, puppetclasses: [@class])
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
test 'search for puppetclass by hostgroup' do
|
|
136
|
+
assert_includes(Puppetclass.search_for("hostgroup = #{@hostgroup.to_label}"), @class)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
test 'search for puppetclass by config_group' do
|
|
140
|
+
assert_includes(Puppetclass.search_for("config_group = #{@config_group.to_label}"), @class)
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require 'test_puppet_helper'
|
|
2
|
+
|
|
3
|
+
module ForemanPuppet
|
|
4
|
+
class SmartProxyTest < ActiveSupport::TestCase
|
|
5
|
+
let(:proxy) { FactoryBot.create(:puppet_smart_proxy) }
|
|
6
|
+
|
|
7
|
+
test 'should return environment stats' do
|
|
8
|
+
ProxyAPI::Puppet.any_instance.expects(:environments).returns(%w[env1 env2])
|
|
9
|
+
ProxyAPI::Puppet.any_instance.expects(:class_count).with('env1').returns(1)
|
|
10
|
+
ProxyAPI::Puppet.any_instance.expects(:class_count).with('env2').returns(2)
|
|
11
|
+
assert_equal({ 'env1' => 1, 'env2' => 2 }, proxy.statuses[:puppet].environment_stats)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
describe 'older v1 api' do
|
|
15
|
+
before do
|
|
16
|
+
ProxyAPI::V2::Features.any_instance.stubs(:features).raises(NotImplementedError.new('not supported'))
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
test 'can count connected hosts' do
|
|
20
|
+
FactoryBot.create(:host, :with_puppet_enc, :with_environment, puppet_proxy: proxy)
|
|
21
|
+
|
|
22
|
+
as_admin do
|
|
23
|
+
assert_equal 1, proxy.hosts_count
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|