Skip to content

Commit

Permalink
Merge pull request #397 from Temikus/parallelize_more
Browse files Browse the repository at this point in the history
More parallelization
  • Loading branch information
Temikus authored Jul 18, 2018
2 parents d1d8058 + 306f2af commit 8780575
Show file tree
Hide file tree
Showing 52 changed files with 258 additions and 75 deletions.
5 changes: 4 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ Style/RegexpLiteral:
Style/FrozenStringLiteralComment:
Enabled: false

Style/MutableConstant:
Enabled: false

Style/HashSyntax:
EnforcedStyle: no_mixed_keys

Expand All @@ -30,7 +33,7 @@ AllCops:
- "vendor/**/*"
- "db/schema.rb"
UseCache: false
TargetRubyVersion: 2.1
TargetRubyVersion: 2.3
Style/CollectionMethods:
Description: Preferred collection methods.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#map-find-select-reduce-size
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@

The main maintainers for the Google sections are @icco, @Temikus and @plribeiro3000. Please send pull requests to them.

**As of v0.1.1, Google no longer supports Ruby versions less than 2.0.0.**
## Important notices

**As of v1.0.0, fog-google includes google-api-client as a dependency**
- As of **v0.1.1**, Google no longer supports Ruby versions less than 2.0.0.

**See [MIGRATING.md](MIGRATING.md) for migration between major versions**
- As of **v1.0.0**, fog-google includes google-api-client as a dependency, there is no need to include it separately anymore.

See **[MIGRATING.md](MIGRATING.md)** for migration between major versions.

## Storage

Expand Down
4 changes: 1 addition & 3 deletions ci/docker-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get -y -qq update && apt-get -y -qq insta
libxslt-dev

# Ubuntu 16.04 will fetch us 2.3.x without any issues.
RUN DEBIAN_FRONTEND=noninteractive apt-get -y -qq install ruby ruby-dev

RUN apt-get clean
RUN DEBIAN_FRONTEND=noninteractive apt-get -y -qq install ruby ruby-dev && apt-get clean

RUN gem install bundler
124 changes: 112 additions & 12 deletions ci/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
jobs:
- name: integration-tests-compute
- name: integration-compute-core_compute
serial: true
plan:
- get: fog-google-src
Expand All @@ -9,10 +9,10 @@ jobs:
- put: pull-request
params: {path: fog-google-src, status: pending}

- task: full-integration-tests
- task: run-integration-tests
file: fog-google-src/ci/tasks/run-int.yml
params:
rake_task: test:compute
rake_task: test:compute-core_compute
codecov_token: {{codecov_token}}
google_project: {{google_project}}
google_json_key_data: {{google_json_key_data}}
Expand All @@ -22,7 +22,79 @@ jobs:
params:
path: fog-google-src
status: failure


- name: integration-compute-core_networking
serial: true
plan:
- get: fog-google-src
resource: pull-request
version: every
trigger: true
- put: pull-request
params: {path: fog-google-src, status: pending}

- task: run-integration-tests
file: fog-google-src/ci/tasks/run-int.yml
params:
rake_task: test:compute-core_networking
codecov_token: {{codecov_token}}
google_project: {{google_project}}
google_json_key_data: {{google_json_key_data}}
google_client_email: {{google_client_email}}
on_failure:
put: pull-request
params:
path: fog-google-src
status: failure

- name: integration-compute-instance_groups
serial: true
plan:
- get: fog-google-src
resource: pull-request
version: every
trigger: true
- put: pull-request
params: {path: fog-google-src, status: pending}

- task: run-integration-tests
file: fog-google-src/ci/tasks/run-int.yml
params:
rake_task: test:compute-instance_groups
codecov_token: {{codecov_token}}
google_project: {{google_project}}
google_json_key_data: {{google_json_key_data}}
google_client_email: {{google_client_email}}
on_failure:
put: pull-request
params:
path: fog-google-src
status: failure

- name: integration-compute-loadbalancing
serial: true
plan:
- get: fog-google-src
resource: pull-request
version: every
trigger: true
- put: pull-request
params: {path: fog-google-src, status: pending}

- task: run-integration-tests
file: fog-google-src/ci/tasks/run-int.yml
params:
rake_task: test:compute-loadbalancing
codecov_token: {{codecov_token}}
google_project: {{google_project}}
google_json_key_data: {{google_json_key_data}}
google_client_email: {{google_client_email}}
on_failure:
put: pull-request
params:
path: fog-google-src
status: failure

- name: integration-tests-monitoring
serial: true
plan:
Expand All @@ -33,7 +105,7 @@ jobs:
- put: pull-request
params: {path: fog-google-src, status: pending}

- task: full-integration-tests
- task: run-integration-tests
file: fog-google-src/ci/tasks/run-int.yml
params:
rake_task: test:monitoring
Expand All @@ -57,7 +129,7 @@ jobs:
- put: pull-request
params: {path: fog-google-src, status: pending}

- task: full-integration-tests
- task: run-integration-tests
file: fog-google-src/ci/tasks/run-int.yml
params:
rake_task: test:pubsub
Expand All @@ -71,7 +143,31 @@ jobs:
path: fog-google-src
status: failure

- name: integration-tests-sql
- name: integration-sqlv1
serial: true
plan:
- get: fog-google-src
resource: pull-request
version: every
trigger: true
- put: pull-request
params: {path: fog-google-src, status: pending}

- task: run-integration-tests
file: fog-google-src/ci/tasks/run-int.yml
params:
rake_task: test:sql-sqlv1
codecov_token: {{codecov_token}}
google_project: {{google_project}}
google_json_key_data: {{google_json_key_data}}
google_client_email: {{google_client_email}}
on_failure:
put: pull-request
params:
path: fog-google-src
status: failure

- name: integration-sqlv2
serial: true
plan:
- get: fog-google-src
Expand All @@ -81,10 +177,10 @@ jobs:
- put: pull-request
params: {path: fog-google-src, status: pending}

- task: full-integration-tests
- task: run-integration-tests
file: fog-google-src/ci/tasks/run-int.yml
params:
rake_task: test:sql
rake_task: test:sql-sqlv2
codecov_token: {{codecov_token}}
google_project: {{google_project}}
google_json_key_data: {{google_json_key_data}}
Expand All @@ -105,7 +201,7 @@ jobs:
- put: pull-request
params: {path: fog-google-src, status: pending}

- task: full-integration-tests
- task: run-integration-tests
file: fog-google-src/ci/tasks/run-int.yml
params:
rake_task: test:storage
Expand All @@ -124,10 +220,14 @@ jobs:
- get: fog-google-src
resource: pull-request
passed: [integration-tests-storage,
integration-tests-sql,
integration-tests-pubsub,
integration-tests-monitoring,
integration-tests-compute]
integration-sqlv1,
integration-sqlv2,
integration-compute-core_compute,
integration-compute-core_networking,
integration-compute-instance_groups,
integration-compute-loadbalancing]
trigger: true
on_success:
put: pull-request
Expand Down
2 changes: 1 addition & 1 deletion ci/tasks/run-int.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ EOL

pushd ${release_dir} > /dev/null

bundle install
bundle install --jobs=3 --retry=3

FOG_MOCK=false COVERAGE=true CODECOV_TOKEN=${codecov_token} rake ${rake_task}

Expand Down
2 changes: 1 addition & 1 deletion ci/tasks/run-int.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
platform: linux
image_resource:
type: docker-image
source: {repository: everlag/fog-google}
source: {repository: rubyfog/fog-google}
inputs:
- name: fog-google-src
path: src/fog-google
Expand Down
51 changes: 43 additions & 8 deletions tasks/test.rake
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,33 @@ namespace :test do
t.name = "unit"
t.description = "Run Unit tests"
t.libs << "test"
t.pattern = FileList['test/unit/**/test_*.rb']
t.pattern = FileList["test/unit/**/test_*.rb"]
t.warning = false
t.verbose = true
end

Rake::TestTask.new do |t|
t.name = "compute"
t.description = "Run Compute API tests"
t.libs << "test"
t.pattern = FileList["test/integration/compute/test_*.rb"]
t.warning = false
t.verbose = true
# This autogenerates rake tasks based on test folder structures
# This is done to simplify running many test suites in parallel
COMPUTE_TEST_TASKS = []
Dir.glob("test/integration/compute/**").each do |task|
suite_collection = task.gsub(/test\/integration\/compute\//, "")
component_name = task.gsub(/test\/integration\//, "").split("/").first
Rake::TestTask.new(:"#{component_name}-#{suite_collection}") do |t|
t.libs << "test"
t.description = "Autotask - run #{component_name} integration tests - #{suite_collection}"
t.pattern = FileList["test/integration/#{component_name}/#{suite_collection}/test_*.rb"]
t.warning = false
t.verbose = true
end
COMPUTE_TEST_TASKS << "#{component_name}-#{suite_collection}"
end

desc "Run Compute API tests"
task :compute => COMPUTE_TEST_TASKS

desc "Run Compute API tests in parallel"
multitask :compute_parallel => COMPUTE_TEST_TASKS

Rake::TestTask.new do |t|
t.name = "monitoring"
t.description = "Run Monitoring API tests"
Expand All @@ -56,6 +69,28 @@ namespace :test do
t.verbose = true
end

# This autogenerates rake tasks based on test folder structures
# This is done to simplify running many test suites in parallel
SQL_TEST_TASKS = []
Dir.glob("test/integration/sql/**").each do |task|
suite_collection = task.gsub(/test\/integration\/sql\//, "")
component_name = task.gsub(/test\/integration\//, "").split("/").first
Rake::TestTask.new(:"#{component_name}-#{suite_collection}") do |t|
t.libs << "test"
t.description = "Autotask - run #{component_name} integration tests - #{suite_collection}"
t.pattern = FileList["test/integration/#{component_name}/#{suite_collection}/test_*.rb"]
t.warning = false
t.verbose = true
end
SQL_TEST_TASKS << "#{component_name}-#{suite_collection}"
end

desc "Run SQL API tests"
task :compute => SQL_TEST_TASKS

desc "Run SQL API tests in parallel"
multitask :compute_parallel => SQL_TEST_TASKS

Rake::TestTask.new do |t|
t.name = "sql"
t.description = "Run SQL API tests"
Expand Down
6 changes: 6 additions & 0 deletions test/integration/compute/core_compute/test_coverage.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require "helpers/integration_test_helper"

# This is a simple coverage helper that helps differentiate
# the tests when run in parallel so the final coverage report
# can be properly combined together from multiple runners
SimpleCov.command_name "test:compute-core_compute" if ENV["COVERAGE"]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ def test_bootstrap
user = "username"

File.stub :read, key do
# Name is set this way so it will be cleaned up by CollectionFactory
# XXX Small hack - name is set this way so it will be cleaned up by CollectionFactory
# Bootstrap is special so this is something that needs to be done only for this method
# Public_key_path is set to avoid stubbing out File.exist?
server = @subject.bootstrap(:name => "#{CollectionFactory::PREFIX}-#{Time.now.to_i}",
server = @subject.bootstrap(:name => "#{CollectionFactory.new(nil,namespaced_name).resource_name}",
:username => user,
:public_key_path => "foo")
boot_disk = server.disks.detect { |disk| disk[:boot] }
Expand All @@ -56,7 +57,9 @@ def test_bootstrap_fail
# Pretend the ssh key does not exist
File.stub :exist?, nil do
assert_raises(Fog::Errors::Error) {
@subject.bootstrap(:name => "#{CollectionFactory::PREFIX}-#{Time.now.to_i}",
# XXX Small hack - name is set this way so it will be cleaned up by CollectionFactory
# Bootstrap is special so this is something that needs to be done only for this method
@subject.bootstrap(:name => "#{CollectionFactory.new(nil,namespaced_name).resource_name}",
:public_key_path => nil)
}
end
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions test/integration/compute/core_networking/test_coverage.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require "helpers/integration_test_helper"

# This is a simple coverage helper that helps differentiate
# the tests when run in parallel so the final coverage report
# can be properly combined together from multiple runners
SimpleCov.command_name "test:compute-core_networking" if ENV["COVERAGE"]
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions test/integration/compute/instance_groups/test_coverage.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require "helpers/integration_test_helper"

# This is a simple coverage helper that helps differentiate
# the tests when run in parallel so the final coverage report
# can be properly combined together from multiple runners
SimpleCov.command_name "test:compute-instance_groups" if ENV["COVERAGE"]
6 changes: 6 additions & 0 deletions test/integration/compute/loadbalancing/test_coverage.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require "helpers/integration_test_helper"

# This is a simple coverage helper that helps differentiate
# the tests when run in parallel so the final coverage report
# can be properly combined together from multiple runners
SimpleCov.command_name "test:compute-loadbalancing" if ENV["COVERAGE"]
Loading

0 comments on commit 8780575

Please sign in to comment.