From 287c5b9b842843d053b3ca642ec9f667059663b1 Mon Sep 17 00:00:00 2001 From: HyppoliteJ Date: Fri, 9 Aug 2024 16:32:16 -0400 Subject: [PATCH] Attempting to make requests to the mflux ci server instead of our local docker container --- app/models/mediaflux/request.rb | 7 ++++++- config/mediaflux.yml | 2 +- spec/models/mediaflux/asset_exist_request_headers_spec.rb | 2 +- spec/system/welcome_spec.rb | 2 +- spec/views/mediaflux_infos/index.html.erb_spec.rb | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/models/mediaflux/request.rb b/app/models/mediaflux/request.rb index 93f8d78a..61d69a78 100644 --- a/app/models/mediaflux/request.rb +++ b/app/models/mediaflux/request.rb @@ -14,7 +14,11 @@ def self.request_path end def self.uri - URI("#{Connection.transport}://#{Connection.host}:#{Connection.port}/#{request_path}") + if Connection.host == "0.0.0.0" + URI("#{Connection.transport}://#{Connection.host}:#{Connection.port}/#{request_path}") + else + URI("#{Connection.transport}://#{Connection.host}/#{request_path}") + end end # Constructs a new HTTP POST request for usage with the Mediaflux API @@ -56,6 +60,7 @@ def initialize(file: nil, session_token: nil, http_client: nil, session_user: ni # Resolves the HTTP request against the Mediaflux API # @return [Net::HTTP] def resolve + puts(Rails.configuration.mediaflux["api_host"]) @http_response = @http_client.request self.class.uri, http_request end diff --git a/config/mediaflux.yml b/config/mediaflux.yml index 62ceea16..2723b1e2 100644 --- a/config/mediaflux.yml +++ b/config/mediaflux.yml @@ -95,7 +95,7 @@ test: api_root_collection_namespace: '/td-test-001/test' api_root_collection: 'path=/td-test-001/test/tigerdata' api_transport: 'http' - api_host: <%= ENV["TEST_MEDIAFLUX_HOST"] || '0.0.0.0' %> + api_host: 'mflux-ci.lib.princeton.edu' api_port: <%= ENV["TEST_MEDIAFLUX_PORT"] || '8888' %> # Alternate to test is still a test location diff --git a/spec/models/mediaflux/asset_exist_request_headers_spec.rb b/spec/models/mediaflux/asset_exist_request_headers_spec.rb index 2e86782c..0d3dd8f0 100644 --- a/spec/models/mediaflux/asset_exist_request_headers_spec.rb +++ b/spec/models/mediaflux/asset_exist_request_headers_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require "rails_helper" -RSpec.describe Mediaflux::AssetExistRequest, type: :model, connect_to_mediaflux: false do +RSpec.describe Mediaflux::AssetExistRequest, type: :model, connect_to_mediaflux: true do let(:user) { FactoryBot.create(:user) } let(:namespace_root) { Rails.configuration.mediaflux["api_root_collection_namespace"] } diff --git a/spec/system/welcome_spec.rb b/spec/system/welcome_spec.rb index 01c211bd..2eab1715 100644 --- a/spec/system/welcome_spec.rb +++ b/spec/system/welcome_spec.rb @@ -60,7 +60,7 @@ expect(page).to have_content "Log Out" end - it "shows the Mediflux version on the home page for a logged in user", connect_to_mediaflux: true do + it "shows the Mediflux version on the home page for a logged in user" do sign_in current_user visit "/" sleep(1) diff --git a/spec/views/mediaflux_infos/index.html.erb_spec.rb b/spec/views/mediaflux_infos/index.html.erb_spec.rb index 43435bbb..59405f7f 100644 --- a/spec/views/mediaflux_infos/index.html.erb_spec.rb +++ b/spec/views/mediaflux_infos/index.html.erb_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require "rails_helper" -RSpec.describe "mediaflux_info/index", type: :view do +RSpec.describe "mediaflux_info/index", type: :view, connect_to_mediaflux: true do before(:each) do assign(:mf_version, { version: "1001" }) end