diff --git a/.travis.yml b/.travis.yml index 2ea70050d..e8ecde0fd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,6 +51,7 @@ jobs: - RAILS_ENV=test bundle exec rake db:create db:structure:load db:migrate - RAILS_ENV=test bundle exec rake db:second_base:create db:second_base:structure:load db:second_base:migrate - RAILS_ENV=test bundle exec rake db:seed + - cd pgq-processors && gem install bundler -v '< 2' && cd .. - cd pgq-processors && bundle install --gemfile="./Gemfile" && cd .. - cd pgq-processors && BUNDLE_GEMFILE=./Gemfile ./bin/bundle exec rspec && cd .. diff --git a/app/resources/api/rest/admin/destination_resource.rb b/app/resources/api/rest/admin/destination_resource.rb index 4d7820c97..6b227525a 100644 --- a/app/resources/api/rest/admin/destination_resource.rb +++ b/app/resources/api/rest/admin/destination_resource.rb @@ -3,7 +3,7 @@ class Api::Rest::Admin::DestinationResource < JSONAPI::Resource attributes :enabled, :next_rate, :connect_fee, :initial_interval, :next_interval, :dp_margin_fixed, :dp_margin_percent, :initial_rate, :asr_limit, :acd_limit, :short_calls_limit, :prefix, :reject_calls, :use_dp_intervals, :valid_from, :valid_till, :external_id, - :routing_tag_ids + :routing_tag_ids, :dst_number_min_length, :dst_number_max_length has_one :rateplan has_one :rate_policy, class_name: 'DestinationRatePolicy' @@ -12,30 +12,32 @@ class Api::Rest::Admin::DestinationResource < JSONAPI::Resource filters :external_id, :prefix, :rateplan_id - def self.updatable_fields(context) - [ - :enabled, - :prefix, - :rateplan, - :next_rate, - :connect_fee, - :initial_interval, - :next_interval, - :dp_margin_fixed, - :dp_margin_percent, - :rate_policy, - :initial_rate, - :reject_calls, - :use_dp_intervals, - :valid_from, - :valid_till, - :profit_control_mode, - :routing_tag_mode, - :external_id, - :asr_limit, - :acd_limit, - :short_calls_limit, - :routing_tag_ids + def self.updatable_fields(_context) + %i[ + enabled + prefix + rateplan + next_rate + connect_fee + initial_interval + next_interval + dp_margin_fixed + dp_margin_percent + rate_policy + initial_rate + reject_calls + use_dp_intervals + valid_from + valid_till + profit_control_mode + routing_tag_mode + external_id + asr_limit + acd_limit + short_calls_limit + routing_tag_ids + dst_number_min_length + dst_number_max_length ] end diff --git a/app/resources/api/rest/admin/dialpeer_resource.rb b/app/resources/api/rest/admin/dialpeer_resource.rb index 9f92534bc..f6f5d1912 100644 --- a/app/resources/api/rest/admin/dialpeer_resource.rb +++ b/app/resources/api/rest/admin/dialpeer_resource.rb @@ -4,7 +4,7 @@ class Api::Rest::Admin::DialpeerResource < JSONAPI::Resource :prefix, :src_rewrite_rule, :dst_rewrite_rule, :acd_limit, :asr_limit, :src_rewrite_result, :dst_rewrite_result, :locked, :priority, :exclusive_route, :capacity, :lcr_rate_multiplier, :force_hit_rate, :network_prefix_id, :created_at, :short_calls_limit, :external_id, - :routing_tag_ids + :routing_tag_ids, :dst_number_min_length, :dst_number_max_length has_one :gateway has_one :gateway_group @@ -17,40 +17,42 @@ class Api::Rest::Admin::DialpeerResource < JSONAPI::Resource filters :external_id, :prefix, :routing_group_id - def self.updatable_fields(context) - [ - :enabled, - :prefix, - :src_rewrite_rule, - :dst_rewrite_rule, - :acd_limit, - :asr_limit, - :gateway, - :routing_group, - :next_rate, - :connect_fee, - :vendor, - :account, - :routing_tag_mode, - :src_rewrite_result, - :dst_rewrite_result, - :locked, - :priority, - :exclusive_route, - :capacity, - :lcr_rate_multiplier, - :initial_rate, - :initial_interval, - :next_interval, - :valid_from, - :valid_till, - :gateway_group, - :force_hit_rate, - :network_prefix_id, - :created_at, - :short_calls_limit, - :external_id, - :routing_tag_ids + def self.updatable_fields(_context) + %i[ + enabled + prefix + src_rewrite_rule + dst_rewrite_rule + acd_limit + asr_limit + gateway + routing_group + next_rate + connect_fee + vendor + account + routing_tag_mode + src_rewrite_result + dst_rewrite_result + locked + priority + exclusive_route + capacity + lcr_rate_multiplier + initial_rate + initial_interval + next_interval + valid_from + valid_till + gateway_group + force_hit_rate + network_prefix_id + created_at + short_calls_limit + external_id + routing_tag_ids + dst_number_min_length + dst_number_max_length ] end diff --git a/ci/build_jessie.Dockerfile b/ci/build_jessie.Dockerfile index 368716d5f..5682c14a2 100644 --- a/ci/build_jessie.Dockerfile +++ b/ci/build_jessie.Dockerfile @@ -3,7 +3,7 @@ FROM debian:jessie RUN apt-get update && apt-get -y dist-upgrade && apt-get -y --no-install-recommends install wget RUN wget http://pkg.yeti-switch.org/key.gpg -O - | apt-key add - -RUN echo "deb http://pkg.yeti-switch.org/debian/jessie unstable main ext" >> /etc/apt/sources.list +RUN echo "deb http://pkg.yeti-switch.org/debian/jessie 1.7 main" >> /etc/apt/sources.list RUN echo "deb http://deb.debian.org/debian buster main contrib non-free" >> /etc/apt/sources.list RUN echo "Package: *\nPin: release n=buster\nPin-Priority: 50\n\nPackage: python-git python-gitdb python-smmap python-tzlocal\nPin: release n=buster\nPin-Priority: 500\n\n" | tee /etc/apt/preferences diff --git a/ci/build_stretch.Dockerfile b/ci/build_stretch.Dockerfile index e812d520f..b6d63bac7 100644 --- a/ci/build_stretch.Dockerfile +++ b/ci/build_stretch.Dockerfile @@ -3,7 +3,7 @@ FROM debian:stretch RUN apt-get update && apt-get -y dist-upgrade && apt-get -y --no-install-recommends install wget gnupg RUN wget http://pkg.yeti-switch.org/key.gpg -O - | apt-key add - -RUN echo "deb http://pkg.yeti-switch.org/debian/stretch unstable main ext" >> /etc/apt/sources.list +RUN echo "deb http://pkg.yeti-switch.org/debian/stretch 1.7 main" >> /etc/apt/sources.list RUN echo "deb http://deb.debian.org/debian buster main contrib non-free" >> /etc/apt/sources.list RUN echo "Package: *\nPin: release n=buster\nPin-Priority: 50\n\nPackage: python-git python-gitdb python-smmap python-tzlocal\nPin: release n=buster\nPin-Priority: 500\n\n" | tee /etc/apt/preferences diff --git a/pgq-processors/Gemfile b/pgq-processors/Gemfile index 1b07f0e94..408412108 100644 --- a/pgq-processors/Gemfile +++ b/pgq-processors/Gemfile @@ -1,7 +1,6 @@ source "http://rubygems.org" gem 'rake' -gem 'bundler' gem 'pgq', path: 'ext/pgq' gem 'pg' gem 'activeresource' diff --git a/pgq-processors/Gemfile.lock b/pgq-processors/Gemfile.lock index 849b1be68..e48bf301e 100644 --- a/pgq-processors/Gemfile.lock +++ b/pgq-processors/Gemfile.lock @@ -104,7 +104,6 @@ PLATFORMS DEPENDENCIES activeresource activeresource-persistent - bundler bunny bunny-mock byebug diff --git a/pgq-processors/Makefile b/pgq-processors/Makefile index 8e54856f2..3d0dc445d 100644 --- a/pgq-processors/Makefile +++ b/pgq-processors/Makefile @@ -7,7 +7,7 @@ all: all_env: @$(info:msg=PGQ: install bundler) - @gem install --install-dir vendor/bundler bundler + @gem install --install-dir vendor/bundler bundler -v '< 2' @$(info:msg=PGQ: install gems) @vendor/bundler/bin/bundle install --jobs=4 --frozen --deployment --binstubs diff --git a/spec/acceptance/rest/admin/api/destinations_spec.rb b/spec/acceptance/rest/admin/api/destinations_spec.rb index cdb8b0a98..1577c6bf1 100644 --- a/spec/acceptance/rest/admin/api/destinations_spec.rb +++ b/spec/acceptance/rest/admin/api/destinations_spec.rb @@ -10,11 +10,14 @@ let(:auth_token) { ::Knock::AuthToken.new(payload: { sub: user.id }).token } let(:type) { 'destinations' } - required_params = %i( + required_params = %i[ enabled next-rate connect-fee initial-interval next-interval dp-margin-fixed dp-margin-percent initial-rate asr-limit acd-limit short-calls-limit - ) - optional_params = %i(prefix reject-calls use-dp-intervals valid-from valid-till external-id routing-tag-ids) + ] + optional_params = %i[ + prefix reject-calls use-dp-intervals valid-from valid-till external-id routing-tag-ids + dst_number-min-length dst-number-max-length + ] required_relationships = %i(rateplan rate-policy) optional_relationships = %i(profit-control-mode routing-tag-modes) @@ -51,6 +54,8 @@ let(:'dp-margin-fixed') { 0 } let(:'dp-margin-percent') { 0 } let(:'rate-policy') { wrap_relationship(:'destination-rate-policies', 1) } + let(:'dst-number-min-length') { 0 } + let(:'dst-number-max-length') { 100 } example_request 'create new entry' do expect(status).to eq(201) diff --git a/spec/acceptance/rest/admin/api/dialpeers_spec.rb b/spec/acceptance/rest/admin/api/dialpeers_spec.rb index c7bc512c9..ab50fa3c8 100644 --- a/spec/acceptance/rest/admin/api/dialpeers_spec.rb +++ b/spec/acceptance/rest/admin/api/dialpeers_spec.rb @@ -10,15 +10,16 @@ let(:auth_token) { ::Knock::AuthToken.new(payload: { sub: user.id }).token } let(:type) { 'dialpeers' } - required_params = %i( + required_params = %i[ enabled next-rate connect-fee initial-rate initial-interval next-interval valid-from valid-till - ) + ] - optional_params = %i( + optional_params = %i[ prefix src-rewrite-rule dst-rewrite-rule acd-limit asr-limit src-rewrite-result dst-rewrite-result locked priority exclusive-route capacity lcr-rate-multiplier force-hit-rate network-prefix-id created-at short-calls-limit external-id routing-tag-ids - ) + dst_number-min-length dst-number-max-length + ] required_relationships = %i(routing-group vendor account) optional_relationships = %i(gateway gateway-group routing-tag-modes) @@ -58,6 +59,8 @@ let(:'next-interval') { 60 } let(:'initial-rate') { 0.0 } let(:'next-rate') { 0.0 } + let(:'dst-number-min-length') { 0 } + let(:'dst-number-max-length') { 100 } example_request 'create new entry' do expect(status).to eq(201)