Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions foreman_google.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,18 @@ Gem::Specification.new do |s|
s.homepage = 'https://github.com/theforeman/foreman_google'
s.summary = 'Google Compute Engine plugin for the Foreman'
s.description = 'Google Compute Engine plugin for the Foreman'
s.required_ruby_version = '>= 2.7', '< 4'
s.required_ruby_version = '>= 3.0', '< 4'

s.files = Dir['{app,config,db,lib,locale,webpack}/**/*'] + ['LICENSE', 'Rakefile', 'README.md', 'package.json']
s.test_files = Dir['test/**/*'] + Dir['webpack/**/__tests__/*.js']

# Pin Google versions to avoid breaking changes
# Never versions with google-protobuf > 3.25.4
# are failing with `undefined method 'build'` error
s.add_dependency 'google-apis-compute_v1', '0.54.0'
s.add_dependency 'google-cloud-compute', '0.5.0'
s.add_dependency 'google-protobuf', '3.24.3'
# Use the newest google-cloud-compute line that still works with Ruby 3.0,
# which remains the safe baseline for EL9 packaging.
s.add_dependency 'google-cloud-compute', '1.15.0'
# Keep the versioned client below 2.22.0 so resolution stays within the
# Ruby-3.0-compatible line even when the builder runs a newer Ruby.
s.add_dependency 'google-cloud-compute-v1', '>= 2.15.0', '< 2.22.0'
# Keep protobuf pinned to the last known version before DescriptorPool#build
# compatibility issues were reported with older generated clients.
s.add_dependency 'google-protobuf', '3.25.4'
end
2 changes: 2 additions & 0 deletions lib/foreman_google.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'google/cloud/compute'
require 'google/cloud/compute/v1'
require 'foreman_google/engine'

module ForemanGoogle
Expand Down
15 changes: 15 additions & 0 deletions test/unit/google_extensions/attached_disk_test.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
require 'test_google_helper'
require 'rbconfig'

module GoogleExtensions
class AttachedDiskTest < GoogleTestCase
describe 'plugin loading' do

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This really isn't a useful test since we already run the tests with a bundle. The existing test that already uses Google::Cloud::Compute::V1::AttachedDisk should be sufficient to covert this.

it 'loads AttachedDisk through the plugin entrypoint' do
helper = ForemanGoogle::Engine.root.join('test', 'test_google_helper').to_s
script = <<~RUBY
require 'bundler/setup'
require "#{helper}"
require 'foreman_google'
abort 'missing AttachedDisk' unless defined?(Google::Cloud::Compute::V1::AttachedDisk)
RUBY

assert system({ 'BUNDLE_GEMFILE' => ForemanGoogle::Engine.root.join('Gemfile').to_s }, RbConfig.ruby, '-e', script)
end
end

describe 'insert_attrs' do
it 'with source image' do
disk = Google::Cloud::Compute::V1::AttachedDisk.new(source: 'source-image')
Expand Down