Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor linting with the latest Rubocop #119

Merged
merged 1 commit into from
Aug 14, 2023
Merged
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
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ group :test do
end

group :debug do
gem "pry"
gem "byebug"
gem "pry"
end

group :chefstyle do
Expand Down
2 changes: 1 addition & 1 deletion kitchen-google.gemspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$:.push File.expand_path("lib", __dir__)
$LOAD_PATH.push File.expand_path("lib", __dir__)
require "kitchen/driver/gce_version"

Gem::Specification.new do |s|
Expand Down
4 changes: 1 addition & 3 deletions lib/kitchen/driver/gce.rb
Original file line number Diff line number Diff line change
Expand Up @@ -554,9 +554,7 @@ def instance_guest_accelerators

count = 1

if guest_accelerator.key?(:count)
count = guest_accelerator[:count]
end
count = guest_accelerator[:count] if guest_accelerator.key?(:count)

guest_accelerator_obj.accelerator_count = count

Expand Down
4 changes: 3 additions & 1 deletion lib/kitchen/driver/gce_version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Author:: Chef Partner Engineering (<partnereng@chef.io>)
# Copyright:: Copyright (c) Chef Software, Inc.
Expand All @@ -18,6 +20,6 @@

module Kitchen
module Driver
GCE_VERSION = "2.3.0".freeze
GCE_VERSION = "2.3.0"
end
end
19 changes: 10 additions & 9 deletions spec/kitchen/driver/gce_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,6 @@

describe "#create_disks" do
it "sets up a boot disk if boot is present and returns it" do

config = {
disks: {
disk1: {
Expand Down Expand Up @@ -879,13 +878,12 @@
end

describe "#instance_metadata" do
let(:item1 ) { double("item1") }
let(:item2 ) { double("item2") }
let(:item3 ) { double("item3") }
let(:item1) { double("item1") }
let(:item2) { double("item2") }
let(:item3) { double("item3") }
let(:metadata) { double("metadata") }

it "returns a properly-configured metadata object" do

expect(instance).to receive(:name).and_return("instance_name")
expect(driver).to receive(:env_user).and_return("env_user")
expect(Google::Apis::ComputeV1::Metadata).to receive(:new).and_return(metadata)
Expand Down Expand Up @@ -1129,15 +1127,18 @@
it "returns an array containing a properly-formatted service account" do
service_account = double("service_account")

allow(driver).to receive(:config).and_return(service_account_name: "account_name", service_account_scopes: %w{scope1 scope2})
allow(driver).to receive(:config).and_return(service_account_name: "account_name",
service_account_scopes: %w{
scope1 scope2
})
expect(Google::Apis::ComputeV1::ServiceAccount).to receive(:new).and_return(service_account)
expect(service_account).to receive(:email=).with("account_name")
expect(driver).to receive(:service_account_scope_url).with("scope1").and_return("https://www.googleapis.com/auth/scope1")
expect(driver).to receive(:service_account_scope_url).with("scope2").and_return("https://www.googleapis.com/auth/scope2")
expect(service_account).to receive(:scopes=).with([
"https://www.googleapis.com/auth/scope1",
"https://www.googleapis.com/auth/scope2",
])
"https://www.googleapis.com/auth/scope1",
"https://www.googleapis.com/auth/scope2",
])

expect(driver.instance_service_accounts).to eq([service_account])
end
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
# test failures related to randomization by passing the same `--seed` value
# as the one that triggered the failure.
Kernel.srand config.seed
end
end
Loading