mirror of
https://github.com/puppetlabs/vmpooler-provider-gce.git
synced 2026-01-26 03:18:41 -05:00
rubocop fixes
This commit is contained in:
parent
662f965c0f
commit
5c67073dad
5 changed files with 342 additions and 339 deletions
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# this file is used to Mock the GCE objects, for example the main ComputeService object
|
||||
MockResult = Struct.new(
|
||||
# https://googleapis.dev/ruby/google-api-client/latest/Google/Apis/ComputeV1/Operation.html
|
||||
|
|
@ -7,7 +9,7 @@ MockResult = Struct.new(
|
|||
keyword_init: true
|
||||
)
|
||||
|
||||
MockOperationError = Array.new
|
||||
MockOperationError = [].freeze
|
||||
|
||||
MockOperationErrorError = Struct.new(
|
||||
# https://googleapis.dev/ruby/google-api-client/latest/Google/Apis/ComputeV1/Operation/Error/Error.html
|
||||
|
|
@ -27,19 +29,19 @@ MockInstance = Struct.new(
|
|||
)
|
||||
|
||||
MockInstanceList = Struct.new(
|
||||
#https://googleapis.dev/ruby/google-api-client/latest/Google/Apis/ComputeV1/InstanceList.html
|
||||
# https://googleapis.dev/ruby/google-api-client/latest/Google/Apis/ComputeV1/InstanceList.html
|
||||
:id, :items, :kind, :next_page_token, :self_link, :warning,
|
||||
keyword_init: true
|
||||
)
|
||||
|
||||
MockDiskList = Struct.new(
|
||||
#https://googleapis.dev/ruby/google-api-client/latest/Google/Apis/ComputeV1/DiskList.html
|
||||
# https://googleapis.dev/ruby/google-api-client/latest/Google/Apis/ComputeV1/DiskList.html
|
||||
:id, :items, :kind, :next_page_token, :self_link, :warning,
|
||||
keyword_init: true
|
||||
)
|
||||
|
||||
MockDisk = Struct.new(
|
||||
#https://googleapis.dev/ruby/google-api-client/latest/Google/Apis/ComputeV1/Disk.html
|
||||
# https://googleapis.dev/ruby/google-api-client/latest/Google/Apis/ComputeV1/Disk.html
|
||||
:creation_timestamp, :description, :disk_encryption_key, :guest_os_features, :id, :kind, :label_fingerprint, :labels,
|
||||
:last_attach_timestamp, :last_detach_timestamp, :license_codes, :licenses, :name, :options,
|
||||
:physical_block_size_bytes, :region, :replica_zones, :resource_policies, :self_link, :size_gb, :source_disk,
|
||||
|
|
@ -49,13 +51,13 @@ MockDisk = Struct.new(
|
|||
)
|
||||
|
||||
MockSnapshotList = Struct.new(
|
||||
#https://googleapis.dev/ruby/google-api-client/latest/Google/Apis/ComputeV1/DiskList.html
|
||||
# https://googleapis.dev/ruby/google-api-client/latest/Google/Apis/ComputeV1/DiskList.html
|
||||
:id, :items, :kind, :next_page_token, :self_link, :warning,
|
||||
keyword_init: true
|
||||
)
|
||||
|
||||
MockSnapshot = Struct.new(
|
||||
#https://googleapis.dev/ruby/google-api-client/latest/Google/Apis/ComputeV1/Snapshot.html
|
||||
# https://googleapis.dev/ruby/google-api-client/latest/Google/Apis/ComputeV1/Snapshot.html
|
||||
:auto_created, :chain_name, :creation_timestamp, :description, :disk_size_gb, :download_bytes, :id, :kind,
|
||||
:label_fingerprint, :labels, :license_codes, :licenses, :name, :self_link, :snapshot_encryption_key, :source_disk,
|
||||
:source_disk_encryption_key, :source_disk_id, :status, :storage_bytes, :storage_bytes_status, :storage_locations,
|
||||
|
|
@ -63,7 +65,7 @@ MockSnapshot = Struct.new(
|
|||
)
|
||||
|
||||
MockAttachedDisk = Struct.new(
|
||||
#https://googleapis.dev/ruby/google-api-client/latest/Google/Apis/ComputeV1/AttachedDisk.html
|
||||
# https://googleapis.dev/ruby/google-api-client/latest/Google/Apis/ComputeV1/AttachedDisk.html
|
||||
:auto_delete, :boot, :device_name, :disk_encryption_key, :disk_size_gb, :guest_os_features, :index,
|
||||
:initialize_params, :interface, :kind, :licenses, :mode, :shielded_instance_initial_state, :source, :type,
|
||||
keyword_init: true
|
||||
|
|
@ -80,6 +82,7 @@ MockComputeServiceConnection = Struct.new(
|
|||
def get_instance
|
||||
MockInstance.new
|
||||
end
|
||||
|
||||
# Alias to serviceContent.propertyCollector
|
||||
def insert_instance
|
||||
MockResult.new
|
||||
|
|
@ -90,20 +93,18 @@ end
|
|||
# Mocking Methods
|
||||
# -------------------------------------------------------------------------------------------------------------
|
||||
|
||||
=begin
|
||||
def mock_RbVmomi_VIM_ClusterComputeResource(options = {})
|
||||
options[:name] = 'Cluster' + rand(65536).to_s if options[:name].nil?
|
||||
|
||||
mock = MockClusterComputeResource.new()
|
||||
|
||||
mock.name = options[:name]
|
||||
# All cluster compute resources have a root Resource Pool
|
||||
mock.resourcePool = mock_RbVmomi_VIM_ResourcePool({:name => options[:name]})
|
||||
|
||||
allow(mock).to receive(:is_a?) do |expected_type|
|
||||
expected_type == RbVmomi::VIM::ClusterComputeResource
|
||||
end
|
||||
|
||||
mock
|
||||
end
|
||||
=end
|
||||
# def mock_RbVmomi_VIM_ClusterComputeResource(options = {})
|
||||
# options[:name] = 'Cluster' + rand(65536).to_s if options[:name].nil?
|
||||
#
|
||||
# mock = MockClusterComputeResource.new()
|
||||
#
|
||||
# mock.name = options[:name]
|
||||
# # All cluster compute resources have a root Resource Pool
|
||||
# mock.resourcePool = mock_RbVmomi_VIM_ResourcePool({:name => options[:name]})
|
||||
#
|
||||
# allow(mock).to receive(:is_a?) do |expected_type|
|
||||
# expected_type == RbVmomi::VIM::ClusterComputeResource
|
||||
# end
|
||||
#
|
||||
# mock
|
||||
# end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue