rspec-hive 0.6.2 → 0.6.3

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
- SHA1:
3
- metadata.gz: 841844fbe325b30d84de39dcdca918230b708b0e
4
- data.tar.gz: b2fcf9def44d6865a1a3154eb5d30ada6ea2a883
2
+ SHA256:
3
+ metadata.gz: 73aaa3dea02e63bc4f45dc2b9cb8f38cd0555d26d85bf380c160b69eafa14071
4
+ data.tar.gz: b598520673e2e9ae7385817bfe986beefe52fec05d2d29eaa142e81bf773ff72
5
5
  SHA512:
6
- metadata.gz: 9d8f8d0bc9a27a7e58969bd3f0f999e8c0c2b6505ee25750342e4597ceb0fc82e1b27119e51d3d34cf73004b696a06f99e8b2578f14f8502e5d2428cc1f6cd33
7
- data.tar.gz: edd16a9a9e33ba4362ecc5013a94ba79aad123c7fbf8dc262c910123ed7274b636c9526f0acacbb92a9c9663316882c1dad8fc8cfc974f1e19ad02a53bb5f882
6
+ metadata.gz: 2913bb4bcc0f8187caad173d5b2d98e2b98e39ce72abdef78a523ce5eff2499e62e1c7ecde9d325449285127c471e540a37c321a4b8c269f8c922cec9f38a0b3
7
+ data.tar.gz: 8d3404a64af728cc4362d45fd96c99999cde5510d41069fb89c8bb2dbf50671ce414fbee1623bafdfe2631268a7258b7b4ff26b1da0f49054c1dcc0ecd1025ae
data/.rubocop.yml CHANGED
@@ -2,19 +2,11 @@ require: rubocop-rspec
2
2
 
3
3
  inherit_from: .rubocop_todo.yml
4
4
 
5
- Rails:
6
- Enabled: false
7
-
8
5
  AllCops:
9
- TargetRubyVersion: 2.3
10
- Include:
11
- - '**/Rakefile'
12
- Exclude:
13
- - spec/spec_helper.rb
14
- - vendor/**/*
15
- - examples/query_spec.rb
6
+ TargetRubyVersion: 2.7
7
+ NewCops: enable
16
8
 
17
- Metrics/LineLength:
9
+ Layout/LineLength:
18
10
  Max: 120
19
11
  Enabled: true
20
12
 
@@ -27,9 +19,6 @@ Naming/FileName:
27
19
  - Guardfile
28
20
  - rspec-hive.gemspec
29
21
 
30
- Metrics/BlockLength:
31
- ExcludedMethods: ['describe', 'context']
32
-
33
22
  Layout/MultilineOperationIndentation:
34
23
  EnforcedStyle: indented
35
24
 
data/.rubocop_todo.yml CHANGED
@@ -1,16 +1,62 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2017-10-23 16:07:33 +0200 using RuboCop version 0.51.0.
3
+ # on 2022-10-04 10:54:31 UTC using RuboCop version 1.36.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
+ # Offense count: 1
10
+ # This cop supports safe autocorrection (--autocorrect).
11
+ # Configuration parameters: Include.
12
+ # Include: **/*.gemspec
13
+ Gemspec/RequireMFA:
14
+ Exclude:
15
+ - 'rspec-hive.gemspec'
16
+
17
+ # Offense count: 1
18
+ # Configuration parameters: Include.
19
+ # Include: **/*.gemspec
20
+ Gemspec/RequiredRubyVersion:
21
+ Exclude:
22
+ - 'rspec-hive.gemspec'
23
+
24
+ # Offense count: 2
25
+ # Configuration parameters: AutoCorrect, EnforcedStyle.
26
+ # SupportedStyles: leading, trailing
27
+ Layout/LineContinuationLeadingSpace:
28
+ Exclude:
29
+ - 'lib/rspec/hive/rake_tasks/docker.rake'
30
+
31
+ # Offense count: 1
32
+ # This cop supports unsafe autocorrection (--autocorrect-all).
33
+ Lint/DuplicateRequire:
34
+ Exclude:
35
+ - 'examples/spec/spec_helper.rb'
36
+
9
37
  # Offense count: 6
10
- # Configuration parameters: CountComments, ExcludedMethods.
38
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods, inherit_mode.
39
+ # AllowedMethods: refine
11
40
  Metrics/BlockLength:
12
41
  Max: 106
13
42
 
43
+ # Offense count: 2
44
+ # This cop supports safe autocorrection (--autocorrect).
45
+ # Configuration parameters: EnforcedStyle.
46
+ # SupportedStyles: be_a, be_kind_of
47
+ RSpec/ClassCheck:
48
+ Exclude:
49
+ - 'spec/lib/rspec/hive/query_builder_helper_spec.rb'
50
+
51
+ # Offense count: 7
52
+ # Configuration parameters: Prefixes, AllowedPatterns.
53
+ # Prefixes: when, with, without
54
+ RSpec/ContextWording:
55
+ Exclude:
56
+ - 'examples/spec/query_spec.rb'
57
+ - 'spec/lib/rspec/hive/configuration_spec.rb'
58
+ - 'spec/lib/rspec/hive/matchers_spec.rb'
59
+
14
60
  # Offense count: 44
15
61
  RSpec/ExpectInHook:
16
62
  Exclude:
@@ -18,23 +64,89 @@ RSpec/ExpectInHook:
18
64
  - 'spec/lib/rspec/hive/connector_spec.rb'
19
65
  - 'spec/lib/rspec/hive/query_builder_spec.rb'
20
66
 
67
+ # Offense count: 3
68
+ # This cop supports safe autocorrection (--autocorrect).
69
+ # Configuration parameters: EnforcedStyle.
70
+ # SupportedStyles: single_line_only, single_statement_only, disallow
71
+ RSpec/ImplicitSubject:
72
+ Exclude:
73
+ - 'spec/lib/rspec/hive/query_builder/row_transformer_spec.rb'
74
+ - 'spec/lib/rspec/hive/query_builder_helper_spec.rb'
75
+
21
76
  # Offense count: 46
22
- # Configuration parameters: SupportedStyles.
77
+ # Configuration parameters: .
23
78
  # SupportedStyles: have_received, receive
24
79
  RSpec/MessageSpies:
25
80
  EnforcedStyle: receive
26
81
 
82
+ # Offense count: 70
83
+ # Configuration parameters: AllowSubject.
84
+ RSpec/MultipleMemoizedHelpers:
85
+ Max: 16
86
+
27
87
  # Offense count: 36
28
- # Configuration parameters: Max.
88
+ # Configuration parameters: AllowedGroups.
29
89
  RSpec/NestedGroups:
90
+ Max: 6
91
+
92
+ # Offense count: 78
93
+ RSpec/NoExpectationExample:
30
94
  Exclude:
95
+ - 'spec/lib/rspec/hive/connection_delegator_spec.rb'
31
96
  - 'spec/lib/rspec/hive/matchers_spec.rb'
32
97
  - 'spec/lib/rspec/hive/query_builder_spec.rb'
33
98
 
99
+ # Offense count: 13
100
+ RSpec/StubbedMock:
101
+ Exclude:
102
+ - 'spec/lib/rspec/hive/connection_delegator_spec.rb'
103
+ - 'spec/lib/rspec/hive/connector_spec.rb'
104
+ - 'spec/lib/rspec/hive_spec.rb'
105
+
34
106
  # Offense count: 11
35
- # Configuration parameters: IgnoreSymbolicNames.
107
+ # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
36
108
  RSpec/VerifiedDoubles:
37
109
  Exclude:
38
110
  - 'spec/lib/rspec/hive/connection_delegator_spec.rb'
39
111
  - 'spec/lib/rspec/hive/connector_spec.rb'
40
112
  - 'spec/lib/rspec/hive/query_builder_helper_spec.rb'
113
+
114
+ # Offense count: 1
115
+ # This cop supports safe autocorrection (--autocorrect).
116
+ Style/ExplicitBlockArgument:
117
+ Exclude:
118
+ - 'lib/rspec/hive/exponential_backoff.rb'
119
+
120
+ # Offense count: 1
121
+ # This cop supports unsafe autocorrection (--autocorrect-all).
122
+ # Configuration parameters: EnforcedStyle.
123
+ # SupportedStyles: always, always_true, never
124
+ Style/FrozenStringLiteralComment:
125
+ Exclude:
126
+ - 'spec/spec_helper.rb'
127
+
128
+ # Offense count: 1
129
+ # This cop supports unsafe autocorrection (--autocorrect-all).
130
+ Style/GlobalStdStream:
131
+ Exclude:
132
+ - 'lib/rspec/hive/configuration.rb'
133
+
134
+ # Offense count: 2
135
+ # This cop supports safe autocorrection (--autocorrect).
136
+ # Configuration parameters: AllowSplatArgument.
137
+ Style/HashConversion:
138
+ Exclude:
139
+ - 'lib/rspec/hive/matchers.rb'
140
+ - 'lib/rspec/hive/query_builder/row_transformer.rb'
141
+
142
+ # Offense count: 1
143
+ # This cop supports unsafe autocorrection (--autocorrect-all).
144
+ Style/HashTransformKeys:
145
+ Exclude:
146
+ - 'lib/rspec/hive/query_builder/row_transformer.rb'
147
+
148
+ # Offense count: 1
149
+ # This cop supports safe autocorrection (--autocorrect).
150
+ Style/KeywordParametersOrder:
151
+ Exclude:
152
+ - 'lib/rspec/hive/exponential_backoff.rb'
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.3.3
1
+ ruby-2.7.6
data/Gemfile CHANGED
@@ -5,11 +5,11 @@ source 'https://rubygems.org'
5
5
  gemspec
6
6
 
7
7
  group :test do
8
- gem 'bundler', '~> 1.15'
8
+ gem 'bundler'
9
9
  gem 'codeclimate-test-reporter', '~> 0.4'
10
- gem 'rspec-its', '~> 1.2'
11
- gem 'rubocop', '~> 0.51.0'
12
- gem 'rubocop-rspec', '~> 1.19.0'
10
+ gem 'rspec-its'
11
+ gem 'rubocop', '~> 1.36.0'
12
+ gem 'rubocop-rspec', '~> 2.13.2'
13
13
  end
14
14
 
15
15
  group :development do
@@ -81,12 +81,14 @@ module RSpec
81
81
 
82
82
  def partition_value(table_schema, key, value)
83
83
  return value if table_schema.partitions.detect { |x| x.name == key && x.type == :int }
84
+
84
85
  "'#{value}'"
85
86
  end
86
87
 
87
88
  def load_file_to_hive_table(table_name, path, partition_clause = nil)
88
89
  request_txt = "load data local inpath '#{path}' into table #{table_name}"
89
90
  return execute(request_txt) if partition_clause.nil?
91
+
90
92
  execute("#{request_txt} #{partition_clause}")
91
93
  end
92
94
 
@@ -22,6 +22,7 @@ RSpec::Matchers.define :match_result_set do |expected|
22
22
  end
23
23
  elsif expected_row.respond_to?(:each)
24
24
  raise ArgumentError, "Can't use partially matcher with Arrays" if @partial_match
25
+
25
26
  result_set_match?(
26
27
  actual[i], expected_row,
27
28
  actual_transformer: ->(candidate) { candidate.values }
@@ -58,6 +59,7 @@ RSpec::Matchers.define :match_result_set do |expected|
58
59
  values_match?(expected_transformer.call(expected_row), actual_transformer.call(candidate))
59
60
  end
60
61
  return false unless found_index
62
+
61
63
  found = @actual[found_index]
62
64
  @actual.delete_at(found_index)
63
65
  @diffable_actual << diffable_transformer.call(found)
@@ -48,23 +48,23 @@ namespace :spec do
48
48
  end
49
49
 
50
50
  namespace :docker do
51
- desc 'Runs docker using hive config file.'\
52
- ' It assumes your docker-machine is running.'
51
+ desc 'Runs docker using hive config file.' \
52
+ ' It assumes your docker-machine is running.'
53
53
  task :run do
54
54
  raise 'Command `docker` not found.'.red unless system('which docker')
55
55
 
56
56
  config_filepath = ENV['CONFIG_FILE'] || File.join('config', 'rspec-hive.yml')
57
57
  unless File.exist? config_filepath
58
- raise "There's no config file #{config_filepath} please"\
59
- 'generate default or provide custom config.'.red
58
+ raise "There's no config file #{config_filepath} please" \
59
+ 'generate default or provide custom config.'.red
60
60
  end
61
61
 
62
62
  interpolated = ERB.new(File.read(config_filepath)).result
63
63
  config = YAML.safe_load(interpolated)['hive']
64
64
 
65
65
  docker_image_name = ENV['DOCKER_IMAGE_NAME'] || 'nielsensocial/hive'
66
- cmd = "docker run -v #{config['host_shared_directory_path']}:"\
67
- "#{config['docker_shared_directory_path']}"\
66
+ cmd = "docker run -v #{config['host_shared_directory_path']}:" \
67
+ "#{config['docker_shared_directory_path']}" \
68
68
  " -d -p #{config['port']}:10000 #{docker_image_name}"
69
69
 
70
70
  puts "Running `#{cmd}`...".green
@@ -84,13 +84,14 @@ namespace :spec do
84
84
 
85
85
  def container_id
86
86
  return ENV['CONTAINER_ID'] if ENV['CONTAINER_ID']
87
+
87
88
  docker_conatiners = `docker ps`.lines
88
- if docker_conatiners.size != 2
89
- raise 'There is more than 1 instance of docker container running (or no running docker containers). '\
90
- 'Check `docker ps` and stop containers that are not in use right now or specify CONTAINER_ID '\
91
- 'and run this command again.'.red
92
- else
89
+ if docker_conatiners.size == 2
93
90
  docker_conatiners[1].split[0]
91
+ else
92
+ raise 'There is more than 1 instance of docker container running (or no running docker containers). ' \
93
+ 'Check `docker ps` and stop containers that are not in use right now or specify CONTAINER_ID ' \
94
+ 'and run this command again.'.red
94
95
  end
95
96
  end
96
97
 
@@ -103,11 +104,13 @@ namespace :spec do
103
104
 
104
105
  host_hive_udfs_path = File.join(config['host_shared_directory_path'], 'hive-udfs.jar')
105
106
  raise 'Please provide UDFS_PATH'.red unless udfs_path
107
+
106
108
  if udfs_path.start_with?('s3://')
107
109
  puts 'Downloading from s3...'.yellow
108
110
  cmd = "aws s3 ls #{udfs_path}"
109
111
 
110
112
  raise 'awscli is not configured.'.red unless system(cmd)
113
+
111
114
  cmd = "aws s3 cp #{udfs_path} #{host_hive_udfs_path}"
112
115
  else
113
116
  puts 'Copying from local directory...'.yellow
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RSpec
4
4
  module Hive
5
- VERSION = '0.6.2'
5
+ VERSION = '0.6.3'
6
6
  end
7
7
  end
data/rspec-hive.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  # frozen_string_literal: true
3
3
 
4
- lib = File.expand_path('../lib', __FILE__)
4
+ lib = File.expand_path('lib', __dir__)
5
5
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
6
  require 'rspec/hive/version'
7
7
 
@@ -18,13 +18,12 @@ Gem::Specification.new do |spec|
18
18
 
19
19
  spec.files = `git ls-files -z`.split("\x0")
20
20
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
21
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
22
21
  spec.require_paths = ['lib']
23
22
 
24
- spec.add_dependency 'colorize', '~> 0.8.0'
25
- spec.add_dependency 'faker', '~> 1.6'
26
- spec.add_dependency 'rake', ['>= 10.0', '< 13.0']
23
+ spec.add_dependency 'colorize', '~> 0.8.1'
24
+ spec.add_dependency 'faker', '~> 1.9'
25
+ spec.add_dependency 'rake', ['>= 10.0']
27
26
  spec.add_dependency 'rbhive-u2i', '~> 1.0'
28
27
  spec.add_dependency 'retryable', '~> 3.0'
29
- spec.add_dependency 'rspec', '~> 3.4'
28
+ spec.add_dependency 'rspec', '~> 3.11.0'
30
29
  end
@@ -35,6 +35,7 @@ RSpec.describe RSpec::Hive do
35
35
  expect(described_class).to receive(:new_configuration).with(file_name) { configuration_mock }
36
36
  configure
37
37
  end
38
+
38
39
  its(:host) { is_expected.to eq(expected_host) }
39
40
  its(:port) { is_expected.to eq(expected_port) }
40
41
  its(:host_shared_directory_path) { is_expected.to eq(expected_host_shared_directory_path) }
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-hive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wojtek Mielczarek
8
8
  - Mikołaj Nowak
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-01-30 00:00:00.000000000 Z
12
+ date: 2022-10-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: colorize
@@ -17,28 +17,28 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 0.8.0
20
+ version: 0.8.1
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 0.8.0
27
+ version: 0.8.1
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: faker
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '1.6'
34
+ version: '1.9'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '1.6'
41
+ version: '1.9'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rake
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -46,9 +46,6 @@ dependencies:
46
46
  - - ">="
47
47
  - !ruby/object:Gem::Version
48
48
  version: '10.0'
49
- - - "<"
50
- - !ruby/object:Gem::Version
51
- version: '13.0'
52
49
  type: :runtime
53
50
  prerelease: false
54
51
  version_requirements: !ruby/object:Gem::Requirement
@@ -56,9 +53,6 @@ dependencies:
56
53
  - - ">="
57
54
  - !ruby/object:Gem::Version
58
55
  version: '10.0'
59
- - - "<"
60
- - !ruby/object:Gem::Version
61
- version: '13.0'
62
56
  - !ruby/object:Gem::Dependency
63
57
  name: rbhive-u2i
64
58
  requirement: !ruby/object:Gem::Requirement
@@ -93,14 +87,14 @@ dependencies:
93
87
  requirements:
94
88
  - - "~>"
95
89
  - !ruby/object:Gem::Version
96
- version: '3.4'
90
+ version: 3.11.0
97
91
  type: :runtime
98
92
  prerelease: false
99
93
  version_requirements: !ruby/object:Gem::Requirement
100
94
  requirements:
101
95
  - - "~>"
102
96
  - !ruby/object:Gem::Version
103
- version: '3.4'
97
+ version: 3.11.0
104
98
  description: |-
105
99
  RSpecHive let you test your hive queries
106
100
  connecting to hive instance installed on docker
@@ -161,7 +155,7 @@ homepage: https://github.com/u2i/ns-rspec-hive
161
155
  licenses:
162
156
  - MIT
163
157
  metadata: {}
164
- post_install_message:
158
+ post_install_message:
165
159
  rdoc_options: []
166
160
  require_paths:
167
161
  - lib
@@ -176,19 +170,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
176
170
  - !ruby/object:Gem::Version
177
171
  version: '0'
178
172
  requirements: []
179
- rubyforge_project:
180
- rubygems_version: 2.6.14
181
- signing_key:
173
+ rubygems_version: 3.1.6
174
+ signing_key:
182
175
  specification_version: 4
183
176
  summary: RSpec addition to test hive queries
184
- test_files:
185
- - spec/lib/rspec/hive/configuration_spec.rb
186
- - spec/lib/rspec/hive/connection_delegator_spec.rb
187
- - spec/lib/rspec/hive/connector_spec.rb
188
- - spec/lib/rspec/hive/db_name_spec.rb
189
- - spec/lib/rspec/hive/matchers_spec.rb
190
- - spec/lib/rspec/hive/query_builder/row_transformer_spec.rb
191
- - spec/lib/rspec/hive/query_builder_helper_spec.rb
192
- - spec/lib/rspec/hive/query_builder_spec.rb
193
- - spec/lib/rspec/hive_spec.rb
194
- - spec/spec_helper.rb
177
+ test_files: []