From faee5c3f6eb3d4c0d99f26bdc1bb02128d6f384e Mon Sep 17 00:00:00 2001 From: Andrew Pellitieri Date: Fri, 7 Dec 2018 09:44:49 -0700 Subject: [PATCH 1/7] Debugging net:opentimeout --- Jenkinsfile | 2 +- features/support/env.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index af2f3447..c917c50b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -72,7 +72,7 @@ pipeline { } echo "Running tests..." - withEnv(['NO_PROXY=localhost,127.0.0.1', "OPENSHIFT_POSTGRESQL_DB_NAME=${tdbname}", 'OPENSHIFT_POSTGRESQL_DB_USERNAME=railstest', 'OPENSHIFT_POSTGRESQL_DB_PASSWORD=railstest', "OPENSHIFT_POSTGRESQL_DB_HOST=${dbhost}", 'OPENSHIFT_POSTGRESQL_DB_PORT=5432']) { + withEnv(['NO_PROXY=localhost,127.0.0.1', 'HEADLESS=true', "OPENSHIFT_POSTGRESQL_DB_NAME=${tdbname}", 'OPENSHIFT_POSTGRESQL_DB_USERNAME=railstest', 'OPENSHIFT_POSTGRESQL_DB_PASSWORD=railstest', "OPENSHIFT_POSTGRESQL_DB_HOST=${dbhost}", 'OPENSHIFT_POSTGRESQL_DB_PORT=5432']) { sh 'bundle exec rake' } diff --git a/features/support/env.rb b/features/support/env.rb index 4e1711bf..e9ba969f 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -14,7 +14,7 @@ require_relative '../../test/elastic_helpers' FakeWeb.register_uri(:any, %r{http://example\.com:9200/}, body: '{}', content_type: 'application/json') -FakeWeb.register_uri(:any, %r{http://concept-manager\..*\.xip\.io}, body: '{}') +FakeWeb.register_uri(:any, %r{http://concept-manager\..*}, body: '{}') Capybara.register_driver :chrome do |app| driver = Capybara::Selenium::Driver.new(app, browser: :chrome) From a25a16cdd0e936a89bf197968f39abcd4962b388 Mon Sep 17 00:00:00 2001 From: Andrew Pellitieri Date: Fri, 7 Dec 2018 09:50:41 -0700 Subject: [PATCH 2/7] Removing unnecessary change --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index c917c50b..af2f3447 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -72,7 +72,7 @@ pipeline { } echo "Running tests..." - withEnv(['NO_PROXY=localhost,127.0.0.1', 'HEADLESS=true', "OPENSHIFT_POSTGRESQL_DB_NAME=${tdbname}", 'OPENSHIFT_POSTGRESQL_DB_USERNAME=railstest', 'OPENSHIFT_POSTGRESQL_DB_PASSWORD=railstest', "OPENSHIFT_POSTGRESQL_DB_HOST=${dbhost}", 'OPENSHIFT_POSTGRESQL_DB_PORT=5432']) { + withEnv(['NO_PROXY=localhost,127.0.0.1', "OPENSHIFT_POSTGRESQL_DB_NAME=${tdbname}", 'OPENSHIFT_POSTGRESQL_DB_USERNAME=railstest', 'OPENSHIFT_POSTGRESQL_DB_PASSWORD=railstest', "OPENSHIFT_POSTGRESQL_DB_HOST=${dbhost}", 'OPENSHIFT_POSTGRESQL_DB_PORT=5432']) { sh 'bundle exec rake' } From f8609f48d586b253433d6bf36cea25fe541276da Mon Sep 17 00:00:00 2001 From: Andrew Pellitieri Date: Fri, 7 Dec 2018 11:25:42 -0700 Subject: [PATCH 3/7] Enabling headless on jenkins builds --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index af2f3447..c917c50b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -72,7 +72,7 @@ pipeline { } echo "Running tests..." - withEnv(['NO_PROXY=localhost,127.0.0.1', "OPENSHIFT_POSTGRESQL_DB_NAME=${tdbname}", 'OPENSHIFT_POSTGRESQL_DB_USERNAME=railstest', 'OPENSHIFT_POSTGRESQL_DB_PASSWORD=railstest', "OPENSHIFT_POSTGRESQL_DB_HOST=${dbhost}", 'OPENSHIFT_POSTGRESQL_DB_PORT=5432']) { + withEnv(['NO_PROXY=localhost,127.0.0.1', 'HEADLESS=true', "OPENSHIFT_POSTGRESQL_DB_NAME=${tdbname}", 'OPENSHIFT_POSTGRESQL_DB_USERNAME=railstest', 'OPENSHIFT_POSTGRESQL_DB_PASSWORD=railstest', "OPENSHIFT_POSTGRESQL_DB_HOST=${dbhost}", 'OPENSHIFT_POSTGRESQL_DB_PORT=5432']) { sh 'bundle exec rake' } From 3855970d9714f3428eb60ff77aeb690cd81a788d Mon Sep 17 00:00:00 2001 From: Andrew Pellitieri Date: Fri, 7 Dec 2018 13:35:10 -0700 Subject: [PATCH 4/7] Trying to rescue error --- Jenkinsfile | 2 +- app/controllers/concept_service_controller.rb | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c917c50b..af2f3447 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -72,7 +72,7 @@ pipeline { } echo "Running tests..." - withEnv(['NO_PROXY=localhost,127.0.0.1', 'HEADLESS=true', "OPENSHIFT_POSTGRESQL_DB_NAME=${tdbname}", 'OPENSHIFT_POSTGRESQL_DB_USERNAME=railstest', 'OPENSHIFT_POSTGRESQL_DB_PASSWORD=railstest', "OPENSHIFT_POSTGRESQL_DB_HOST=${dbhost}", 'OPENSHIFT_POSTGRESQL_DB_PORT=5432']) { + withEnv(['NO_PROXY=localhost,127.0.0.1', "OPENSHIFT_POSTGRESQL_DB_NAME=${tdbname}", 'OPENSHIFT_POSTGRESQL_DB_USERNAME=railstest', 'OPENSHIFT_POSTGRESQL_DB_PASSWORD=railstest', "OPENSHIFT_POSTGRESQL_DB_HOST=${dbhost}", 'OPENSHIFT_POSTGRESQL_DB_PORT=5432']) { sh 'bundle exec rake' } diff --git a/app/controllers/concept_service_controller.rb b/app/controllers/concept_service_controller.rb index f034c9f7..90beedb6 100644 --- a/app/controllers/concept_service_controller.rb +++ b/app/controllers/concept_service_controller.rb @@ -6,13 +6,17 @@ class ConceptServiceController < ApplicationController # GET /concepts/systems def systems - @response = HTTParty.get(CONCEPT_SYSTEM_URL) + @response = HTTParty.get(CONCEPT_SYSTEM_URL, { open_timeout: 5 }) render json: @response.body, status: @response.code + rescue Net::OpenTimeout => e + render status: 504 end # GET /concepts/search def search - @response = HTTParty.get(CONCEPT_SEARCH_URL, query: { system: params[:system], version: params[:version], search: params[:search] }) + @response = HTTParty.get(CONCEPT_SEARCH_URL, { open_timeout: 5 }, query: { system: params[:system], version: params[:version], search: params[:search] }) render json: @response.body, status: @response.code + rescue Net::OpenTimeout => e + render status: 504 end end From 795fa3f3ee12a154089818e99f6042415d65bdfc Mon Sep 17 00:00:00 2001 From: Andrew Pellitieri Date: Fri, 7 Dec 2018 13:42:59 -0700 Subject: [PATCH 5/7] Fixing linter issue --- app/controllers/concept_service_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/concept_service_controller.rb b/app/controllers/concept_service_controller.rb index 90beedb6..11f44a2c 100644 --- a/app/controllers/concept_service_controller.rb +++ b/app/controllers/concept_service_controller.rb @@ -6,9 +6,9 @@ class ConceptServiceController < ApplicationController # GET /concepts/systems def systems - @response = HTTParty.get(CONCEPT_SYSTEM_URL, { open_timeout: 5 }) + @response = HTTParty.get(CONCEPT_SYSTEM_URL, open_timeout: 5) render json: @response.body, status: @response.code - rescue Net::OpenTimeout => e + rescue Net::OpenTimeout render status: 504 end @@ -16,7 +16,7 @@ def systems def search @response = HTTParty.get(CONCEPT_SEARCH_URL, { open_timeout: 5 }, query: { system: params[:system], version: params[:version], search: params[:search] }) render json: @response.body, status: @response.code - rescue Net::OpenTimeout => e + rescue Net::OpenTimeout render status: 504 end end From cd3cdca5bbd7e22a89178b4d7fe6318cd522b949 Mon Sep 17 00:00:00 2001 From: Andrew Pellitieri Date: Fri, 7 Dec 2018 14:44:33 -0700 Subject: [PATCH 6/7] Fixing rescue response --- app/controllers/concept_service_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/concept_service_controller.rb b/app/controllers/concept_service_controller.rb index 11f44a2c..4a1eebd0 100644 --- a/app/controllers/concept_service_controller.rb +++ b/app/controllers/concept_service_controller.rb @@ -9,7 +9,7 @@ def systems @response = HTTParty.get(CONCEPT_SYSTEM_URL, open_timeout: 5) render json: @response.body, status: @response.code rescue Net::OpenTimeout - render status: 504 + render status: 504, json: {message: 'Error opening network connection'} end # GET /concepts/search @@ -17,6 +17,6 @@ def search @response = HTTParty.get(CONCEPT_SEARCH_URL, { open_timeout: 5 }, query: { system: params[:system], version: params[:version], search: params[:search] }) render json: @response.body, status: @response.code rescue Net::OpenTimeout - render status: 504 + render status: 504, json: {message: 'Error opening network connection'} end end From 01c83dc6b72e54e855abe26a0a316149d9a08cc9 Mon Sep 17 00:00:00 2001 From: Andrew Pellitieri Date: Sun, 9 Dec 2018 22:52:13 -0700 Subject: [PATCH 7/7] Fixing linting issue --- app/controllers/concept_service_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/concept_service_controller.rb b/app/controllers/concept_service_controller.rb index 4a1eebd0..b144c84c 100644 --- a/app/controllers/concept_service_controller.rb +++ b/app/controllers/concept_service_controller.rb @@ -9,7 +9,7 @@ def systems @response = HTTParty.get(CONCEPT_SYSTEM_URL, open_timeout: 5) render json: @response.body, status: @response.code rescue Net::OpenTimeout - render status: 504, json: {message: 'Error opening network connection'} + render status: 504, json: { message: 'Error opening network connection' } end # GET /concepts/search @@ -17,6 +17,6 @@ def search @response = HTTParty.get(CONCEPT_SEARCH_URL, { open_timeout: 5 }, query: { system: params[:system], version: params[:version], search: params[:search] }) render json: @response.body, status: @response.code rescue Net::OpenTimeout - render status: 504, json: {message: 'Error opening network connection'} + render status: 504, json: { message: 'Error opening network connection' } end end