Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2018-06-11 09:53:09 +0300
committerShinya Maeda <shinya@gitlab.com>2018-06-11 09:53:09 +0300
commit21631130867ffe0f2abe67a139991c18e566b934 (patch)
tree7cd0236df5cd0cfb2b404ba5bb51be1bfb50bd97
parent5caf4cc7525115b9fd27d1f61f693eaaf1fc371a (diff)
Set timeout to 20min. Added tests
-rw-r--r--config/initializers/google_api.rb12
-rw-r--r--spec/initializers/google_api_spec.rb12
-rw-r--r--spec/support/helpers/stub_object_storage.rb3
3 files changed, 21 insertions, 6 deletions
diff --git a/config/initializers/google_api.rb b/config/initializers/google_api.rb
index 67b5beb5b4f..6f3f614f84f 100644
--- a/config/initializers/google_api.rb
+++ b/config/initializers/google_api.rb
@@ -1,12 +1,12 @@
require 'google/apis/options'
##
-# Timeouts configuration for Google::Apis::StorageV1::StorageService
+# Timeouts on Google::Apis::StorageV1::StorageService (via HttpClient)
#
-# This configuration is honored at the following conditions
-# - Object storage integrations (LFS/Job Artifact/Upload) is active, and it connects to GCS
+# This configuration is used with the following cases.
+# - When an object storage integration (for lfs, job artifact or upload) is enabled with GCS.
#
# More details in https://github.com/google/google-api-ruby-client/blob/master/MIGRATING.md#timeouts
-::Google::Apis::ClientOptions.default.open_timeout_sec = 1234 # TODO: Parameter
-::Google::Apis::ClientOptions.default.read_timeout_sec = 1234 # TODO: Parameter
-::Google::Apis::ClientOptions.default.send_timeout_sec = 1234 # TODO: Parameter
+::Google::Apis::ClientOptions.default.open_timeout_sec = 1200
+::Google::Apis::ClientOptions.default.read_timeout_sec = 1200
+::Google::Apis::ClientOptions.default.send_timeout_sec = 1200
diff --git a/spec/initializers/google_api_spec.rb b/spec/initializers/google_api_spec.rb
new file mode 100644
index 00000000000..8977c6ac27e
--- /dev/null
+++ b/spec/initializers/google_api_spec.rb
@@ -0,0 +1,12 @@
+require 'spec_helper'
+require 'google/apis/core/base_service'
+
+describe 'Google::Apis::ClientOptions' do
+ let(:http_client) { Google::Apis::Core::BaseService.new('https://www.googleapis.com/', 'storage/v1/').send(:new_client) }
+
+ it 'initializes a http client with specified options' do
+ expect(http_client.connect_timeout).to eq(1200)
+ expect(http_client.receive_timeout).to eq(1200)
+ expect(http_client.send_timeout).to eq(1200)
+ end
+end
diff --git a/spec/support/helpers/stub_object_storage.rb b/spec/support/helpers/stub_object_storage.rb
index bceaf8277ee..7d0048bb628 100644
--- a/spec/support/helpers/stub_object_storage.rb
+++ b/spec/support/helpers/stub_object_storage.rb
@@ -17,8 +17,11 @@ module StubObjectStorage
Fog.mock!
+ binding.pry
+
::Fog::Storage.new(uploader.object_store_credentials).tap do |connection|
begin
+ binding.pry
connection.directories.create(key: remote_directory)
rescue Excon::Error::Conflict
end