hybrid_platforms_conductor 32.16.3 → 33.0.0
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 +4 -4
- data/CHANGELOG.md +42 -0
- data/README.md +6 -3
- data/bin/last_deploys +4 -1
- data/bin/nodes_to_deploy +5 -5
- 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/actions_executor.rb +8 -1
- data/lib/hybrid_platforms_conductor/common_config_dsl/github.rb +62 -0
- data/lib/hybrid_platforms_conductor/deployer.rb +193 -141
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/ssh.rb +3 -3
- 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 +179 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/secrets_reader/cli.rb +75 -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 +87 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/check_deploy_and_idempotence.rb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/connection.rb +3 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_freshness.rb +7 -20
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_removes_root_access.rb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system.rb +2 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/github_ci.rb +32 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/hostname.rb +3 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb +3 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/local_users.rb +3 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/mounts.rb +3 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/orphan_files.rb +3 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/ports.rb +3 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/spectre.rb +3 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/vulnerabilities.rb +2 -1
- data/lib/hybrid_platforms_conductor/log.rb +31 -0
- data/lib/hybrid_platforms_conductor/plugins.rb +1 -0
- data/lib/hybrid_platforms_conductor/secrets_reader.rb +31 -0
- data/lib/hybrid_platforms_conductor/test_only_remote_node.rb +18 -0
- data/lib/hybrid_platforms_conductor/version.rb +1 -1
- data/spec/hybrid_platforms_conductor_test.rb +27 -6
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connections_spec.rb +3 -3
- data/spec/hybrid_platforms_conductor_test/api/deployer/config_dsl_spec.rb +46 -4
- data/spec/hybrid_platforms_conductor_test/api/deployer/deploy_spec.rb +187 -212
- data/spec/hybrid_platforms_conductor_test/api/deployer/log_plugins/remote_fs_spec.rb +223 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioner_spec.rb +4 -4
- data/spec/hybrid_platforms_conductor_test/api/deployer/secrets_reader_plugins/cli_spec.rb +63 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/secrets_reader_plugins/thycotic_spec.rb +253 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/global_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_plugins/github_ci_spec.rb +72 -0
- data/spec/hybrid_platforms_conductor_test/executables/last_deploys_spec.rb +146 -98
- data/spec/hybrid_platforms_conductor_test/executables/nodes_to_deploy_spec.rb +240 -83
- data/spec/hybrid_platforms_conductor_test/executables/options/common_spec.rb +2 -1
- data/spec/hybrid_platforms_conductor_test/executables/options/deployer_spec.rb +0 -182
- data/spec/hybrid_platforms_conductor_test/helpers/connector_ssh_helpers.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/helpers/deployer_helpers.rb +40 -53
- data/spec/hybrid_platforms_conductor_test/helpers/deployer_test_helpers.rb +251 -15
- data/spec/hybrid_platforms_conductor_test/test_log_no_read_plugin.rb +82 -0
- data/spec/hybrid_platforms_conductor_test/test_log_plugin.rb +103 -0
- data/spec/hybrid_platforms_conductor_test/test_secrets_reader_plugin.rb +45 -0
- metadata +41 -2
|
@@ -54,7 +54,7 @@ module HybridPlatformsConductor
|
|
|
54
54
|
instance.stop
|
|
55
55
|
instance.with_running_instance(port: 22) do
|
|
56
56
|
|
|
57
|
-
unless @nodes_handler.get_root_access_allowed_of(@node)
|
|
57
|
+
unless @nodes_handler.get_root_access_allowed_of(@node)
|
|
58
58
|
# ===== Deploy removes root access
|
|
59
59
|
# Check that we can't connect with root
|
|
60
60
|
ssh_ok = false
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require 'hybrid_platforms_conductor/test_only_remote_node'
|
|
2
|
+
|
|
1
3
|
module HybridPlatformsConductor
|
|
2
4
|
|
|
3
5
|
module HpcPlugins
|
|
@@ -5,7 +7,7 @@ module HybridPlatformsConductor
|
|
|
5
7
|
module Test
|
|
6
8
|
|
|
7
9
|
# Test that the connection works by simply outputing something
|
|
8
|
-
class Connection <
|
|
10
|
+
class Connection < TestOnlyRemoteNode
|
|
9
11
|
|
|
10
12
|
TEST_CONNECTION_STRING = 'Test connection - ok'
|
|
11
13
|
|
|
@@ -12,27 +12,14 @@ module HybridPlatformsConductor
|
|
|
12
12
|
MAX_ACCEPTABLE_REFRESH_PERIOD_SECS = 3 * 31 * 24 * 60 * 60 # 3 months
|
|
13
13
|
|
|
14
14
|
# Check my_test_plugin.rb.sample documentation for signature details.
|
|
15
|
-
def
|
|
15
|
+
def test_for_node
|
|
16
16
|
now = Time.now
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
else
|
|
24
|
-
# Expecting following file names
|
|
25
|
-
# node-name_2017-12-01_093418_user-name
|
|
26
|
-
file_match = stdout.first.match(/^#{Regexp.escape(@node)}_(\d{4}-\d{2}-\d{2})_.+$/)
|
|
27
|
-
if file_match.nil?
|
|
28
|
-
error "Invalid chef deployment log file found: #{stdout.first}"
|
|
29
|
-
else
|
|
30
|
-
last_deploy_time = Time.parse(file_match[1])
|
|
31
|
-
error "Last deployment has been done on #{last_deploy_time.strftime('%F')}. Should refresh it." if now - last_deploy_time > MAX_ACCEPTABLE_REFRESH_PERIOD_SECS
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
}
|
|
17
|
+
deploy_info = @deployer.deployment_info_from(@node)[@node]
|
|
18
|
+
if deploy_info.key?(:error)
|
|
19
|
+
error "Error while getting deployment info: #{deploy_info[:error]}"
|
|
20
|
+
elsif Time.now.utc - deploy_info[:deployment_info][:date] > MAX_ACCEPTABLE_REFRESH_PERIOD_SECS
|
|
21
|
+
error "Last deployment has been done on #{deploy_info[:deployment_info][:date].strftime('%F')}. Should refresh it."
|
|
22
|
+
end
|
|
36
23
|
end
|
|
37
24
|
|
|
38
25
|
end
|
|
@@ -12,7 +12,7 @@ module HybridPlatformsConductor
|
|
|
12
12
|
|
|
13
13
|
# Check my_test_plugin.rb.sample documentation for signature details.
|
|
14
14
|
def test_for_node
|
|
15
|
-
unless @nodes_handler.get_root_access_allowed_of(@node)
|
|
15
|
+
unless @nodes_handler.get_root_access_allowed_of(@node)
|
|
16
16
|
@deployer.with_test_provisioned_instance(@config.tests_provisioner_id, @node, environment: 'deploy_removes_root_access', reuse_instance: log_debug?) do |deployer, instance|
|
|
17
17
|
# Check that we can connect with root
|
|
18
18
|
ssh_ok = false
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require 'hybrid_platforms_conductor/test_only_remote_node'
|
|
1
2
|
require 'hybrid_platforms_conductor/common_config_dsl/file_system_tests'
|
|
2
3
|
|
|
3
4
|
module HybridPlatformsConductor
|
|
@@ -7,7 +8,7 @@ module HybridPlatformsConductor
|
|
|
7
8
|
module Test
|
|
8
9
|
|
|
9
10
|
# Perform various tests on a node's file system
|
|
10
|
-
class FileSystem <
|
|
11
|
+
class FileSystem < TestOnlyRemoteNode
|
|
11
12
|
|
|
12
13
|
self.extend_config_dsl_with CommonConfigDsl::FileSystemTests, :init_file_system_tests
|
|
13
14
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
require 'hybrid_platforms_conductor/common_config_dsl/github'
|
|
2
|
+
|
|
3
|
+
module HybridPlatformsConductor
|
|
4
|
+
|
|
5
|
+
module HpcPlugins
|
|
6
|
+
|
|
7
|
+
module Test
|
|
8
|
+
|
|
9
|
+
# Check that all repositories have a successful Github CI
|
|
10
|
+
class GithubCi < HybridPlatformsConductor::Test
|
|
11
|
+
|
|
12
|
+
self.extend_config_dsl_with CommonConfigDsl::Github, :init_github
|
|
13
|
+
|
|
14
|
+
# Check my_test_plugin.rb.sample documentation for signature details.
|
|
15
|
+
def test
|
|
16
|
+
@config.for_each_github_repo do |client, repo_info|
|
|
17
|
+
log_debug "Checking CI for Github repository #{repo_info[:slug]}"
|
|
18
|
+
last_status = client.repository_workflow_runs(repo_info[:slug])[:workflow_runs].
|
|
19
|
+
select { |run| run[:head_branch] == 'master' }.
|
|
20
|
+
sort_by { |run| run[:created_at] }.
|
|
21
|
+
last[:conclusion]
|
|
22
|
+
error "Last workflow status for repository #{repo_info[:slug]} is #{last_status}" unless last_status == 'success'
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require 'hybrid_platforms_conductor/test_only_remote_node'
|
|
2
|
+
|
|
1
3
|
module HybridPlatformsConductor
|
|
2
4
|
|
|
3
5
|
module HpcPlugins
|
|
@@ -5,7 +7,7 @@ module HybridPlatformsConductor
|
|
|
5
7
|
module Test
|
|
6
8
|
|
|
7
9
|
# Test that the hostname is correct
|
|
8
|
-
class Hostname <
|
|
10
|
+
class Hostname < TestOnlyRemoteNode
|
|
9
11
|
|
|
10
12
|
# Check my_test_plugin.rb.sample documentation for signature details.
|
|
11
13
|
def test_on_node
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require 'hybrid_platforms_conductor/test_only_remote_node'
|
|
2
|
+
|
|
1
3
|
module HybridPlatformsConductor
|
|
2
4
|
|
|
3
5
|
module HpcPlugins
|
|
@@ -5,7 +7,7 @@ module HybridPlatformsConductor
|
|
|
5
7
|
module Test
|
|
6
8
|
|
|
7
9
|
# Test that the private IP address is correct
|
|
8
|
-
class Ip <
|
|
10
|
+
class Ip < TestOnlyRemoteNode
|
|
9
11
|
|
|
10
12
|
# Check my_test_plugin.rb.sample documentation for signature details.
|
|
11
13
|
def test_on_node
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require 'hybrid_platforms_conductor/test_only_remote_node'
|
|
2
|
+
|
|
1
3
|
module HybridPlatformsConductor
|
|
2
4
|
|
|
3
5
|
module HpcPlugins
|
|
@@ -5,7 +7,7 @@ module HybridPlatformsConductor
|
|
|
5
7
|
module Test
|
|
6
8
|
|
|
7
9
|
# Test that the node's local users
|
|
8
|
-
class LocalUsers <
|
|
10
|
+
class LocalUsers < TestOnlyRemoteNode
|
|
9
11
|
|
|
10
12
|
# Config DSL extension for this test plugin
|
|
11
13
|
module ConfigDslExtension
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require 'hybrid_platforms_conductor/test_only_remote_node'
|
|
2
|
+
|
|
1
3
|
module HybridPlatformsConductor
|
|
2
4
|
|
|
3
5
|
module HpcPlugins
|
|
@@ -5,7 +7,7 @@ module HybridPlatformsConductor
|
|
|
5
7
|
module Test
|
|
6
8
|
|
|
7
9
|
# Various tests on mounts
|
|
8
|
-
class Mounts <
|
|
10
|
+
class Mounts < TestOnlyRemoteNode
|
|
9
11
|
|
|
10
12
|
# Config DSL extension for this test plugin
|
|
11
13
|
module ConfigDslExtension
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require 'hybrid_platforms_conductor/test_only_remote_node'
|
|
2
|
+
|
|
1
3
|
module HybridPlatformsConductor
|
|
2
4
|
|
|
3
5
|
module HpcPlugins
|
|
@@ -5,7 +7,7 @@ module HybridPlatformsConductor
|
|
|
5
7
|
module Test
|
|
6
8
|
|
|
7
9
|
# Test that the node has no orphan files
|
|
8
|
-
class OrphanFiles <
|
|
10
|
+
class OrphanFiles < TestOnlyRemoteNode
|
|
9
11
|
|
|
10
12
|
# Config DSL extension for this test plugin
|
|
11
13
|
module ConfigDslExtension
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require 'hybrid_platforms_conductor/test_only_remote_node'
|
|
2
|
+
|
|
1
3
|
module HybridPlatformsConductor
|
|
2
4
|
|
|
3
5
|
module HpcPlugins
|
|
@@ -5,7 +7,7 @@ module HybridPlatformsConductor
|
|
|
5
7
|
module Test
|
|
6
8
|
|
|
7
9
|
# Various tests on ports
|
|
8
|
-
class Ports <
|
|
10
|
+
class Ports < TestOnlyRemoteNode
|
|
9
11
|
|
|
10
12
|
# Config DSL extension for this test plugin
|
|
11
13
|
module ConfigDslExtension
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require 'hybrid_platforms_conductor/test_only_remote_node'
|
|
2
|
+
|
|
1
3
|
module HybridPlatformsConductor
|
|
2
4
|
|
|
3
5
|
module HpcPlugins
|
|
@@ -5,7 +7,7 @@ module HybridPlatformsConductor
|
|
|
5
7
|
module Test
|
|
6
8
|
|
|
7
9
|
# Test that the vulnerabilities Spectre and Meltdown are patched
|
|
8
|
-
class Spectre <
|
|
10
|
+
class Spectre < TestOnlyRemoteNode
|
|
9
11
|
|
|
10
12
|
VULNERABILITIES_TO_CHECK = {
|
|
11
13
|
'CVE-2017-5753' => 'Spectre Variant 1',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'nokogiri'
|
|
2
|
+
require 'hybrid_platforms_conductor/test_only_remote_node'
|
|
2
3
|
|
|
3
4
|
module HybridPlatformsConductor
|
|
4
5
|
|
|
@@ -17,7 +18,7 @@ module HybridPlatformsConductor
|
|
|
17
18
|
# Each final OVAL URL can be directly an XML file, either raw or compressed with .gz or .bz2.
|
|
18
19
|
# This is useful to follow repository links, such as jFrog or web servers serving common file systems structure storing several versions of the OVAL file.
|
|
19
20
|
# * *reported_severities* (Array<String> or nil): List of severities to report, if any (use Unknown when the severity is not known), or nil for all [default: nil]
|
|
20
|
-
class Vulnerabilities <
|
|
21
|
+
class Vulnerabilities < TestOnlyRemoteNode
|
|
21
22
|
|
|
22
23
|
# Known compression methods, per file extension, and their corresponding uncompress bash script
|
|
23
24
|
KNOWN_COMPRESSIONS = {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require 'hybrid_platforms_conductor/logger_helpers'
|
|
2
|
+
require 'hybrid_platforms_conductor/plugin'
|
|
3
|
+
|
|
4
|
+
module HybridPlatformsConductor
|
|
5
|
+
|
|
6
|
+
# Ancestor of all log plugins
|
|
7
|
+
class Log < Plugin
|
|
8
|
+
|
|
9
|
+
# Constructor
|
|
10
|
+
#
|
|
11
|
+
# Parameters::
|
|
12
|
+
# * *logger* (Logger): Logger to be used [default: Logger.new(STDOUT)]
|
|
13
|
+
# * *logger_stderr* (Logger): Logger to be used for stderr [default: Logger.new(STDERR)]
|
|
14
|
+
# * *config* (Config): Config to be used. [default: Config.new]
|
|
15
|
+
# * *nodes_handler* (NodesHandler): Nodes handler to be used. [default: NodesHandler.new]
|
|
16
|
+
# * *actions_executor* (ActionsExecutor): Actions executor to be used. [default: ActionsExecutor.new]
|
|
17
|
+
def initialize(
|
|
18
|
+
logger: Logger.new(STDOUT),
|
|
19
|
+
logger_stderr: Logger.new(STDERR),
|
|
20
|
+
config: Config.new,
|
|
21
|
+
nodes_handler: NodesHandler.new,
|
|
22
|
+
actions_executor: ActionsExecutor.new
|
|
23
|
+
)
|
|
24
|
+
super(logger: logger, logger_stderr: logger_stderr, config: config)
|
|
25
|
+
@nodes_handler = nodes_handler
|
|
26
|
+
@actions_executor = actions_executor
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require 'hybrid_platforms_conductor/logger_helpers'
|
|
2
|
+
require 'hybrid_platforms_conductor/plugin'
|
|
3
|
+
|
|
4
|
+
module HybridPlatformsConductor
|
|
5
|
+
|
|
6
|
+
# Ancestor of all secrets reader plugins
|
|
7
|
+
class SecretsReader < Plugin
|
|
8
|
+
|
|
9
|
+
# Constructor
|
|
10
|
+
#
|
|
11
|
+
# Parameters::
|
|
12
|
+
# * *logger* (Logger): Logger to be used [default: Logger.new(STDOUT)]
|
|
13
|
+
# * *logger_stderr* (Logger): Logger to be used for stderr [default: Logger.new(STDERR)]
|
|
14
|
+
# * *config* (Config): Config to be used. [default: Config.new]
|
|
15
|
+
# * *cmd_runner* (CmdRunner): CmdRunner to be used. [default: CmdRunner.new]
|
|
16
|
+
# * *nodes_handler* (NodesHandler): Nodes handler to be used. [default: NodesHandler.new]
|
|
17
|
+
def initialize(
|
|
18
|
+
logger: Logger.new(STDOUT),
|
|
19
|
+
logger_stderr: Logger.new(STDERR),
|
|
20
|
+
config: Config.new,
|
|
21
|
+
cmd_runner: CmdRunner.new,
|
|
22
|
+
nodes_handler: NodesHandler.new
|
|
23
|
+
)
|
|
24
|
+
super(logger: logger, logger_stderr: logger_stderr, config: config)
|
|
25
|
+
@cmd_runner = cmd_runner
|
|
26
|
+
@nodes_handler = nodes_handler
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module HybridPlatformsConductor
|
|
2
|
+
|
|
3
|
+
# Ancestor for all tests that should be run just on remote nodes
|
|
4
|
+
class TestOnlyRemoteNode < Test
|
|
5
|
+
|
|
6
|
+
# Limit the list of nodes for these tests.
|
|
7
|
+
#
|
|
8
|
+
# Result::
|
|
9
|
+
# * Array<String or Regex> or nil: List of nodes allowed for this test, or nil for all. Regular expressions matching node names can also be used.
|
|
10
|
+
def self.only_on_nodes
|
|
11
|
+
# Just 1 node per service and platform
|
|
12
|
+
Test.nodes_handler.prefetch_metadata_of Test.nodes_handler.known_nodes, :local_node
|
|
13
|
+
Test.nodes_handler.known_nodes.select { |node| !Test.nodes_handler.get_local_node_of(node) }
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
end
|
|
@@ -4,7 +4,9 @@ require 'hybrid_platforms_conductor/config'
|
|
|
4
4
|
require 'hybrid_platforms_conductor/platforms_handler'
|
|
5
5
|
require 'hybrid_platforms_conductor/actions_executor'
|
|
6
6
|
require 'hybrid_platforms_conductor/cmd_runner'
|
|
7
|
+
require 'hybrid_platforms_conductor/credentials'
|
|
7
8
|
require 'hybrid_platforms_conductor/deployer'
|
|
9
|
+
require 'hybrid_platforms_conductor/log'
|
|
8
10
|
require 'hybrid_platforms_conductor/nodes_handler'
|
|
9
11
|
require 'hybrid_platforms_conductor/platform_handler'
|
|
10
12
|
require 'hybrid_platforms_conductor/provisioner'
|
|
@@ -43,6 +45,8 @@ require 'hybrid_platforms_conductor_test/platform_handler_plugins/test2'
|
|
|
43
45
|
require 'hybrid_platforms_conductor_test/report_plugin'
|
|
44
46
|
require 'hybrid_platforms_conductor_test/test_action'
|
|
45
47
|
require 'hybrid_platforms_conductor_test/test_connector'
|
|
48
|
+
require 'hybrid_platforms_conductor_test/test_log_plugin'
|
|
49
|
+
require 'hybrid_platforms_conductor_test/test_log_no_read_plugin'
|
|
46
50
|
require 'hybrid_platforms_conductor_test/test_plugins/global'
|
|
47
51
|
require 'hybrid_platforms_conductor_test/test_plugins/node'
|
|
48
52
|
require 'hybrid_platforms_conductor_test/test_plugins/node_check'
|
|
@@ -50,6 +54,7 @@ require 'hybrid_platforms_conductor_test/test_plugins/node_ssh'
|
|
|
50
54
|
require 'hybrid_platforms_conductor_test/test_plugins/platform'
|
|
51
55
|
require 'hybrid_platforms_conductor_test/test_plugins/several_checks'
|
|
52
56
|
require 'hybrid_platforms_conductor_test/test_provisioner'
|
|
57
|
+
require 'hybrid_platforms_conductor_test/test_secrets_reader_plugin'
|
|
53
58
|
require 'hybrid_platforms_conductor_test/tests_report_plugin'
|
|
54
59
|
|
|
55
60
|
module HybridPlatformsConductorTest
|
|
@@ -128,16 +133,32 @@ module HybridPlatformsConductorTest
|
|
|
128
133
|
HybridPlatformsConductorTest::TestPlugins::NodeCheck.only_on_platform_types = nil
|
|
129
134
|
HybridPlatformsConductorTest::TestPlugins::NodeCheck.only_on_nodes = nil
|
|
130
135
|
HybridPlatformsConductorTest::TestPlugins::SeveralChecks.runs = []
|
|
136
|
+
HybridPlatformsConductorTest::TestLogPlugin.calls = []
|
|
137
|
+
HybridPlatformsConductorTest::TestLogNoReadPlugin.calls = []
|
|
138
|
+
HybridPlatformsConductorTest::TestSecretsReaderPlugin.calls = []
|
|
139
|
+
HybridPlatformsConductorTest::TestSecretsReaderPlugin.deployer = nil
|
|
140
|
+
HybridPlatformsConductorTest::TestSecretsReaderPlugin.mocked_secrets = {}
|
|
131
141
|
FileUtils.rm_rf './run_logs'
|
|
132
142
|
FileUtils.rm_rf './testadmin.key.pub'
|
|
133
143
|
FileUtils.rm_rf '/tmp/hpc_ssh'
|
|
144
|
+
register_plugins(
|
|
145
|
+
:log,
|
|
146
|
+
{
|
|
147
|
+
test_log: HybridPlatformsConductorTest::TestLogPlugin,
|
|
148
|
+
test_log_no_read: HybridPlatformsConductorTest::TestLogNoReadPlugin
|
|
149
|
+
},
|
|
150
|
+
replace: false
|
|
151
|
+
)
|
|
134
152
|
# Make sure CMDB plugin classes loaded by test framework are not added automatically
|
|
135
|
-
register_plugins(
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
153
|
+
register_plugins(
|
|
154
|
+
:cmdb,
|
|
155
|
+
{
|
|
156
|
+
config: HybridPlatformsConductor::HpcPlugins::Cmdb::Config,
|
|
157
|
+
host_ip: HybridPlatformsConductor::HpcPlugins::Cmdb::HostIp,
|
|
158
|
+
host_keys: HybridPlatformsConductor::HpcPlugins::Cmdb::HostKeys,
|
|
159
|
+
platform_handlers: HybridPlatformsConductor::HpcPlugins::Cmdb::PlatformHandlers
|
|
160
|
+
}
|
|
161
|
+
)
|
|
141
162
|
end
|
|
142
163
|
end
|
|
143
164
|
|
data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connections_spec.rb
CHANGED
|
@@ -29,7 +29,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
it 'creates an SSH master to 1 node not having Session Exec capabilities' do
|
|
32
|
-
with_test_platform(nodes: { 'node' => { meta: { host_ip: '192.168.42.42', ssh_session_exec:
|
|
32
|
+
with_test_platform(nodes: { 'node' => { meta: { host_ip: '192.168.42.42', ssh_session_exec: false } } }) do
|
|
33
33
|
with_cmd_runner_mocked(
|
|
34
34
|
[
|
|
35
35
|
['which env', proc { [0, "/usr/bin/env\n", ''] }],
|
|
@@ -45,7 +45,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
it 'can\'t create an SSH master to 1 node not having Session Exec capabilities when hpc_interactive is false' do
|
|
48
|
-
with_test_platform(nodes: { 'node' => { meta: { host_ip: '192.168.42.42', ssh_session_exec:
|
|
48
|
+
with_test_platform(nodes: { 'node' => { meta: { host_ip: '192.168.42.42', ssh_session_exec: false } } }) do
|
|
49
49
|
ENV['hpc_interactive'] = 'false'
|
|
50
50
|
with_cmd_runner_mocked(
|
|
51
51
|
[
|
|
@@ -69,7 +69,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
|
69
69
|
it 'fails without creating exception when creating an SSH master to 1 node not having Session Exec capabilities when hpc_interactive is false and we use no_exception' do
|
|
70
70
|
with_test_platform(nodes: {
|
|
71
71
|
'node1' => { meta: { host_ip: '192.168.42.1' } },
|
|
72
|
-
'node2' => { meta: { host_ip: '192.168.42.2', ssh_session_exec:
|
|
72
|
+
'node2' => { meta: { host_ip: '192.168.42.2', ssh_session_exec: false } },
|
|
73
73
|
'node3' => { meta: { host_ip: '192.168.42.3' } }
|
|
74
74
|
}) do
|
|
75
75
|
ENV['hpc_interactive'] = 'false'
|
|
@@ -3,10 +3,52 @@ describe HybridPlatformsConductor::Deployer do
|
|
|
3
3
|
context 'checking deployer specific config DSL' do
|
|
4
4
|
|
|
5
5
|
it 'declares a packaging timeout' do
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
with_platforms('packaging_timeout 666') do
|
|
7
|
+
expect(test_config.packaging_timeout_secs).to eq 666
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it 'declares log plugins to be used' do
|
|
12
|
+
with_test_platforms(
|
|
13
|
+
{ nodes: { 'node1' => {}, 'node2' => {} } },
|
|
14
|
+
false,
|
|
15
|
+
<<~EOS
|
|
16
|
+
send_logs_to %i[log_plugin_1 log_plugin_2]
|
|
17
|
+
for_nodes('node2') { send_logs_to :log_plugin_3 }
|
|
18
|
+
EOS
|
|
19
|
+
) do
|
|
20
|
+
expect(test_config.deployment_logs).to eq [
|
|
21
|
+
{
|
|
22
|
+
nodes_selectors_stack: [],
|
|
23
|
+
log_plugins: %i[log_plugin_1 log_plugin_2]
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
nodes_selectors_stack: %w[node2],
|
|
27
|
+
log_plugins: %i[log_plugin_3]
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it 'declares secrets readers plugins to be used' do
|
|
34
|
+
with_test_platforms(
|
|
35
|
+
{ nodes: { 'node1' => {}, 'node2' => {} } },
|
|
36
|
+
false,
|
|
37
|
+
<<~EOS
|
|
38
|
+
read_secrets_from %i[secrets_reader_plugin_1 secrets_reader_plugin_2]
|
|
39
|
+
for_nodes('node2') { read_secrets_from :secrets_reader_plugin_3 }
|
|
40
|
+
EOS
|
|
41
|
+
) do
|
|
42
|
+
expect(test_config.secrets_readers).to eq [
|
|
43
|
+
{
|
|
44
|
+
nodes_selectors_stack: [],
|
|
45
|
+
secrets_readers: %i[secrets_reader_plugin_1 secrets_reader_plugin_2]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
nodes_selectors_stack: %w[node2],
|
|
49
|
+
secrets_readers: %i[secrets_reader_plugin_3]
|
|
50
|
+
}
|
|
51
|
+
]
|
|
10
52
|
end
|
|
11
53
|
end
|
|
12
54
|
|