lhc 13.0.0 → 15.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rubocop.yml +15 -0
  3. data/.github/workflows/test.yml +15 -0
  4. data/.rubocop.yml +344 -19
  5. data/.ruby-version +1 -1
  6. data/README.md +89 -0
  7. data/Rakefile +3 -3
  8. data/lhc.gemspec +3 -1
  9. data/lib/lhc.rb +70 -59
  10. data/lib/lhc/concerns/lhc/fix_invalid_encoding_concern.rb +1 -0
  11. data/lib/lhc/config.rb +16 -0
  12. data/lib/lhc/endpoint.rb +3 -0
  13. data/lib/lhc/error.rb +7 -4
  14. data/lib/lhc/interceptor.rb +4 -0
  15. data/lib/lhc/interceptors.rb +1 -0
  16. data/lib/lhc/interceptors/auth.rb +10 -5
  17. data/lib/lhc/interceptors/caching.rb +14 -3
  18. data/lib/lhc/interceptors/logging.rb +4 -2
  19. data/lib/lhc/interceptors/monitoring.rb +46 -11
  20. data/lib/lhc/interceptors/retry.rb +2 -0
  21. data/lib/lhc/interceptors/rollbar.rb +3 -2
  22. data/lib/lhc/interceptors/throttle.rb +7 -2
  23. data/lib/lhc/interceptors/zipkin.rb +2 -0
  24. data/lib/lhc/request.rb +37 -4
  25. data/lib/lhc/response.rb +1 -0
  26. data/lib/lhc/response/data.rb +1 -1
  27. data/lib/lhc/scrubber.rb +45 -0
  28. data/lib/lhc/scrubbers/auth_scrubber.rb +33 -0
  29. data/lib/lhc/scrubbers/body_scrubber.rb +28 -0
  30. data/lib/lhc/scrubbers/headers_scrubber.rb +38 -0
  31. data/lib/lhc/scrubbers/params_scrubber.rb +14 -0
  32. data/lib/lhc/version.rb +1 -1
  33. data/spec/config/scrubs_spec.rb +108 -0
  34. data/spec/error/to_s_spec.rb +13 -8
  35. data/spec/formats/multipart_spec.rb +2 -2
  36. data/spec/formats/plain_spec.rb +1 -1
  37. data/spec/interceptors/after_response_spec.rb +1 -1
  38. data/spec/interceptors/caching/main_spec.rb +2 -2
  39. data/spec/interceptors/caching/multilevel_cache_spec.rb +2 -1
  40. data/spec/interceptors/define_spec.rb +1 -0
  41. data/spec/interceptors/logging/main_spec.rb +21 -1
  42. data/spec/interceptors/monitoring/caching_spec.rb +66 -0
  43. data/spec/interceptors/response_competition_spec.rb +2 -2
  44. data/spec/interceptors/return_response_spec.rb +2 -2
  45. data/spec/interceptors/rollbar/main_spec.rb +27 -15
  46. data/spec/request/scrubbed_headers_spec.rb +101 -0
  47. data/spec/request/scrubbed_options_spec.rb +194 -0
  48. data/spec/request/scrubbed_params_spec.rb +35 -0
  49. data/spec/response/data_spec.rb +2 -2
  50. data/spec/support/zipkin_mock.rb +1 -0
  51. metadata +40 -21
  52. data/.rubocop.localch.yml +0 -325
  53. data/cider-ci.yml +0 -5
  54. data/cider-ci/bin/bundle +0 -51
  55. data/cider-ci/bin/ruby_install +0 -8
  56. data/cider-ci/bin/ruby_version +0 -25
  57. data/cider-ci/jobs/rspec-activesupport-5.yml +0 -27
  58. data/cider-ci/jobs/rspec-activesupport-6.yml +0 -28
  59. data/cider-ci/jobs/rubocop.yml +0 -18
  60. data/cider-ci/task_components/bundle.yml +0 -22
  61. data/cider-ci/task_components/rspec.yml +0 -36
  62. data/cider-ci/task_components/rubocop.yml +0 -29
  63. data/cider-ci/task_components/ruby.yml +0 -15
data/cider-ci.yml DELETED
@@ -1,5 +0,0 @@
1
- jobs:
2
- include:
3
- - cider-ci/jobs/rspec-activesupport-5.yml
4
- - cider-ci/jobs/rspec-activesupport-6.yml
5
- - cider-ci/jobs/rubocop.yml
data/cider-ci/bin/bundle DELETED
@@ -1,51 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -eux
3
-
4
- export PATH=~/.rubies/$RUBY/bin:$PATH
5
- rm -f .bundle/config
6
-
7
- if [ ! -f ~/.rubies/$RUBY/bin/bundle ]; then
8
- gem install bundler
9
- fi
10
-
11
- # install bundler v. 1.17.3 in order to be able to run the tests with
12
- # ACTIVESUPPORT=4 because rails (= 4.2.0) depends on bundler (< 2.0, >= 1.3.0)
13
- gem install bundler:1.17.3
14
-
15
- sed "s/^source 'https:\/\/rubygems\.intra\.local\.ch'*/source 'http\:\/\/52.29.7.59:9292'/g" Gemfile > Gemfile.tmp
16
- mv Gemfile.tmp Gemfile
17
-
18
- DIGEST=$(git ls-tree HEAD --\
19
- cider-ci.yml cider-ci Gemfile.lock \
20
- | openssl dgst -sha1 | cut -d ' ' -f 2)
21
-
22
- if [ ! -z ${ACTIVESUPPORT:-} ]; then
23
- DIGEST=$(echo "$DIGEST $ACTIVESUPPORT")
24
- fi
25
-
26
- DIGEST=$(echo "$DIGEST $PATH" \
27
- | openssl dgst -sha1 | cut -d ' ' -f 2)
28
-
29
- echo "DIGEST"
30
- echo "${DIGEST}"
31
-
32
- CACHE_SIGNATURE_FILE="/tmp/bundle_cache_signature_${DIGEST}"
33
-
34
- if [ ! -f $CACHE_SIGNATURE_FILE ] ; then
35
- if [ ! -z ${ACTIVESUPPORT:-} ]; then
36
- if [ ! -z ${BUNDLER:-} ]; then
37
- echo "BUNDLE_GEMFILE=Gemfile.activesupport$ACTIVESUPPORT bundle $BUNDLER install"
38
- BUNDLE_GEMFILE=Gemfile.activesupport$ACTIVESUPPORT bundle $BUNDLER install
39
- else
40
- echo "BUNDLE_GEMFILE=Gemfile.activesupport$ACTIVESUPPORT bundle install"
41
- BUNDLE_GEMFILE=Gemfile.activesupport$ACTIVESUPPORT bundle install
42
- fi
43
- else
44
- echo "bundle install"
45
- bundle $BUNDLER install
46
- fi
47
- touch $CACHE_SIGNATURE_FILE
48
- fi
49
-
50
- echo "bundle install"
51
- bundle $BUNDLER install
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -eux
3
-
4
- export PATH=~/.rubies/$RUBY/bin:$PATH
5
-
6
- if [ ! -d ~/.rubies/$RUBY ]; then
7
- ruby-install --no-install-deps $RUBY
8
- fi
@@ -1,25 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -eux
3
-
4
- if [ -f ./.ruby-version ]; then
5
- echo ".ruby-version file found"
6
- fi
7
-
8
- if [ ! -f ./.ruby-version ]; then
9
- echo ".ruby-version file not found"
10
- exit 1
11
- fi
12
-
13
- IFS='-' read -ra EXPLODED_RUBY <<< "$RUBY"
14
-
15
- if [ "${#EXPLODED_RUBY[@]}" == "1" ]; then
16
- echo 'No engine/version separator "-" found in .ruby-version file.'
17
- exit 1
18
- fi
19
-
20
- if [ "${#EXPLODED_RUBY[@]}" != "1" ] && [ "${#EXPLODED_RUBY[@]}" != "2" ]; then
21
- echo "Unknown format of .ruby-version file"
22
- exit 1
23
- fi
24
-
25
- echo $RUBY
@@ -1,27 +0,0 @@
1
- rspec-active-support-v5:
2
- name: 'rspec with ActiveSupport v5'
3
-
4
- run_when:
5
- 'some HEAD has been updated':
6
- type: branch
7
- include_match: ^.*$
8
-
9
- context:
10
-
11
- script_defaults:
12
- template_environment_variables: true
13
-
14
- task_defaults:
15
- environment_variables:
16
- ACTIVESUPPORT: '5'
17
-
18
- max_trials: 2
19
- dispatch_storm_delay_duration: 1 Seconds
20
- include:
21
- - cider-ci/task_components/ruby.yml
22
- - cider-ci/task_components/bundle.yml
23
- - cider-ci/task_components/rspec.yml
24
-
25
- tasks:
26
- all-rspec:
27
- name: All rspec tests, using ActiveSupport v5
@@ -1,28 +0,0 @@
1
- rspec-active-support-v6:
2
- name: 'rspec with ActiveSupport v6'
3
-
4
- run_when:
5
- 'some HEAD has been updated':
6
- type: branch
7
- include_match: ^.*$
8
-
9
- context:
10
-
11
- script_defaults:
12
- template_environment_variables: true
13
-
14
- task_defaults:
15
- environment_variables:
16
- ACTIVESUPPORT: '6'
17
- RUBY: 'ruby-2.6.3'
18
-
19
- max_trials: 2
20
- dispatch_storm_delay_duration: 1 Seconds
21
- include:
22
- - cider-ci/task_components/ruby.yml
23
- - cider-ci/task_components/bundle.yml
24
- - cider-ci/task_components/rspec.yml
25
-
26
- tasks:
27
- all-rspec:
28
- name: All rspec tests, using ActiveSupport v6
@@ -1,18 +0,0 @@
1
- rubocop:
2
- name: 'Rubocop'
3
-
4
- run_when:
5
- 'some HEAD has been updated':
6
- type: branch
7
- include_match: ^.*$
8
-
9
- context:
10
-
11
- tasks:
12
-
13
- rubocop:
14
-
15
- include:
16
- - cider-ci/task_components/ruby.yml
17
- - cider-ci/task_components/bundle.yml
18
- - cider-ci/task_components/rubocop.yml
@@ -1,22 +0,0 @@
1
- traits:
2
- ruby-install: true
3
- Bash: true
4
-
5
- trial_attachments:
6
- gemfile:
7
- include_match: Gemfile
8
- content_type: text/plain
9
-
10
- environment_variables:
11
- BUNDLER: '_1.17.3_'
12
-
13
- scripts:
14
-
15
- bundle:
16
- exclusive_executor_resource: ruby-install_{{$RUBY}}
17
- timeout: 20 Minutes
18
- body: cider-ci/bin/bundle
19
- start_when:
20
- 'ruby installed':
21
- script_key: ruby-install
22
-
@@ -1,36 +0,0 @@
1
- ports:
2
- CAPYBARA_PORT:
3
- min: 8000
4
- max: 8999
5
- PHANTOMJS_PORT:
6
- min: 44600
7
- max: 44999
8
-
9
- environment_variables:
10
- RUBY:
11
- read_and_replace_with: .ruby-version
12
- RAILS_ENV: 'test'
13
-
14
- scripts:
15
- rspec:
16
- body: |
17
- #!/usr/bin/env bash
18
- set -eux
19
- mkdir -p tmp/cache
20
- export PATH=~/.rubies/$RUBY/bin:$PATH
21
- if [ ! -z ${ACTIVESUPPORT:-} ]; then BUNDLE_GEMFILE=Gemfile.activesupport$ACTIVESUPPORT bundle $BUNDLER exec rspec; else bundle exec rspec; fi
22
-
23
- start_when:
24
- 'bundled':
25
- script_key: bundle
26
-
27
- trial_attachments:
28
- logs:
29
- include_match: log\/.*\.log$
30
- content_type: text/plain
31
- image-screenshots:
32
- include_match: tmp\/capybara\/.*\.png$
33
- content_type: image/png
34
- html-screenshots:
35
- include_match: tmp\/capybara\/.*\.html$
36
- content_type: text/html
@@ -1,29 +0,0 @@
1
- trial_attachments:
2
- logs:
3
- include_match: tmp\/checkstyle.json$
4
- content_type: application/json
5
-
6
- tree_attachments:
7
- logs:
8
- include_match: tmp\/checkstyle.json$
9
- content_type: application/json
10
-
11
- environment_variables:
12
- RUBY:
13
- read_and_replace_with: .ruby-version
14
- RESULT_PATH: 'tmp/checkstyle.json'
15
-
16
- max_trials: 1
17
-
18
- scripts:
19
- rubocop:
20
- start_when:
21
- 'bundled':
22
- script_key: bundle
23
- body: |
24
- #!/usr/bin/env bash
25
- set -eux
26
- mkdir -p tmp/cache
27
- export PATH=~/.rubies/$RUBY/bin:$PATH
28
- bundle exec rubocop --config .rubocop.yml \
29
- --format json --out $RESULT_PATH --format progress
@@ -1,15 +0,0 @@
1
- environment_variables:
2
- RUBY:
3
- read_and_replace_with: .ruby-version
4
-
5
- scripts:
6
- ruby-version:
7
- body: cider-ci/bin/ruby_version
8
- ruby-install:
9
- exclusive_executor_resource: ruby-install_{{$RUBY}}
10
- timeout: 20 Minutes
11
- body: cider-ci/bin/ruby_install
12
- start_when:
13
- 'ruby version checked':
14
- script_key: ruby-version
15
-