hybrid_platforms_conductor 32.16.4 → 33.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +42 -0
- data/README.md +6 -3
- data/bin/check-node +0 -1
- data/bin/deploy +0 -1
- data/bin/get_impacted_nodes +0 -1
- data/bin/last_deploys +12 -8
- data/bin/nodes_to_deploy +6 -6
- data/bin/setup +6 -6
- data/bin/topograph +1 -1
- data/docs/config_dsl.md +45 -1
- data/docs/executables.md +6 -7
- data/docs/executables/check-node.md +3 -3
- data/docs/executables/deploy.md +3 -3
- data/docs/executables/dump_nodes_json.md +3 -3
- data/docs/executables/test.md +3 -3
- data/docs/executables/topograph.md +3 -3
- data/docs/gen/mermaid/README.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/check-node.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/deploy.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/free_ips.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/get_impacted_nodes.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/last_deploys.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/nodes_to_deploy.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/report.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/run.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/ssh_config.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/test.md-0.png +0 -0
- data/docs/plugins.md +47 -0
- data/docs/plugins/connector/ssh.md +1 -1
- data/docs/plugins/log/remote_fs.md +26 -0
- data/docs/plugins/secrets_reader/cli.md +31 -0
- data/docs/plugins/secrets_reader/thycotic.md +46 -0
- data/docs/plugins/test/bitbucket_conf.md +1 -1
- data/docs/plugins/test/check_deploy_and_idempotence.md +1 -1
- data/docs/plugins/test/connection.md +1 -0
- data/docs/plugins/test/deploy_removes_root_access.md +1 -1
- data/docs/plugins/test/file_system.md +1 -0
- data/docs/plugins/test/github_ci.md +48 -0
- data/docs/plugins/test/hostname.md +1 -0
- data/docs/plugins/test/ip.md +1 -0
- data/docs/plugins/test/jenkins_ci_conf.md +1 -1
- data/docs/plugins/test/jenkins_ci_masters_ok.md +1 -1
- data/docs/plugins/test/local_users.md +1 -0
- data/docs/plugins/test/mounts.md +1 -0
- data/docs/plugins/test/orphan_files.md +1 -0
- data/docs/plugins/test/ports.md +1 -0
- data/docs/plugins/test/spectre.md +1 -0
- data/docs/plugins/test/vulnerabilities.md +1 -0
- data/lib/hybrid_platforms_conductor/action.rb +4 -4
- data/lib/hybrid_platforms_conductor/actions_executor.rb +45 -43
- data/lib/hybrid_platforms_conductor/bitbucket.rb +5 -4
- data/lib/hybrid_platforms_conductor/cmd_runner.rb +13 -12
- data/lib/hybrid_platforms_conductor/cmdb.rb +2 -2
- data/lib/hybrid_platforms_conductor/common_config_dsl/bitbucket.rb +2 -1
- data/lib/hybrid_platforms_conductor/common_config_dsl/confluence.rb +2 -1
- data/lib/hybrid_platforms_conductor/common_config_dsl/file_system_tests.rb +5 -4
- data/lib/hybrid_platforms_conductor/common_config_dsl/github.rb +63 -0
- data/lib/hybrid_platforms_conductor/common_config_dsl/idempotence_tests.rb +2 -2
- data/lib/hybrid_platforms_conductor/config.rb +7 -4
- data/lib/hybrid_platforms_conductor/confluence.rb +1 -1
- data/lib/hybrid_platforms_conductor/connector.rb +5 -2
- data/lib/hybrid_platforms_conductor/core_extensions/symbol/zero.rb +24 -0
- data/lib/hybrid_platforms_conductor/credentials.rb +39 -36
- data/lib/hybrid_platforms_conductor/current_dir_monitor.rb +4 -1
- data/lib/hybrid_platforms_conductor/deployer.rb +275 -224
- data/lib/hybrid_platforms_conductor/executable.rb +20 -15
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/config.rb +10 -7
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_ip.rb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_keys.rb +2 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/platform_handlers.rb +4 -4
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/local.rb +2 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/ssh.rb +45 -49
- data/lib/hybrid_platforms_conductor/hpc_plugins/log/my_log_plugin.rb.sample +100 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/log/remote_fs.rb +180 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef.rb +68 -66
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/dsl_parser.rb +13 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/recipes_tree_builder.rb +39 -38
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/yaml_inventory.rb +5 -4
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/docker.rb +43 -45
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/podman.rb +18 -20
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox.rb +118 -117
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/proxmox_waiter.rb +39 -43
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/reserve_proxmox_container +9 -13
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/confluence.rb +2 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/mediawiki.rb +28 -21
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb +26 -22
- data/lib/hybrid_platforms_conductor/hpc_plugins/secrets_reader/cli.rb +77 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/secrets_reader/my_secrets_reader_plugin.rb.sample +46 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/secrets_reader/thycotic.rb +90 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/bitbucket_conf.rb +3 -3
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/check_deploy_and_idempotence.rb +4 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/connection.rb +3 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_freshness.rb +7 -21
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_removes_root_access.rb +21 -19
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/divergence.rb +2 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/executables.rb +2 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system.rb +21 -22
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system_hdfs.rb +19 -21
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/github_ci.rb +31 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/hostname.rb +3 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/idempotence.rb +2 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb +4 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_conf.rb +21 -22
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_masters_ok.rb +10 -12
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/linear_strategy.rb +9 -9
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/local_users.rb +5 -3
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/mounts.rb +5 -3
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/orphan_files.rb +13 -10
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/ports.rb +5 -3
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/private_ips.rb +5 -5
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/public_ips.rb +5 -5
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/spectre.rb +7 -7
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/veids.rb +3 -3
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/vulnerabilities.rb +27 -25
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/confluence.rb +2 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/stdout.rb +8 -6
- data/lib/hybrid_platforms_conductor/io_router.rb +14 -13
- data/lib/hybrid_platforms_conductor/json_dumper.rb +2 -2
- data/lib/hybrid_platforms_conductor/log.rb +31 -0
- data/lib/hybrid_platforms_conductor/logger_helpers.rb +19 -16
- data/lib/hybrid_platforms_conductor/nodes_handler.rb +89 -71
- data/lib/hybrid_platforms_conductor/parallel_threads.rb +7 -11
- data/lib/hybrid_platforms_conductor/platform_handler.rb +7 -7
- data/lib/hybrid_platforms_conductor/platforms_handler.rb +5 -3
- data/lib/hybrid_platforms_conductor/plugin.rb +2 -2
- data/lib/hybrid_platforms_conductor/plugins.rb +14 -8
- data/lib/hybrid_platforms_conductor/provisioner.rb +4 -4
- data/lib/hybrid_platforms_conductor/report.rb +2 -2
- data/lib/hybrid_platforms_conductor/reports_handler.rb +3 -2
- data/lib/hybrid_platforms_conductor/secrets_reader.rb +31 -0
- data/lib/hybrid_platforms_conductor/services_handler.rb +32 -29
- data/lib/hybrid_platforms_conductor/test_only_remote_node.rb +18 -0
- data/lib/hybrid_platforms_conductor/test_report.rb +15 -18
- data/lib/hybrid_platforms_conductor/tests_runner.rb +116 -118
- data/lib/hybrid_platforms_conductor/thycotic.rb +28 -19
- data/lib/hybrid_platforms_conductor/topographer.rb +200 -190
- data/lib/hybrid_platforms_conductor/topographer/plugins/graphviz.rb +8 -8
- data/lib/hybrid_platforms_conductor/topographer/plugins/json.rb +4 -4
- data/lib/hybrid_platforms_conductor/version.rb +1 -1
- data/spec/hybrid_platforms_conductor_test.rb +33 -12
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb +16 -11
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/interactive_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/remote_bash_spec.rb +23 -18
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/ruby_spec.rb +67 -49
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/scp_spec.rb +20 -14
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions_spec.rb +63 -50
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connection_spec.rb +35 -35
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/local/connectable_nodes_spec.rb +12 -8
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/local/remote_actions_spec.rb +4 -7
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/cli_options_spec.rb +21 -22
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/config_dsl_spec.rb +23 -24
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connectable_nodes_spec.rb +10 -6
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connections_spec.rb +73 -54
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/global_helpers_spec.rb +145 -126
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/node_helpers_spec.rb +3 -3
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/remote_actions_spec.rb +29 -25
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/logging_spec.rb +106 -91
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/parallel_spec.rb +272 -244
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/timeout_spec.rb +10 -12
- data/spec/hybrid_platforms_conductor_test/api/cmd_runner_spec.rb +36 -36
- data/spec/hybrid_platforms_conductor_test/api/config_spec.rb +24 -22
- data/spec/hybrid_platforms_conductor_test/api/deployer/check_spec.rb +4 -2
- data/spec/hybrid_platforms_conductor_test/api/deployer/config_dsl_spec.rb +43 -5
- data/spec/hybrid_platforms_conductor_test/api/deployer/deploy_spec.rb +199 -216
- data/spec/hybrid_platforms_conductor_test/api/deployer/log_plugins/remote_fs_spec.rb +223 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/parse_deploy_output_spec.rb +55 -59
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioner_spec.rb +36 -62
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/podman_spec.rb +17 -17
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/config_dsl_spec.rb +4 -4
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/create_spec.rb +44 -51
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/destroy_spec.rb +3 -3
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb +12 -16
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/destroy_vm_spec.rb +31 -19
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/expired_containers_spec.rb +324 -266
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/ips_assignment_spec.rb +89 -61
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/other_lxc_containers_resources_spec.rb +117 -93
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/pve_node_resources_spec.rb +71 -54
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/retries_spec.rb +10 -8
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/vm_ids_assignment_spec.rb +80 -60
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/start_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/stop_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/deployer/secrets_reader_plugins/cli_spec.rb +64 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/secrets_reader_plugins/thycotic_spec.rb +268 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/config_spec.rb +8 -10
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/host_ip_spec.rb +33 -24
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/host_keys_spec.rb +64 -51
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/platform_handlers_spec.rb +3 -3
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs_plugins_api_spec.rb +50 -51
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/common_spec.rb +91 -81
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/config_dsl_spec.rb +14 -16
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/git_diff_impacts_spec.rb +51 -75
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/nodes_selectors_spec.rb +35 -26
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/platform_handlers_plugins_api_spec.rb +24 -16
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb +29 -19
- data/spec/hybrid_platforms_conductor_test/api/platform_handler_spec.rb +4 -4
- data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/config_dsl_spec.rb +2 -2
- data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/deploy_output_parsing_spec.rb +6 -6
- data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/diff_impacts_spec.rb +57 -99
- data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/inventory_spec.rb +4 -4
- data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/packaging_spec.rb +32 -35
- data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/services_deployment_spec.rb +10 -10
- data/spec/hybrid_platforms_conductor_test/api/platforms_handler_spec.rb +38 -27
- data/spec/hybrid_platforms_conductor_test/api/plugins_spec.rb +46 -52
- data/spec/hybrid_platforms_conductor_test/api/reports_handler_spec.rb +2 -2
- data/spec/hybrid_platforms_conductor_test/api/services_handler/actions_to_deploy_spec.rb +90 -58
- data/spec/hybrid_platforms_conductor_test/api/services_handler/deploy_allowed_spec.rb +38 -34
- data/spec/hybrid_platforms_conductor_test/api/services_handler/log_info_spec.rb +11 -9
- data/spec/hybrid_platforms_conductor_test/api/services_handler/package_spec.rb +193 -171
- data/spec/hybrid_platforms_conductor_test/api/services_handler/parse_deploy_output_spec.rb +66 -54
- data/spec/hybrid_platforms_conductor_test/api/services_handler/prepare_for_deploy_spec.rb +147 -133
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/common_spec.rb +69 -49
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/global_spec.rb +5 -4
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_check_spec.rb +8 -5
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_spec.rb +8 -5
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_ssh_spec.rb +30 -27
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/platform_spec.rb +12 -9
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/reports_spec.rb +48 -47
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_plugins/bitbucket_conf_spec.rb +5 -5
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_plugins/github_ci_spec.rb +72 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_reports_plugins/confluence_spec.rb +5 -5
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb.rb +9 -9
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/{test_cmdb2.rb → test_cmdb_2.rb} +6 -6
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_others.rb +3 -3
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/{test_cmdb_others2.rb → test_cmdb_others_2.rb} +2 -2
- data/spec/hybrid_platforms_conductor_test/docs_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/executables/{check-node_spec.rb → check_node_spec.rb} +4 -6
- data/spec/hybrid_platforms_conductor_test/executables/deploy_spec.rb +4 -6
- data/spec/hybrid_platforms_conductor_test/executables/get_impacted_nodes_spec.rb +76 -77
- data/spec/hybrid_platforms_conductor_test/executables/last_deploys_spec.rb +159 -113
- data/spec/hybrid_platforms_conductor_test/executables/nodes_to_deploy_spec.rb +299 -160
- data/spec/hybrid_platforms_conductor_test/executables/options/actions_executor_spec.rb +4 -6
- data/spec/hybrid_platforms_conductor_test/executables/options/cmd_runner_spec.rb +3 -5
- data/spec/hybrid_platforms_conductor_test/executables/options/common_spec.rb +8 -8
- data/spec/hybrid_platforms_conductor_test/executables/options/deployer_spec.rb +12 -196
- data/spec/hybrid_platforms_conductor_test/executables/options/nodes_handler_spec.rb +9 -10
- data/spec/hybrid_platforms_conductor_test/executables/options/nodes_selectors_spec.rb +9 -10
- data/spec/hybrid_platforms_conductor_test/executables/options/reports_handler_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/executables/options/tests_runner_spec.rb +22 -22
- data/spec/hybrid_platforms_conductor_test/executables/report_spec.rb +22 -16
- data/spec/hybrid_platforms_conductor_test/executables/run_spec.rb +32 -32
- data/spec/hybrid_platforms_conductor_test/executables/ssh_config_spec.rb +7 -9
- data/spec/hybrid_platforms_conductor_test/executables/test_spec.rb +3 -5
- data/spec/hybrid_platforms_conductor_test/helpers/actions_executor_helpers.rb +2 -2
- data/spec/hybrid_platforms_conductor_test/helpers/cmd_runner_helpers.rb +4 -3
- data/spec/hybrid_platforms_conductor_test/helpers/cmdb_helpers.rb +2 -2
- data/spec/hybrid_platforms_conductor_test/helpers/config_helpers.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/helpers/connector_ssh_helpers.rb +12 -13
- data/spec/hybrid_platforms_conductor_test/helpers/deployer_helpers.rb +245 -56
- data/spec/hybrid_platforms_conductor_test/helpers/executables_helpers.rb +11 -11
- data/spec/hybrid_platforms_conductor_test/helpers/nodes_handler_helpers.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/helpers/platforms_handler_helpers.rb +39 -28
- data/spec/hybrid_platforms_conductor_test/helpers/plugins_helpers.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/helpers/provisioner_proxmox_helpers.rb +86 -111
- data/spec/hybrid_platforms_conductor_test/helpers/reports_handler_helpers.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/helpers/serverless_chef_helpers.rb +3 -3
- data/spec/hybrid_platforms_conductor_test/helpers/services_handler_helpers.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/helpers/tests_runner_helpers.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem/hpc_plugins/test_plugin_type/{test_plugin_id1.rb → test_plugin_id_1.rb} +0 -0
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem/hpc_plugins/test_plugin_type/{test_plugin_id2.rb → test_plugin_id_2.rb} +0 -0
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem2/sub_dir/hpc_plugins/test_plugin_type/{test_plugin_id3.rb → test_plugin_id_3.rb} +0 -0
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem2/sub_dir/hpc_plugins/{test_plugin_type2/test_plugin_id4.rb → test_plugin_type_2/test_plugin_id_4.rb} +0 -0
- data/spec/hybrid_platforms_conductor_test/platform_handler_plugins/test.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/platform_handler_plugins/{test2.rb → test_2.rb} +0 -0
- data/spec/hybrid_platforms_conductor_test/rubocop_spec.rb +31 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/1_node/nodes/node.json +3 -3
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/data_bags/nodes/node.json +3 -3
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/recipes/cookbooks/test_cookbook_2/libraries/default.rb +1 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/several_cookbooks/other_cookbooks/test_cookbook_2/libraries/default.rb +1 -0
- data/spec/hybrid_platforms_conductor_test/shared_examples/deployer.rb +952 -0
- data/spec/hybrid_platforms_conductor_test/test_connector.rb +3 -3
- data/spec/hybrid_platforms_conductor_test/test_log_no_read_plugin.rb +84 -0
- data/spec/hybrid_platforms_conductor_test/test_log_plugin.rb +105 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/global.rb +1 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/node.rb +1 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/node_check.rb +1 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/platform.rb +1 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/several_checks.rb +2 -2
- data/spec/hybrid_platforms_conductor_test/test_secrets_reader_plugin.rb +45 -0
- data/spec/hybrid_platforms_conductor_test/tests_report_plugin.rb +5 -6
- data/spec/spec_helper.rb +17 -18
- data/tools/check_md +16 -20
- data/tools/generate_mermaid +1 -1
- metadata +82 -13
- data/spec/hybrid_platforms_conductor_test/helpers/deployer_test_helpers.rb +0 -916
@@ -2,21 +2,23 @@ require 'hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox'
|
|
2
2
|
|
3
3
|
describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
4
4
|
|
5
|
-
context 'checking the reserve_proxmox_container sync tool' do
|
5
|
+
context 'when checking the reserve_proxmox_container sync tool' do
|
6
6
|
|
7
|
-
context 'checking expiration strategy for containers' do
|
7
|
+
context 'when checking expiration strategy for containers' do
|
8
8
|
|
9
9
|
it 'does not expire a VM when there are enough free resources on a PVE node' do
|
10
10
|
with_sync_node do
|
11
|
-
mock_proxmox(
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
mock_proxmox(
|
12
|
+
mocked_pve_nodes: {
|
13
|
+
'pve_node_name' => {
|
14
|
+
memory_total: 4 * 1024 * 1024 * 1024,
|
15
|
+
lxc_containers: {
|
16
|
+
# Make sure it is expired
|
17
|
+
1000 => { ip: '192.168.0.100', maxmem: 1024 * 1024 * 1024, creation_date: (Time.now - 31 * 24 * 60 * 60).utc }
|
18
|
+
}
|
17
19
|
}
|
18
20
|
}
|
19
|
-
|
21
|
+
)
|
20
22
|
expect(call_reserve_proxmox_container(2, 1024, 1)).to eq(
|
21
23
|
pve_node: 'pve_node_name',
|
22
24
|
vm_id: 1001,
|
@@ -28,15 +30,17 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
28
30
|
it 'expires a VM when there are not enough free resources on a PVE node' do
|
29
31
|
with_sync_node do
|
30
32
|
creation_date = (Time.now - 31 * 24 * 60 * 60).utc
|
31
|
-
mock_proxmox(
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
33
|
+
mock_proxmox(
|
34
|
+
mocked_pve_nodes: {
|
35
|
+
'pve_node_name' => {
|
36
|
+
memory_total: 4 * 1024 * 1024 * 1024,
|
37
|
+
lxc_containers: {
|
38
|
+
# Make sure it is expired
|
39
|
+
1000 => { ip: '192.168.0.100', maxmem: 4 * 1024 * 1024 * 1024, creation_date: creation_date }
|
40
|
+
}
|
37
41
|
}
|
38
42
|
}
|
39
|
-
|
43
|
+
)
|
40
44
|
expect(call_reserve_proxmox_container(2, 1024, 1)).to eq(
|
41
45
|
pve_node: 'pve_node_name',
|
42
46
|
vm_id: 1000,
|
@@ -61,26 +65,28 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
61
65
|
}
|
62
66
|
]
|
63
67
|
]
|
64
|
-
expect(Time.parse(
|
68
|
+
expect(Time.parse(proxmox_actions[2][2]['description'].match(/^===== HPC info =====\nnode: test_node\nenvironment: test_env\ncreation_date: (.+)\n/)[1])).to be > creation_date
|
65
69
|
end
|
66
70
|
end
|
67
71
|
|
68
72
|
it 'expires a VM without stopping it when there are not enough free resources on a PVE node and the VM is not running' do
|
69
73
|
with_sync_node do
|
70
|
-
mock_proxmox(
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
74
|
+
mock_proxmox(
|
75
|
+
mocked_pve_nodes: {
|
76
|
+
'pve_node_name' => {
|
77
|
+
memory_total: 4 * 1024 * 1024 * 1024,
|
78
|
+
lxc_containers: {
|
79
|
+
1000 => {
|
80
|
+
ip: '192.168.0.100',
|
81
|
+
maxmem: 4 * 1024 * 1024 * 1024,
|
82
|
+
status: 'stopped',
|
83
|
+
# Make sure it is expired
|
84
|
+
creation_date: (Time.now - 31 * 24 * 60 * 60).utc
|
85
|
+
}
|
80
86
|
}
|
81
87
|
}
|
82
88
|
}
|
83
|
-
|
89
|
+
)
|
84
90
|
expect(call_reserve_proxmox_container(2, 1024, 1)).to eq(
|
85
91
|
pve_node: 'pve_node_name',
|
86
92
|
vm_id: 1000,
|
@@ -105,16 +111,18 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
105
111
|
|
106
112
|
it 'reuses the IP address and VM IDs of an expired VM when there are not enough free resources on a PVE node' do
|
107
113
|
with_sync_node do
|
108
|
-
mock_proxmox(
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
114
|
+
mock_proxmox(
|
115
|
+
mocked_pve_nodes: {
|
116
|
+
'pve_node_name' => {
|
117
|
+
memory_total: 8 * 1024 * 1024 * 1024,
|
118
|
+
lxc_containers: {
|
119
|
+
1000 => { ip: '192.168.0.100', maxmem: 2 * 1024 * 1024 * 1024, creation_date: Time.now.utc },
|
120
|
+
1001 => { ip: '192.168.0.101', maxmem: 4 * 1024 * 1024 * 1024, creation_date: (Time.now - 31 * 24 * 60 * 60).utc },
|
121
|
+
1002 => { ip: '192.168.0.102', maxmem: 2 * 1024 * 1024 * 1024, creation_date: Time.now.utc }
|
122
|
+
}
|
115
123
|
}
|
116
124
|
}
|
117
|
-
|
125
|
+
)
|
118
126
|
expect(call_reserve_proxmox_container(2, 1024, 1)).to eq(
|
119
127
|
pve_node: 'pve_node_name',
|
120
128
|
vm_id: 1001,
|
@@ -140,42 +148,49 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
140
148
|
|
141
149
|
it 'does not try to expire expired VMs when the freed resources would not be enough anyway for the new container' do
|
142
150
|
with_sync_node do
|
143
|
-
mock_proxmox(
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
151
|
+
mock_proxmox(
|
152
|
+
mocked_pve_nodes: {
|
153
|
+
'pve_node_name' => {
|
154
|
+
memory_total: 6 * 1024 * 1024 * 1024,
|
155
|
+
lxc_containers: {
|
156
|
+
1000 => { ip: '192.168.0.100', maxmem: 2 * 1024 * 1024 * 1024, creation_date: Time.now.utc },
|
157
|
+
1001 => { ip: '192.168.0.101', maxmem: 2 * 1024 * 1024 * 1024, creation_date: (Time.now - 31 * 24 * 60 * 60).utc },
|
158
|
+
1002 => { ip: '192.168.0.102', maxmem: 2 * 1024 * 1024 * 1024, creation_date: Time.now.utc }
|
159
|
+
}
|
150
160
|
}
|
151
161
|
}
|
152
|
-
|
153
|
-
expect(
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
162
|
+
)
|
163
|
+
expect(
|
164
|
+
call_reserve_proxmox_container(
|
165
|
+
2, 1024, 1,
|
166
|
+
config: {
|
167
|
+
vm_ips_list: %w[
|
168
|
+
192.168.0.100
|
169
|
+
192.168.0.101
|
170
|
+
192.168.0.102
|
171
|
+
192.168.0.103
|
172
|
+
]
|
173
|
+
}
|
174
|
+
)
|
175
|
+
).to eq(error: 'not_enough_resources')
|
163
176
|
expect_proxmox_actions_to_be []
|
164
177
|
end
|
165
178
|
end
|
166
179
|
|
167
180
|
it 'expires all expired containers of a PVE node if needed' do
|
168
181
|
with_sync_node do
|
169
|
-
mock_proxmox(
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
182
|
+
mock_proxmox(
|
183
|
+
mocked_pve_nodes: {
|
184
|
+
'pve_node_name' => {
|
185
|
+
memory_total: 8 * 1024 * 1024 * 1024,
|
186
|
+
lxc_containers: {
|
187
|
+
1000 => { ip: '192.168.0.100', maxmem: 2 * 1024 * 1024 * 1024, creation_date: Time.now.utc },
|
188
|
+
1001 => { ip: '192.168.0.101', maxmem: 4 * 1024 * 1024 * 1024, creation_date: (Time.now - 31 * 24 * 60 * 60).utc },
|
189
|
+
1002 => { ip: '192.168.0.102', maxmem: 2 * 1024 * 1024 * 1024, creation_date: (Time.now - 31 * 24 * 60 * 60).utc }
|
190
|
+
}
|
176
191
|
}
|
177
192
|
}
|
178
|
-
|
193
|
+
)
|
179
194
|
expect(call_reserve_proxmox_container(2, 1024, 1)).to eq(
|
180
195
|
pve_node: 'pve_node_name',
|
181
196
|
vm_id: 1001,
|
@@ -203,16 +218,18 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
203
218
|
|
204
219
|
it 'does not expire containers that don\'t belong to the VM IDs range' do
|
205
220
|
with_sync_node do
|
206
|
-
mock_proxmox(
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
221
|
+
mock_proxmox(
|
222
|
+
mocked_pve_nodes: {
|
223
|
+
'pve_node_name' => {
|
224
|
+
memory_total: 8 * 1024 * 1024 * 1024,
|
225
|
+
lxc_containers: {
|
226
|
+
1000 => { ip: '192.168.0.100', maxmem: 2 * 1024 * 1024 * 1024, creation_date: Time.now.utc },
|
227
|
+
1001 => { ip: '192.168.0.101', maxmem: 4 * 1024 * 1024 * 1024, creation_date: (Time.now - 31 * 24 * 60 * 60).utc },
|
228
|
+
2002 => { ip: '192.168.0.102', maxmem: 2 * 1024 * 1024 * 1024, creation_date: (Time.now - 31 * 24 * 60 * 60).utc }
|
229
|
+
}
|
213
230
|
}
|
214
231
|
}
|
215
|
-
|
232
|
+
)
|
216
233
|
expect(call_reserve_proxmox_container(2, 1024, 1)).to eq(
|
217
234
|
pve_node: 'pve_node_name',
|
218
235
|
vm_id: 1001,
|
@@ -238,22 +255,24 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
238
255
|
|
239
256
|
it 'selects a PVE node that still has free resources without expiring VMs even if it would have freed more resources' do
|
240
257
|
with_sync_node do
|
241
|
-
mock_proxmox(
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
258
|
+
mock_proxmox(
|
259
|
+
mocked_pve_nodes: {
|
260
|
+
# Expiring VMs from this node would free a lot of resources
|
261
|
+
'pve_node_1' => {
|
262
|
+
memory_total: 16 * 1024 * 1024 * 1024,
|
263
|
+
lxc_containers: {
|
264
|
+
1000 => { ip: '192.168.0.100', maxmem: 14 * 1024 * 1024 * 1024, creation_date: (Time.now - 31 * 24 * 60 * 60).utc }
|
265
|
+
}
|
266
|
+
},
|
267
|
+
# But this node has still a bit of resources left without expiring VMs
|
268
|
+
'pve_node_2' => {
|
269
|
+
memory_total: 16 * 1024 * 1024 * 1024,
|
270
|
+
lxc_containers: {
|
271
|
+
1001 => { ip: '192.168.0.101', maxmem: 10 * 1024 * 1024 * 1024, creation_date: (Time.now - 31 * 24 * 60 * 60).utc }
|
272
|
+
}
|
254
273
|
}
|
255
274
|
}
|
256
|
-
|
275
|
+
)
|
257
276
|
expect(call_reserve_proxmox_container(2, 1024, 1, config: { pve_nodes: nil })).to eq(
|
258
277
|
pve_node: 'pve_node_2',
|
259
278
|
vm_id: 1002,
|
@@ -277,34 +296,39 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
277
296
|
|
278
297
|
it 'selects the PVE node that would have the more resources free after expiration when no other PVE node has free resources' do
|
279
298
|
with_sync_node do
|
280
|
-
mock_proxmox(
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
299
|
+
mock_proxmox(
|
300
|
+
mocked_pve_nodes: {
|
301
|
+
'pve_node_1' => {
|
302
|
+
memory_total: 16 * 1024 * 1024 * 1024,
|
303
|
+
lxc_containers: {
|
304
|
+
1000 => { ip: '192.168.0.100', maxmem: 8 * 1024 * 1024 * 1024, creation_date: Time.now.utc },
|
305
|
+
1001 => { ip: '192.168.0.101', maxmem: 6 * 1024 * 1024 * 1024, creation_date: (Time.now - 31 * 24 * 60 * 60).utc }
|
306
|
+
}
|
307
|
+
},
|
308
|
+
'pve_node_2' => {
|
309
|
+
memory_total: 16 * 1024 * 1024 * 1024,
|
310
|
+
lxc_containers: {
|
311
|
+
1002 => { ip: '192.168.0.102', maxmem: 10 * 1024 * 1024 * 1024, creation_date: Time.now.utc },
|
312
|
+
1003 => { ip: '192.168.0.103', maxmem: 4 * 1024 * 1024 * 1024, creation_date: (Time.now - 31 * 24 * 60 * 60).utc }
|
313
|
+
}
|
293
314
|
}
|
294
315
|
}
|
295
|
-
|
296
|
-
expect(
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
316
|
+
)
|
317
|
+
expect(
|
318
|
+
call_reserve_proxmox_container(
|
319
|
+
2, 1024, 1,
|
320
|
+
config: {
|
321
|
+
pve_nodes: nil,
|
322
|
+
vm_ips_list: %w[
|
323
|
+
192.168.0.100
|
324
|
+
192.168.0.101
|
325
|
+
192.168.0.102
|
326
|
+
192.168.0.103
|
327
|
+
192.168.0.104
|
328
|
+
]
|
329
|
+
}
|
330
|
+
)
|
331
|
+
).to eq(
|
308
332
|
pve_node: 'pve_node_1',
|
309
333
|
vm_id: 1001,
|
310
334
|
vm_ip: '192.168.0.101'
|
@@ -329,25 +353,30 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
329
353
|
|
330
354
|
it 'expires VMs even if free resources are available when IPs are all used' do
|
331
355
|
with_sync_node do
|
332
|
-
mock_proxmox(
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
356
|
+
mock_proxmox(
|
357
|
+
mocked_pve_nodes: {
|
358
|
+
'pve_node_name' => {
|
359
|
+
memory_total: 16 * 1024 * 1024 * 1024,
|
360
|
+
lxc_containers: {
|
361
|
+
1000 => { ip: '192.168.0.100', maxmem: 1 * 1024 * 1024 * 1024, creation_date: Time.now.utc },
|
362
|
+
1001 => { ip: '192.168.0.101', maxmem: 1 * 1024 * 1024 * 1024, creation_date: (Time.now - 31 * 24 * 60 * 60).utc },
|
363
|
+
1002 => { ip: '192.168.0.102', maxmem: 1 * 1024 * 1024 * 1024, creation_date: Time.now.utc }
|
364
|
+
}
|
339
365
|
}
|
340
366
|
}
|
341
|
-
|
342
|
-
expect(
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
367
|
+
)
|
368
|
+
expect(
|
369
|
+
call_reserve_proxmox_container(
|
370
|
+
2, 1024, 1,
|
371
|
+
config: {
|
372
|
+
vm_ips_list: %w[
|
373
|
+
192.168.0.100
|
374
|
+
192.168.0.101
|
375
|
+
192.168.0.102
|
376
|
+
]
|
377
|
+
}
|
378
|
+
)
|
379
|
+
).to eq(
|
351
380
|
pve_node: 'pve_node_name',
|
352
381
|
vm_id: 1001,
|
353
382
|
vm_ip: '192.168.0.101'
|
@@ -372,33 +401,38 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
372
401
|
|
373
402
|
it 'expires VMs from non-selected PVE nodes even if free resources are available when IPs are all used' do
|
374
403
|
with_sync_node do
|
375
|
-
mock_proxmox(
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
404
|
+
mock_proxmox(
|
405
|
+
mocked_pve_nodes: {
|
406
|
+
# Make sure this node should be selected
|
407
|
+
'pve_node_1' => {
|
408
|
+
memory_total: 16 * 1024 * 1024 * 1024,
|
409
|
+
lxc_containers: {
|
410
|
+
1000 => { ip: '192.168.0.100', maxmem: 1 * 1024 * 1024 * 1024, creation_date: Time.now.utc },
|
411
|
+
1002 => { ip: '192.168.0.102', maxmem: 1 * 1024 * 1024 * 1024, creation_date: Time.now.utc }
|
412
|
+
}
|
413
|
+
},
|
414
|
+
# But this node is the only one having expired VMs
|
415
|
+
'pve_node_2' => {
|
416
|
+
memory_total: 2 * 1024 * 1024 * 1024,
|
417
|
+
lxc_containers: {
|
418
|
+
1001 => { ip: '192.168.0.101', maxmem: 1 * 1024 * 1024 * 1024, creation_date: (Time.now - 31 * 24 * 60 * 60).utc }
|
419
|
+
}
|
389
420
|
}
|
390
421
|
}
|
391
|
-
|
392
|
-
expect(
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
422
|
+
)
|
423
|
+
expect(
|
424
|
+
call_reserve_proxmox_container(
|
425
|
+
2, 1024, 1,
|
426
|
+
config: {
|
427
|
+
pve_nodes: nil,
|
428
|
+
vm_ips_list: %w[
|
429
|
+
192.168.0.100
|
430
|
+
192.168.0.101
|
431
|
+
192.168.0.102
|
432
|
+
]
|
433
|
+
}
|
434
|
+
)
|
435
|
+
).to eq(
|
402
436
|
pve_node: 'pve_node_1',
|
403
437
|
vm_id: 1001,
|
404
438
|
vm_ip: '192.168.0.101'
|
@@ -423,27 +457,32 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
423
457
|
|
424
458
|
it 'expires VMs even if free resources are available when VM IDs are all used' do
|
425
459
|
with_sync_node do
|
426
|
-
mock_proxmox(
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
460
|
+
mock_proxmox(
|
461
|
+
mocked_pve_nodes: {
|
462
|
+
'pve_node_name' => {
|
463
|
+
memory_total: 16 * 1024 * 1024 * 1024,
|
464
|
+
lxc_containers: {
|
465
|
+
1000 => { ip: '192.168.0.100', maxmem: 1 * 1024 * 1024 * 1024, creation_date: Time.now.utc },
|
466
|
+
1001 => { ip: '192.168.0.101', maxmem: 1 * 1024 * 1024 * 1024, creation_date: (Time.now - 31 * 24 * 60 * 60).utc },
|
467
|
+
1002 => { ip: '192.168.0.102', maxmem: 1 * 1024 * 1024 * 1024, creation_date: Time.now.utc }
|
468
|
+
}
|
433
469
|
}
|
434
470
|
}
|
435
|
-
|
436
|
-
expect(
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
471
|
+
)
|
472
|
+
expect(
|
473
|
+
call_reserve_proxmox_container(
|
474
|
+
2, 1024, 1,
|
475
|
+
config: {
|
476
|
+
vm_ips_list: %w[
|
477
|
+
192.168.0.100
|
478
|
+
192.168.0.101
|
479
|
+
192.168.0.102
|
480
|
+
192.168.0.103
|
481
|
+
],
|
482
|
+
vm_ids_range: [1000, 1002]
|
483
|
+
}
|
484
|
+
)
|
485
|
+
).to eq(
|
447
486
|
pve_node: 'pve_node_name',
|
448
487
|
vm_id: 1001,
|
449
488
|
vm_ip: '192.168.0.101'
|
@@ -468,35 +507,40 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
468
507
|
|
469
508
|
it 'expires VMs from non-selected PVE nodes even if free resources are available when VM IDs are all used' do
|
470
509
|
with_sync_node do
|
471
|
-
mock_proxmox(
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
510
|
+
mock_proxmox(
|
511
|
+
mocked_pve_nodes: {
|
512
|
+
# Make sure this node should be selected
|
513
|
+
'pve_node_1' => {
|
514
|
+
memory_total: 16 * 1024 * 1024 * 1024,
|
515
|
+
lxc_containers: {
|
516
|
+
1000 => { ip: '192.168.0.100', maxmem: 1 * 1024 * 1024 * 1024, creation_date: Time.now.utc },
|
517
|
+
1002 => { ip: '192.168.0.102', maxmem: 1 * 1024 * 1024 * 1024, creation_date: Time.now.utc }
|
518
|
+
}
|
519
|
+
},
|
520
|
+
# But this node is the only one having expired VMs
|
521
|
+
'pve_node_2' => {
|
522
|
+
memory_total: 2 * 1024 * 1024 * 1024,
|
523
|
+
lxc_containers: {
|
524
|
+
1001 => { ip: '192.168.0.101', maxmem: 1 * 1024 * 1024 * 1024, creation_date: (Time.now - 31 * 24 * 60 * 60).utc }
|
525
|
+
}
|
485
526
|
}
|
486
527
|
}
|
487
|
-
|
488
|
-
expect(
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
528
|
+
)
|
529
|
+
expect(
|
530
|
+
call_reserve_proxmox_container(
|
531
|
+
2, 1024, 1,
|
532
|
+
config: {
|
533
|
+
pve_nodes: nil,
|
534
|
+
vm_ips_list: %w[
|
535
|
+
192.168.0.100
|
536
|
+
192.168.0.101
|
537
|
+
192.168.0.102
|
538
|
+
192.168.0.103
|
539
|
+
],
|
540
|
+
vm_ids_range: [1000, 1002]
|
541
|
+
}
|
542
|
+
)
|
543
|
+
).to eq(
|
500
544
|
pve_node: 'pve_node_1',
|
501
545
|
vm_id: 1001,
|
502
546
|
vm_ip: '192.168.0.101'
|
@@ -521,32 +565,37 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
521
565
|
|
522
566
|
it 'expires VMs even if free resources are available when the maximum number of VMs has been reached' do
|
523
567
|
with_sync_node do
|
524
|
-
mock_proxmox(
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
568
|
+
mock_proxmox(
|
569
|
+
mocked_pve_nodes: {
|
570
|
+
'pve_node_name' => {
|
571
|
+
memory_total: 16 * 1024 * 1024 * 1024,
|
572
|
+
lxc_containers: {
|
573
|
+
1000 => { ip: '192.168.0.100', maxmem: 1 * 1024 * 1024 * 1024, creation_date: Time.now.utc },
|
574
|
+
1001 => { ip: '192.168.0.101', maxmem: 1 * 1024 * 1024 * 1024, creation_date: (Time.now - 31 * 24 * 60 * 60).utc },
|
575
|
+
1002 => { ip: '192.168.0.102', maxmem: 1 * 1024 * 1024 * 1024, creation_date: Time.now.utc }
|
576
|
+
}
|
531
577
|
}
|
532
578
|
}
|
533
|
-
|
534
|
-
expect(
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
579
|
+
)
|
580
|
+
expect(
|
581
|
+
call_reserve_proxmox_container(
|
582
|
+
2, 1024, 1,
|
583
|
+
config: {
|
584
|
+
vm_ips_list: %w[
|
585
|
+
192.168.0.100
|
586
|
+
192.168.0.101
|
587
|
+
192.168.0.102
|
588
|
+
192.168.0.103
|
589
|
+
],
|
590
|
+
limits: {
|
591
|
+
nbr_vms_max: 3,
|
592
|
+
cpu_loads_thresholds: [10, 10, 10],
|
593
|
+
ram_percent_used_max: 0.75,
|
594
|
+
disk_percent_used_max: 0.75
|
595
|
+
}
|
547
596
|
}
|
548
|
-
|
549
|
-
)
|
597
|
+
)
|
598
|
+
).to eq(
|
550
599
|
pve_node: 'pve_node_name',
|
551
600
|
vm_id: 1001,
|
552
601
|
vm_ip: '192.168.0.101'
|
@@ -571,40 +620,45 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
571
620
|
|
572
621
|
it 'expires VMs from non-selected PVE nodes even if free resources are available when the maximum number of VMs has been reached' do
|
573
622
|
with_sync_node do
|
574
|
-
mock_proxmox(
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
623
|
+
mock_proxmox(
|
624
|
+
mocked_pve_nodes: {
|
625
|
+
# Make sure this node should be selected
|
626
|
+
'pve_node_1' => {
|
627
|
+
memory_total: 16 * 1024 * 1024 * 1024,
|
628
|
+
lxc_containers: {
|
629
|
+
1000 => { ip: '192.168.0.100', maxmem: 1 * 1024 * 1024 * 1024, creation_date: Time.now.utc },
|
630
|
+
1002 => { ip: '192.168.0.102', maxmem: 1 * 1024 * 1024 * 1024, creation_date: Time.now.utc }
|
631
|
+
}
|
632
|
+
},
|
633
|
+
# But this node is the only one having expired VMs
|
634
|
+
'pve_node_2' => {
|
635
|
+
memory_total: 2 * 1024 * 1024 * 1024,
|
636
|
+
lxc_containers: {
|
637
|
+
1001 => { ip: '192.168.0.101', maxmem: 1 * 1024 * 1024 * 1024, creation_date: (Time.now - 31 * 24 * 60 * 60).utc }
|
638
|
+
}
|
588
639
|
}
|
589
640
|
}
|
590
|
-
|
591
|
-
expect(
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
641
|
+
)
|
642
|
+
expect(
|
643
|
+
call_reserve_proxmox_container(
|
644
|
+
2, 1024, 1,
|
645
|
+
config: {
|
646
|
+
pve_nodes: nil,
|
647
|
+
vm_ips_list: %w[
|
648
|
+
192.168.0.100
|
649
|
+
192.168.0.101
|
650
|
+
192.168.0.102
|
651
|
+
192.168.0.103
|
652
|
+
],
|
653
|
+
limits: {
|
654
|
+
nbr_vms_max: 3,
|
655
|
+
cpu_loads_thresholds: [10, 10, 10],
|
656
|
+
ram_percent_used_max: 0.75,
|
657
|
+
disk_percent_used_max: 0.75
|
658
|
+
}
|
605
659
|
}
|
606
|
-
|
607
|
-
)
|
660
|
+
)
|
661
|
+
).to eq(
|
608
662
|
pve_node: 'pve_node_1',
|
609
663
|
vm_id: 1001,
|
610
664
|
vm_ip: '192.168.0.101'
|
@@ -629,21 +683,23 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
629
683
|
|
630
684
|
it 'does not expire a VM that is stopped for long time but still used for debug purposes' do
|
631
685
|
with_sync_node do
|
632
|
-
mock_proxmox(
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
686
|
+
mock_proxmox(
|
687
|
+
mocked_pve_nodes: {
|
688
|
+
'pve_node_name' => {
|
689
|
+
memory_total: 4 * 1024 * 1024 * 1024,
|
690
|
+
lxc_containers: {
|
691
|
+
# Make sure it is not expired
|
692
|
+
1000 => {
|
693
|
+
ip: '192.168.0.100',
|
694
|
+
maxmem: 4 * 1024 * 1024 * 1024,
|
695
|
+
creation_date: Time.now.utc,
|
696
|
+
status: 'stopped',
|
697
|
+
debug: true
|
698
|
+
}
|
643
699
|
}
|
644
700
|
}
|
645
701
|
}
|
646
|
-
|
702
|
+
)
|
647
703
|
expect(call_reserve_proxmox_container(2, 1024, 1)).to eq(error: 'not_enough_resources')
|
648
704
|
expect_proxmox_actions_to_be []
|
649
705
|
end
|
@@ -691,7 +747,8 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
691
747
|
|
692
748
|
it 'does not expire a VM that is stopped for some time even when it is not used for debug purposes' do
|
693
749
|
with_sync_node do
|
694
|
-
mock_proxmox(
|
750
|
+
mock_proxmox(
|
751
|
+
mocked_pve_nodes: [{
|
695
752
|
# 2 seconds separate each run.
|
696
753
|
# Make sure the third and later runs mock the container as running instead of stopped
|
697
754
|
'pve_node_name' => {
|
@@ -738,7 +795,8 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
738
795
|
with_sync_node do
|
739
796
|
creation_date_1 = (Time.now - 20).utc
|
740
797
|
creation_date_2 = (Time.now - 10).utc
|
741
|
-
mock_proxmox(
|
798
|
+
mock_proxmox(
|
799
|
+
mocked_pve_nodes: [{
|
742
800
|
# 2 seconds separate each run.
|
743
801
|
# Make sure the third and later runs mock the container as another one, still stopped
|
744
802
|
'pve_node_name' => {
|