cem_acpt 0.2.12-universal-java-17 → 0.3.2-universal-java-17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3b50bf460a869a9d3d9bc39bfb173ff72a445d1cb0ad530592802dc7746a69ca
4
- data.tar.gz: 464f0e379e111ca1c7ed6dd0247e1ab693158ed130836d44367d4830310d54e7
3
+ metadata.gz: c1403d7aad1f43c9ab46a2ec09e10e6e6971a895f864f908da36d1aa4f459ccb
4
+ data.tar.gz: 7c24f47c835e7422311e21fb3b398d871ba88fa8ba295a6b403c0b5006cfe890
5
5
  SHA512:
6
- metadata.gz: c076c5eba5b8e3c297e1fcdaa39ea1d1a44387d90de40950f4d32e4b95866a9a50054fe4c20b226125535c105b3dd6675e7924f78f106a315112561002f4d0bd
7
- data.tar.gz: efb086e7b909febc6bd777f1456562125c911ac7216e1a815800a3fcc1c9393b807a685165fe8678259aae6b5bb218cbb4afc7ec0b87416b483eb3fcf3603130
6
+ metadata.gz: d828aa44f6879dacbd6b5dabd5682dad73e7f4150436a0bffb51c73707345f61bd1b45527d102dfe67cb060acf0cec639c24c89df1a11b6c3f8598e48c939621
7
+ data.tar.gz: fa6b986ce60edafa468ee41a7dda019aad8fe09590918e93ec41325e9158a9bd96712a26b6575b1f08d7f239e66d14665ca2a3cbd90dcf08e0d6ce95347ceb73
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cem_acpt (0.2.12-universal-java-17)
4
+ cem_acpt (0.3.2-universal-java-17)
5
5
  concurrent-ruby (>= 1.1, < 2.0)
6
6
  deep_merge (>= 1.2, < 2.0)
7
7
  ed25519 (>= 1.2, < 2.0)
@@ -19,8 +19,8 @@ GEM
19
19
  ed25519 (1.3.0-java)
20
20
  minitar (0.9)
21
21
  multi_json (1.15.0)
22
- net-scp (1.2.1)
23
- net-ssh (>= 2.6.5)
22
+ net-scp (4.0.0)
23
+ net-ssh (>= 2.6.5, < 8.0.0)
24
24
  net-ssh (7.0.1)
25
25
  net-telnet (0.1.1)
26
26
  parallel (1.22.1)
@@ -68,7 +68,7 @@ GEM
68
68
  rspec-its
69
69
  specinfra (~> 2.83.1)
70
70
  sfl (2.3)
71
- specinfra (2.83.3)
71
+ specinfra (2.83.4)
72
72
  net-scp
73
73
  net-ssh (>= 2.7)
74
74
  net-telnet (= 0.1.1)
@@ -85,4 +85,4 @@ DEPENDENCIES
85
85
  rubocop
86
86
 
87
87
  BUNDLED WITH
88
- 2.3.15
88
+ 2.3.25
@@ -62,8 +62,8 @@ module CemAcpt
62
62
  end
63
63
 
64
64
  def clean_up_test_suite(opts)
65
- @ctx&.node_inventory&.clear!
66
- @ctx&.node_inventory&.clean_local_files
65
+ @ctx&.node_inventory&.clear! unless opts[:no_destroy_nodes]
66
+ @ctx&.node_inventory&.clean_local_files unless opts[:no_destroy_nodes]
67
67
  clean_test_ssh_key unless opts[:no_ephemeral_ssh_key]
68
68
  @run_handler&.destroy_test_nodes
69
69
  @keep_terminal_alive&.kill
@@ -337,7 +337,10 @@ module CemAcpt::Platform::Gcp
337
337
 
338
338
  # This function returns the currently authenticated user's name sanitized for use in SSH
339
339
  def authenticated_user_name
340
- local_exec('compute os-login describe-profile', project_flag: false)['posixAccounts'][0]['username']
340
+ profile = local_exec('compute os-login describe-profile', project_flag: false)
341
+ accounts = profile['posixAccounts']
342
+ raise "cannot find any posix accounts in profile: #{profile}" if not accounts
343
+ accounts[0]['username']
341
344
  rescue StandardError => e
342
345
  raise "failed to find authenticated user name from os-login profile: #{e.message}"
343
346
  end
@@ -13,10 +13,10 @@ module Platform
13
13
  # Provision a GCP instance
14
14
  def provision
15
15
  creation_params = config.dup
16
- creation_params[:disk][:image_name] = image_name
17
- creation_params[:local_port] = local_port
16
+ creation_params[:disk][:image_name] = image_name.dup
17
+ creation_params[:local_port] = local_port.dup
18
18
  @instance = CemAcpt::Platform::Gcp::VM.new(
19
- node_name,
19
+ node_name.dup,
20
20
  components: creation_params,
21
21
  )
22
22
  @instance.configure!
@@ -81,5 +81,14 @@ module Platform
81
81
  def run_shell(instance_name, cmd, opts = {})
82
82
  command_provider.run_shell(instance_name, cmd, opts)
83
83
  end
84
+
85
+ # Uploads a file to the given instance
86
+ # @param instance_name [String] the name of the instance to upload the file to
87
+ # @param local [String] the local file path
88
+ # @param remote [String] the remote file path
89
+ # @return [String] the output of the upload file command
90
+ def scp_upload(instance_name, local, remote)
91
+ command_provider.scp_upload(instance_name, local, remote)
92
+ end
84
93
  end
85
94
  end
@@ -144,6 +144,12 @@ module CemAcpt
144
144
  result
145
145
  end
146
146
 
147
+ # This method uploads a file to the test node.
148
+ def scp_upload(local, remote)
149
+ host = RSpec.configuration.acpt_test_data[:node_name]
150
+ RSpec.configuration.acpt_test_data[:platform].scp_upload(host, local, remote)
151
+ end
152
+
147
153
  # This method runs a shell command on the test node.
148
154
  def run_shell(cmd, opts = {})
149
155
  cmd = cmd.join(' ') if cmd.is_a?(Array)
@@ -33,14 +33,16 @@ module CemAcpt
33
33
  # @return [Array<Hash>] an array of test data hashes
34
34
  def acceptance_test_data
35
35
  logger.info 'Gathering acceptance test data...'
36
- acceptance_tests.each_with_object([]) do |t, a|
37
- logger.debug("Processing #{t}...")
38
- test_name = File.basename(t, '_spec.rb')
36
+ raise "No 'tests' entry found in config file" unless @config.has?('tests')
37
+ @config.get('tests').each_with_object([]) do |test_name, a|
38
+ logger.debug("Processing test #{test_name}...")
39
+ test_file = acceptance_tests.find { |f| File.basename(f, '_spec.rb') == test_name }
40
+ raise "Test file not found for test #{test_name}" unless test_file
41
+ logger.debug("Test file found for test #{test_name}: #{test_file}")
39
42
  test_data = {
40
43
  test_name: test_name,
41
- test_file: File.expand_path(t),
44
+ test_file: File.expand_path(test_file),
42
45
  }
43
- next unless @config.has?('tests') && @config.get('tests').include?(test_name)
44
46
 
45
47
  process_for_each(test_data).each do |test_data_i|
46
48
  process_static_vars(test_data_i)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CemAcpt
4
- VERSION = '0.2.12'
4
+ VERSION = '0.3.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cem_acpt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.12
4
+ version: 0.3.2
5
5
  platform: universal-java-17
6
6
  authors:
7
7
  - puppetlabs
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-26 00:00:00.000000000 Z
11
+ date: 2022-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement