From 18503c7d6ca50c511eeacb8beeb9ed648a325c90 Mon Sep 17 00:00:00 2001 From: Joseph Kotanchik Date: Thu, 22 Aug 2024 11:22:15 -0400 Subject: [PATCH 1/4] MAT-7487: Bump cqm-reports to 4.1.2. Update Gemfile.lock. --- Gemfile | 2 +- Gemfile.lock | 25 ++++++++++++------------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/Gemfile b/Gemfile index c8c3ea0..d61d928 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,7 @@ source "https://rubygems.org" gem 'sinatra' gem 'passenger' gem 'rest-client' -gem 'cqm-reports', '4.1.1' +gem 'cqm-reports', '4.1.2' gem 'rackup', '~> 2.1' gem 'rack-contrib', '~> 2.5', '>= 2.5.0' gem 'jwt' diff --git a/Gemfile.lock b/Gemfile.lock index 46fcf06..5df8807 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -22,10 +22,10 @@ GEM tzinfo (~> 2.0) base64 (0.2.0) bigdecimal (3.1.8) - bson (5.0.0) - concurrent-ruby (1.3.3) + bson (5.0.1) + concurrent-ruby (1.3.4) connection_pool (2.4.1) - cqm-reports (4.1.1) + cqm-reports (4.1.2) cqm-models (~> 4.0) cqm-validators (~> 4.0) erubis (~> 2.7) @@ -57,31 +57,30 @@ GEM mime-types-data (3.2024.0206) mini_portile2 (2.8.7) minitest (5.22.2) - mongo (2.20.0) + mongo (2.20.1) bson (>= 4.14.1, < 6.0.0) - mongoid (8.1.5) + mongoid (9.0.1) activemodel (>= 5.1, < 7.2, != 7.0.0) concurrent-ruby (>= 1.0.5, < 2.0) mongo (>= 2.18.0, < 3.0.0) - ruby2_keywords (~> 0.0.5) - mongoid-tree (2.2.0) - mongoid (>= 4.0, < 9) + mongoid-tree (2.3.0) + mongoid (>= 4.0, < 10) mustache (1.1.1) mustermann (3.0.0) ruby2_keywords (~> 0.0.1) mutex_m (0.2.0) netrc (0.11.0) - nokogiri (1.16.6) + nokogiri (1.16.7) mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.16.6-arm64-darwin) + nokogiri (1.16.7-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.6-x86_64-linux) + nokogiri (1.16.7-x86_64-linux) racc (~> 1.4) passenger (6.0.20) rack rake (>= 0.8.1) - racc (1.8.0) + racc (1.8.1) rack (3.1.4) rack-contrib (2.5.0) rack (< 4) @@ -126,7 +125,7 @@ PLATFORMS DEPENDENCIES cqm-models! - cqm-reports (= 4.1.1) + cqm-reports (= 4.1.2) jwt minitest passenger From a75657d1d4b7bf719e36dc0175efce29e0e8351e Mon Sep 17 00:00:00 2001 From: Joseph Kotanchik Date: Thu, 22 Aug 2024 11:22:45 -0400 Subject: [PATCH 2/4] MAT-7487: Check incoming measure data is present before parsing. --- service/web_controller.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/service/web_controller.rb b/service/web_controller.rb index 6758717..096c76c 100644 --- a/service/web_controller.rb +++ b/service/web_controller.rb @@ -71,7 +71,10 @@ def as_json(*args) measure_dto = request.params # Uses the Rack::JSONBodyParser middleware # Prepare CQM Measure - madie_measure = JSON.parse(measure_dto["measure"],max_nesting: 512) + if measure_dto["measure"].nil? + return [400, "Measure is empty."] + end + madie_measure = JSON.parse(measure_dto["measure"], max_nesting: 512) measure = CQM::Measure.new(madie_measure) unless measure_dto["measure"].nil? if measure.nil? return [400, "Measure is empty."] From a47073996ee3711302426de8929d87c8fe591ff2 Mon Sep 17 00:00:00 2001 From: Joseph Kotanchik Date: Thu, 22 Aug 2024 11:23:31 -0400 Subject: [PATCH 3/4] MAT-7487: Enable unit tests on GitHub CI. --- .github/workflows/build.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6aa334d..d9f808f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,6 +31,5 @@ jobs: with: ruby-version: ${{ matrix.ruby-version }} bundler-cache: true # runs 'bundle install' and caches installed gems automatically -# No tests yet -# - name: Run tests -# run: bundle exec rake + - name: Run tests + run: bundle exec rake From 604571aa9f234e0caf21a6bd6789564c733592da Mon Sep 17 00:00:00 2001 From: Joseph Kotanchik Date: Thu, 22 Aug 2024 11:31:48 -0400 Subject: [PATCH 4/4] MAT-7487: Add Rakefile to run unit tests on CI. --- Rakefile | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Rakefile diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..06d32d3 --- /dev/null +++ b/Rakefile @@ -0,0 +1,5 @@ +task default: %w[test] + +task :test do + ruby "test/service/web_controller_test.rb" +end \ No newline at end of file