masamune 0.17.15 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/lib/masamune/actions/aws_emr.rb +5 -5
  3. data/lib/masamune/actions/hadoop_filesystem.rb +1 -1
  4. data/lib/masamune/actions/hadoop_streaming.rb +3 -3
  5. data/lib/masamune/actions/hive.rb +5 -5
  6. data/lib/masamune/actions/postgres.rb +5 -5
  7. data/lib/masamune/actions/s3cmd.rb +1 -1
  8. data/lib/masamune/cached_filesystem.rb +1 -1
  9. data/lib/masamune/commands/aws_emr.rb +11 -11
  10. data/lib/masamune/commands/hadoop_filesystem.rb +8 -8
  11. data/lib/masamune/commands/hadoop_streaming.rb +2 -2
  12. data/lib/masamune/commands/hive.rb +19 -19
  13. data/lib/masamune/commands/postgres.rb +19 -19
  14. data/lib/masamune/commands/postgres_admin.rb +13 -13
  15. data/lib/masamune/commands/s3cmd.rb +7 -7
  16. data/lib/masamune/configuration.rb +36 -52
  17. data/lib/masamune/environment.rb +4 -3
  18. data/lib/masamune/method_logger.rb +4 -0
  19. data/lib/masamune/schema/store.rb +17 -5
  20. data/lib/masamune/thor.rb +1 -3
  21. data/lib/masamune/version.rb +1 -1
  22. data/spec/masamune/actions/aws_emr_spec.rb +4 -4
  23. data/spec/masamune/actions/hadoop_filesystem_spec.rb +1 -1
  24. data/spec/masamune/actions/hadoop_streaming_spec.rb +5 -5
  25. data/spec/masamune/actions/hive_spec.rb +4 -4
  26. data/spec/masamune/actions/postgres_spec.rb +2 -2
  27. data/spec/masamune/actions/s3cmd_spec.rb +1 -1
  28. data/spec/masamune/commands/aws_emr_spec.rb +1 -1
  29. data/spec/masamune/commands/hadoop_filesystem_spec.rb +1 -1
  30. data/spec/masamune/commands/hadoop_streaming_spec.rb +1 -1
  31. data/spec/masamune/commands/hive_spec.rb +1 -1
  32. data/spec/masamune/commands/postgres_admin_spec.rb +15 -2
  33. data/spec/masamune/commands/postgres_spec.rb +1 -1
  34. data/spec/masamune/commands/s3cmd_spec.rb +1 -1
  35. data/spec/masamune/configuration_spec.rb +96 -1
  36. data/spec/masamune/environment_spec.rb +28 -1
  37. data/spec/masamune/schema/catalog_spec.rb +1 -1
  38. data/spec/masamune/tasks/aws_emr_thor_spec.rb +2 -2
  39. data/spec/masamune/tasks/hive_thor_spec.rb +7 -7
  40. data/spec/masamune/tasks/postgres_thor_spec.rb +4 -4
  41. data/spec/masamune/tasks/shell_thor_spec.rb +1 -1
  42. data/spec/masamune/thor_spec.rb +8 -13
  43. data/spec/support/masamune/example_group.rb +4 -3
  44. data/spec/support/masamune/job_example_group.rb +26 -27
  45. data/spec/support/masamune/mock_command.rb +3 -3
  46. data/spec/support/masamune/shared_example_group.rb +8 -10
  47. data/spec/support/masamune/step_example_group.rb +25 -28
  48. data/spec/support/masamune/task_example_group.rb +75 -28
  49. data/spec/support/masamune/thor_mute.rb +4 -2
  50. data/spec/support/rspec/example/action_example_group.rb +5 -3
  51. data/spec/support/rspec/example/task_example_group.rb +4 -67
  52. data/spec/support/rspec/example/transform_example_group.rb +7 -5
  53. metadata +16 -2
@@ -45,7 +45,7 @@ module Masamune
45
45
  end
46
46
 
47
47
  def configuration
48
- @configuration ||= Masamune::Configuration.new(self)
48
+ @configuration ||= Masamune::Configuration.new(environment: self)
49
49
  end
50
50
 
51
51
  def mutex
@@ -60,13 +60,13 @@ module Masamune
60
60
  lock_mode = File::LOCK_EX
61
61
  lock_mode |= File::LOCK_NB
62
62
  lock_status = lock_file.flock(lock_mode)
63
- if lock_status == 0
63
+ if lock_status && lock_status.zero?
64
64
  yield if block_given?
65
65
  else
66
66
  logger.error "acquire lock attempt failed for '#{lock_name}'"
67
67
  end
68
68
  ensure
69
- if lock_file && lock_status == 0
69
+ if lock_file && lock_status && lock_status.zero?
70
70
  logger.debug("releasing lock '#{lock_name}'")
71
71
  lock_file.flock(File::LOCK_UN)
72
72
  end
@@ -92,6 +92,7 @@ module Masamune
92
92
  end
93
93
 
94
94
  def log_file_name
95
+ return unless filesystem.path?(:log_dir)
95
96
  @log_file_name ||= filesystem.get_path(:log_dir, log_file_template)
96
97
  end
97
98
 
@@ -37,5 +37,9 @@ module Masamune
37
37
  super
38
38
  end
39
39
  end
40
+
41
+ def respond_to_missing?(method_name, include_private = false)
42
+ @target.respond_to?(method_name) || super
43
+ end
40
44
  end
41
45
  end
@@ -72,13 +72,25 @@ module Masamune::Schema
72
72
  @extra = []
73
73
  end
74
74
 
75
- def method_missing(method, *_args)
75
+ def method_missing(method_name, *_args)
76
+ *attribute_name, attribute_type = method_name.to_s.split('_')
76
77
  if type == :files
77
- files[method]
78
- else
79
- *attribute_name, attribute_type = method.to_s.split('_')
80
- raise ArgumentError, "unknown attribute type '#{attribute_type}'" unless SUPPORTED_ATTRIBUTES.include?(attribute_type)
78
+ files[method_name]
79
+ elsif SUPPORTED_ATTRIBUTES.include?(attribute_type)
81
80
  send(attribute_type.pluralize)[attribute_name.join('_')]
81
+ else
82
+ super
83
+ end
84
+ end
85
+
86
+ def respond_to_missing?(method_name, _include_private = false)
87
+ *attribute_name, attribute_type = method_name.to_s.split('_')
88
+ if type == :files
89
+ files.key?(method_name)
90
+ elsif SUPPORTED_ATTRIBUTES.include?(attribute_type)
91
+ send(attribute_type.pluralize).key?(attribute_name.join('_'))
92
+ else
93
+ super
82
94
  end
83
95
  end
84
96
 
data/lib/masamune/thor.rb CHANGED
@@ -78,7 +78,7 @@ module Masamune
78
78
  rescue => e
79
79
  instance.logger.error("#{e.message} (#{e.class}) backtrace:")
80
80
  e.backtrace.each { |x| instance.logger.error(x) }
81
- $stderr.puts "For complete debug log see: #{instance.log_file_name}"
81
+ $stderr.puts "For complete debug log see: #{instance.log_file_name}" if instance.log_file_name
82
82
  abort e.message
83
83
  end
84
84
  end
@@ -146,8 +146,6 @@ module Masamune
146
146
 
147
147
  if options[:version]
148
148
  puts environment.version
149
- puts options if options[:verbose]
150
- puts config.to_s if options[:verbose]
151
149
  exit
152
150
  end
153
151
  end
@@ -21,5 +21,5 @@
21
21
  # THE SOFTWARE.
22
22
 
23
23
  module Masamune
24
- VERSION = '0.17.15'.freeze
24
+ VERSION = '0.18.0'.freeze
25
25
  end
@@ -33,7 +33,7 @@ describe Masamune::Actions::AwsEmr do
33
33
  let(:configuration) { {} }
34
34
 
35
35
  before do
36
- allow(instance).to receive_message_chain(:configuration, :aws_emr).and_return(configuration)
36
+ allow(instance).to receive_message_chain(:configuration, :commands, :aws_emr).and_return(configuration)
37
37
  end
38
38
 
39
39
  describe '.aws_emr' do
@@ -47,7 +47,7 @@ describe Masamune::Actions::AwsEmr do
47
47
 
48
48
  context 'with retries and backoff' do
49
49
  before do
50
- allow(instance).to receive_message_chain(:configuration, :aws_emr).and_return(retries: 1, backoff: 10)
50
+ allow(instance).to receive_message_chain(:configuration, :commands, :aws_emr).and_return(retries: 1, backoff: 10)
51
51
  expect(Masamune::Commands::RetryWithBackoff).to receive(:new).with(anything, hash_including(retries: 1, backoff: 10)).once.and_call_original
52
52
  end
53
53
 
@@ -79,7 +79,7 @@ describe Masamune::Actions::AwsEmr do
79
79
  end
80
80
  it do
81
81
  expect { subject }.to_not raise_error
82
- expect(instance.configuration.aws_emr[:cluster_id]).to eq('j-XYZ')
82
+ expect(instance.configuration.commands.aws_emr[:cluster_id]).to eq('j-XYZ')
83
83
  end
84
84
  end
85
85
 
@@ -100,7 +100,7 @@ describe Masamune::Actions::AwsEmr do
100
100
  end
101
101
  it do
102
102
  expect { subject }.to_not raise_error
103
- expect(instance.configuration.aws_emr[:cluster_id]).to eq('j-XYZ')
103
+ expect(instance.configuration.commands.aws_emr[:cluster_id]).to eq('j-XYZ')
104
104
  end
105
105
  end
106
106
  end
@@ -41,7 +41,7 @@ describe Masamune::Actions::HadoopFilesystem do
41
41
 
42
42
  context 'with retries and backoff' do
43
43
  before do
44
- allow(instance).to receive_message_chain(:configuration, :hadoop_filesystem).and_return(retries: 1, backoff: 10)
44
+ allow(instance).to receive_message_chain(:configuration, :commands, :hadoop_filesystem).and_return(retries: 1, backoff: 10)
45
45
  expect(Masamune::Commands::RetryWithBackoff).to receive(:new).with(anything, hash_including(retries: 1, backoff: 10)).once.and_call_original
46
46
  end
47
47
 
@@ -33,8 +33,8 @@ describe Masamune::Actions::HadoopStreaming do
33
33
 
34
34
  describe '.hadoop_streaming' do
35
35
  before do
36
- allow(instance).to receive_message_chain(:configuration, :hadoop_streaming).and_return({})
37
- allow(instance).to receive_message_chain(:configuration, :aws_emr).and_return({})
36
+ allow(instance).to receive_message_chain(:configuration, :commands, :hadoop_streaming).and_return({})
37
+ allow(instance).to receive_message_chain(:configuration, :commands, :aws_emr).and_return({})
38
38
  mock_command(/\Ahadoop/, mock_success)
39
39
  end
40
40
 
@@ -44,7 +44,7 @@ describe Masamune::Actions::HadoopStreaming do
44
44
 
45
45
  context 'with cluster_id' do
46
46
  before do
47
- allow(instance).to receive_message_chain(:configuration, :aws_emr).and_return(cluster_id: 'j-XYZ')
47
+ allow(instance).to receive_message_chain(:configuration, :commands, :aws_emr).and_return(cluster_id: 'j-XYZ')
48
48
  mock_command(/\Ahadoop/, mock_failure)
49
49
  mock_command(/\Aaws emr/, mock_success, StringIO.new('ssh fakehost exit'))
50
50
  mock_command(/\Assh fakehost hadoop/, mock_success)
@@ -57,7 +57,7 @@ describe Masamune::Actions::HadoopStreaming do
57
57
  let(:extra) { ['-D', 'EXTRA'] }
58
58
 
59
59
  before do
60
- allow(instance).to receive_message_chain(:configuration, :aws_emr).and_return(cluster_id: 'j-XYZ')
60
+ allow(instance).to receive_message_chain(:configuration, :commands, :aws_emr).and_return(cluster_id: 'j-XYZ')
61
61
  mock_command(/\Ahadoop/, mock_failure)
62
62
  mock_command(/\Aaws emr/, mock_success, StringIO.new('ssh fakehost exit'))
63
63
  mock_command(/\Assh fakehost -D EXTRA hadoop/, mock_failure)
@@ -69,7 +69,7 @@ describe Masamune::Actions::HadoopStreaming do
69
69
 
70
70
  context 'with retries and backoff' do
71
71
  before do
72
- allow(instance).to receive_message_chain(:configuration, :hadoop_streaming).and_return(retries: 1, backoff: 10)
72
+ allow(instance).to receive_message_chain(:configuration, :commands, :hadoop_streaming).and_return(retries: 1, backoff: 10)
73
73
  expect(Masamune::Commands::RetryWithBackoff).to receive(:new).with(anything, hash_including(retries: 1, backoff: 10)).once.and_call_original
74
74
  end
75
75
 
@@ -36,8 +36,8 @@ describe Masamune::Actions::Hive do
36
36
  before do
37
37
  filesystem.add_path(:tmp_dir, File.join(Dir.tmpdir, SecureRandom.hex))
38
38
  allow(instance).to receive(:filesystem) { filesystem }
39
- allow(instance).to receive_message_chain(:configuration, :hive).and_return(configuration)
40
- allow(instance).to receive_message_chain(:configuration, :aws_emr).and_return({})
39
+ allow(instance).to receive_message_chain(:configuration, :commands, :hive).and_return(configuration)
40
+ allow(instance).to receive_message_chain(:configuration, :commands, :aws_emr).and_return({})
41
41
  allow(instance).to receive_message_chain(:define_schema, :to_file) { 'schema.hql' }
42
42
  allow_any_instance_of(Masamune::MockFilesystem).to receive(:copy_file_to_dir)
43
43
  end
@@ -53,7 +53,7 @@ describe Masamune::Actions::Hive do
53
53
 
54
54
  context 'with cluster_id' do
55
55
  before do
56
- allow(instance).to receive_message_chain(:configuration, :aws_emr).and_return(cluster_id: 'j-XYZ')
56
+ allow(instance).to receive_message_chain(:configuration, :commands, :aws_emr).and_return(cluster_id: 'j-XYZ')
57
57
  mock_command(/\Ahive/, mock_failure)
58
58
  mock_command(/\Aaws emr/, mock_success, StringIO.new('ssh fakehost exit'))
59
59
  mock_command(/\Assh fakehost hive/, mock_success)
@@ -66,7 +66,7 @@ describe Masamune::Actions::Hive do
66
66
 
67
67
  context 'with retries and backoff' do
68
68
  before do
69
- allow(instance).to receive_message_chain(:configuration, :hive).and_return(retries: 1, backoff: 10)
69
+ allow(instance).to receive_message_chain(:configuration, :commands, :hive).and_return(retries: 1, backoff: 10)
70
70
  expect(Masamune::Commands::RetryWithBackoff).to receive(:new).with(anything, hash_including(retries: 1, backoff: 10)).once.and_call_original
71
71
  end
72
72
 
@@ -40,7 +40,7 @@ describe Masamune::Actions::Postgres do
40
40
  allow(instance).to receive(:filesystem) { filesystem }
41
41
  allow(instance).to receive(:catalog) { catalog }
42
42
  allow(instance).to receive(:postgres_helper) { postgres_helper }
43
- allow(instance).to receive_message_chain(:configuration, :postgres).and_return(configuration)
43
+ allow(instance).to receive_message_chain(:configuration, :commands, :postgres).and_return(configuration)
44
44
  allow(instance).to receive_message_chain(:configuration, :with_quiet).and_yield
45
45
  allow(instance).to receive_message_chain(:define_schema, :to_file) { 'catalog.psql' }
46
46
  end
@@ -56,7 +56,7 @@ describe Masamune::Actions::Postgres do
56
56
 
57
57
  context 'with retries and backoff' do
58
58
  before do
59
- allow(instance).to receive_message_chain(:configuration, :postgres).and_return(retries: 1, backoff: 10)
59
+ allow(instance).to receive_message_chain(:configuration, :commands, :postgres).and_return(retries: 1, backoff: 10)
60
60
  expect(Masamune::Commands::RetryWithBackoff).to receive(:new).with(anything, hash_including(retries: 1, backoff: 10)).once.and_call_original
61
61
  end
62
62
 
@@ -41,7 +41,7 @@ describe Masamune::Actions::S3Cmd do
41
41
 
42
42
  context 'with retries and backoff' do
43
43
  before do
44
- allow(instance).to receive_message_chain(:configuration, :s3cmd).and_return(retries: 1, backoff: 10)
44
+ allow(instance).to receive_message_chain(:configuration, :commands, :s3cmd).and_return(retries: 1, backoff: 10)
45
45
  expect(Masamune::Commands::RetryWithBackoff).to receive(:new).with(anything, hash_including(retries: 1, backoff: 10)).once.and_call_original
46
46
  end
47
47
 
@@ -29,7 +29,7 @@ describe Masamune::Commands::AwsEmr do
29
29
 
30
30
  before do
31
31
  allow(delegate).to receive(:logger).and_return(double)
32
- allow(delegate).to receive_message_chain(:configuration, :aws_emr).and_return(configuration)
32
+ allow(delegate).to receive_message_chain(:configuration, :commands, :aws_emr).and_return(configuration)
33
33
  end
34
34
 
35
35
  describe '#command_env' do
@@ -29,7 +29,7 @@ describe Masamune::Commands::HadoopFilesystem do
29
29
  let(:instance) { described_class.new(delegate, attrs) }
30
30
 
31
31
  before do
32
- allow(delegate).to receive_message_chain(:configuration, :hadoop_filesystem).and_return(configuration)
32
+ allow(delegate).to receive_message_chain(:configuration, :commands, :hadoop_filesystem).and_return(configuration)
33
33
  end
34
34
 
35
35
  describe '#command_args' do
@@ -36,7 +36,7 @@ describe Masamune::Commands::HadoopStreaming do
36
36
  allow(delegate).to receive(:filesystem).and_return(filesystem)
37
37
  allow(delegate).to receive(:console).and_return(double)
38
38
  allow(delegate).to receive(:logger).and_return(double)
39
- allow(delegate).to receive_message_chain(:configuration, :hadoop_streaming).and_return(configuration)
39
+ allow(delegate).to receive_message_chain(:configuration, :commands, :hadoop_streaming).and_return(configuration)
40
40
  end
41
41
 
42
42
  describe '#before_execute' do
@@ -41,7 +41,7 @@ describe Masamune::Commands::Hive do
41
41
  allow(delegate).to receive(:filesystem) { filesystem }
42
42
  allow(delegate).to receive(:logger).and_return(double)
43
43
  allow(delegate).to receive(:console).and_return(double)
44
- allow(delegate).to receive_message_chain(:configuration, :hive).and_return(configuration)
44
+ allow(delegate).to receive_message_chain(:configuration, :commands, :hive).and_return(configuration)
45
45
  end
46
46
 
47
47
  describe '#command_args' do
@@ -22,14 +22,15 @@
22
22
 
23
23
  describe Masamune::Commands::PostgresAdmin do
24
24
  let(:configuration) { { create_db_path: 'createdb', drop_db_path: 'dropdb', hostname: 'localhost', username: 'postgres' } }
25
+ let(:postgres_configuration) { {} }
25
26
  let(:attrs) { {} }
26
27
 
27
28
  let(:delegate) { double }
28
29
  let(:instance) { described_class.new(delegate, attrs) }
29
30
 
30
31
  before do
31
- allow(delegate).to receive_message_chain(:configuration, :postgres).and_return({})
32
- allow(delegate).to receive_message_chain(:configuration, :postgres_admin).and_return(configuration)
32
+ allow(delegate).to receive_message_chain(:configuration, :commands, :postgres).and_return(postgres_configuration)
33
+ allow(delegate).to receive_message_chain(:configuration, :commands, :postgres_admin).and_return(configuration)
33
34
  end
34
35
 
35
36
  describe '#command_args' do
@@ -42,6 +43,18 @@ describe Masamune::Commands::PostgresAdmin do
42
43
  it { is_expected.to eq(['createdb', '--host=localhost', '--username=postgres', '--no-password', 'zombo']) }
43
44
  end
44
45
 
46
+ context 'action :create with database with postgres database configuration (string)' do
47
+ let(:postgres_configuration) { { 'database' => 'test' } }
48
+ let(:attrs) { { action: :create, database: 'zombo' } }
49
+ it { is_expected.to eq(['createdb', '--host=localhost', '--username=postgres', '--no-password', 'zombo']) }
50
+ end
51
+
52
+ context 'action :create with database with postgres database configuration (symbol)' do
53
+ let(:postgres_configuration) { { database: 'test' } }
54
+ let(:attrs) { { action: :create, database: 'zombo' } }
55
+ it { is_expected.to eq(['createdb', '--host=localhost', '--username=postgres', '--no-password', 'zombo']) }
56
+ end
57
+
45
58
  context 'action :create without database' do
46
59
  let(:attrs) { { action: :create } }
47
60
  it { expect { subject }.to raise_error ArgumentError, ':database must be given' }
@@ -31,7 +31,7 @@ describe Masamune::Commands::Postgres do
31
31
  before do
32
32
  allow(delegate).to receive(:logger).and_return(double)
33
33
  allow(delegate).to receive(:console).and_return(double)
34
- allow(delegate).to receive_message_chain(:configuration, :postgres).and_return(configuration)
34
+ allow(delegate).to receive_message_chain(:configuration, :commands, :postgres).and_return(configuration)
35
35
  end
36
36
 
37
37
  describe '#stdin' do
@@ -29,7 +29,7 @@ describe Masamune::Commands::S3Cmd do
29
29
  let(:instance) { described_class.new(delegate, attrs) }
30
30
 
31
31
  before do
32
- allow(delegate).to receive_message_chain(:configuration, :s3cmd).and_return(configuration)
32
+ allow(delegate).to receive_message_chain(:configuration, :commands, :s3cmd).and_return(configuration)
33
33
  end
34
34
 
35
35
  describe '#command_args' do
@@ -22,7 +22,7 @@
22
22
 
23
23
  describe Masamune::Configuration do
24
24
  let(:environment) { Masamune::Environment.new }
25
- let(:instance) { described_class.new(environment) }
25
+ let(:instance) { described_class.new(environment: environment) }
26
26
 
27
27
  describe '.default_config_file' do
28
28
  subject { described_class.default_config_file }
@@ -34,6 +34,23 @@ describe Masamune::Configuration do
34
34
  it { is_expected.to match(%r{config/masamune\.yml\.erb\Z}) }
35
35
  end
36
36
 
37
+ describe '#params' do
38
+ subject { instance.params }
39
+ it { is_expected.to be_a(Hash) }
40
+ end
41
+
42
+ describe '#commands' do
43
+ subject { instance.commands }
44
+ it { is_expected.to be_a(Hashie::Mash) }
45
+ end
46
+
47
+ described_class.default_commands.each do |command_sym|
48
+ describe "#commands.#{command_sym}" do
49
+ subject { instance.commands.send(command_sym) }
50
+ it { is_expected.to be_a(Hashie::Mash) }
51
+ end
52
+ end
53
+
37
54
  describe '#as_options' do
38
55
  subject { instance.as_options }
39
56
  it { is_expected.to eq([]) }
@@ -45,4 +62,82 @@ describe Masamune::Configuration do
45
62
  it { is_expected.to eq(['--debug', '--dry-run']) }
46
63
  end
47
64
  end
65
+
66
+ describe '#load' do
67
+ let(:yaml_file) do
68
+ Tempfile.create('masamune').tap do |tmp|
69
+ tmp.write(yaml)
70
+ tmp.close
71
+ end.path
72
+ end
73
+
74
+ subject(:result) { instance.load(yaml_file) }
75
+
76
+ context 'with Hash params' do
77
+ let(:yaml) do
78
+ <<-YAML.strip_heredoc
79
+ ---
80
+ params:
81
+ key_one: value_one
82
+ key_two: value_two
83
+ YAML
84
+ end
85
+
86
+ it do
87
+ expect(result.params[:key_one]).to eq('value_one')
88
+ expect(result.params[:key_two]).to eq('value_two')
89
+ end
90
+ end
91
+
92
+ context 'with Array params' do
93
+ let(:yaml) do
94
+ <<-YAML.strip_heredoc
95
+ ---
96
+ params:
97
+ - one
98
+ - two
99
+ YAML
100
+ end
101
+
102
+ it do
103
+ expect { result }.to raise_error(ArgumentError, 'params section must only contain key value pairs')
104
+ end
105
+ end
106
+
107
+ context 'with Hash paths' do
108
+ let(:yaml) do
109
+ <<-YAML.strip_heredoc
110
+ ---
111
+ paths:
112
+ - foo_dir: ['/tmp/foo', {mkdir: true}]
113
+ - bar_dir: '/tmp/bar'
114
+ YAML
115
+ end
116
+
117
+ it do
118
+ expect(result.filesystem.paths[:foo_dir]).to eq(['/tmp/foo', { mkdir: true }])
119
+ expect(result.filesystem.paths[:bar_dir]).to eq(['/tmp/bar', {}])
120
+ end
121
+ end
122
+
123
+ context 'with Hash commands' do
124
+ let(:yaml) do
125
+ <<-YAML.strip_heredoc
126
+ ---
127
+ commands:
128
+ aws_emr:
129
+ path: /opt/aws/bin/emr
130
+ config_file: /etc/aws/emr_config
131
+ hive:
132
+ database: 'zombo'
133
+ YAML
134
+ end
135
+
136
+ it do
137
+ expect(result.commands.aws_emr.path).to eq('/opt/aws/bin/emr')
138
+ expect(result.commands.aws_emr.config_file).to eq('/etc/aws/emr_config')
139
+ expect(result.commands.hive.database).to eq('zombo')
140
+ end
141
+ end
142
+ end
48
143
  end