Skip to content

Commit

Permalink
chefstyle -a after master rebase
Browse files Browse the repository at this point in the history
Signed-off-by: Miah Johnson <miah@chia-pet.org>
  • Loading branch information
miah committed May 31, 2019
1 parent 33d011c commit ecb5b77
Show file tree
Hide file tree
Showing 16 changed files with 45 additions and 44 deletions.
4 changes: 2 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ end
task default: [:test, :lint]

Rake::TestTask.new do |t|
t.libs << 'test'
t.pattern = 'test/unit/**/*_test.rb'
t.libs << "test"
t.pattern = "test/unit/**/*_test.rb"
t.warning = false
t.verbose = true
t.ruby_opts = ["--dev"] if defined?(JRUBY_VERSION)
Expand Down
8 changes: 4 additions & 4 deletions lib/train/transports/mock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,16 @@ def mock_command(cmd, stdout = nil, stderr = nil, exit_status = 0)

def command_not_found(cmd)
if @options[:verbose]
$stderr.puts('Command not mocked:')
$stderr.puts(' '+cmd.to_s.split("\n").join("\n "))
$stderr.puts(' SHA: ' + Digest::SHA256.hexdigest(cmd.to_s))
$stderr.puts("Command not mocked:")
$stderr.puts(" " + cmd.to_s.split("\n").join("\n "))
$stderr.puts(" SHA: " + Digest::SHA256.hexdigest(cmd.to_s))
end
# return a non-zero exit code
mock_command(cmd, nil, nil, 1)
end

def file_not_found(path)
$stderr.puts('File not mocked: '+path.to_s) if @options[:verbose]
$stderr.puts("File not mocked: " + path.to_s) if @options[:verbose]
File.new(self, path)
end

Expand Down
8 changes: 4 additions & 4 deletions lib/train/transports/vmware.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

module Train::Transports
class VMware < Train.plugin(1)
name 'vmware'
option :viserver, default: proc { ENV['VISERVER'] }
option :username, default: proc { ENV['VISERVER_USERNAME'] }
option :password, default: proc { ENV['VISERVER_PASSWORD'] }
name "vmware"
option :viserver, default: proc { ENV["VISERVER"] }
option :username, default: proc { ENV["VISERVER_USERNAME"] }
option :password, default: proc { ENV["VISERVER_PASSWORD"] }
option :insecure, default: false

def connection(_ = nil)
Expand Down
2 changes: 1 addition & 1 deletion lib/train/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
# Author:: Dominik Richter (<dominik.richter@gmail.com>)

module Train
VERSION = '2.1.10'.freeze
VERSION = "2.1.10".freeze
end
2 changes: 1 addition & 1 deletion test/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
require "mocha/setup"
require "byebug"

require 'train'
require "train"

# needed to force unix? and others to be created
Train::Platforms::Detect::Specifications::OS.load
6 changes: 3 additions & 3 deletions test/integration/test_ssh.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

backends = {}
backend_conf = {
'target' => ENV['target'] || 'vagrant@localhost',
'key_files' => ENV['key_files'] || '/root/.ssh/id_rsa',
'logger' => Logger.new($stdout),
"target" => ENV["target"] || "vagrant@localhost",
"key_files" => ENV["key_files"] || "/root/.ssh/id_rsa",
"logger" => Logger.new($stdout),
}

backend_conf["target"] = "ssh://" + backend_conf["target"]
Expand Down
2 changes: 1 addition & 1 deletion test/unit/plugins/connection_test.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# encoding: utf-8
require 'helper'
require "helper"

describe "v1 Connection Plugin" do
describe "empty v1 connection plugin" do
Expand Down
2 changes: 1 addition & 1 deletion test/unit/train_test.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# encoding: utf-8
#
# Author:: Dominik Richter (<dominik.richter@gmail.com>)
require 'helper'
require "helper"

$:.concat Dir["test/fixtures/plugins/*/lib"] # HACK? I honestly can't tell

Expand Down
10 changes: 5 additions & 5 deletions test/unit/transports/azure_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,25 +77,25 @@ def initialize(hash)
cache[:api_call].count.must_equal 0
end

it 'can use azure_client default client' do
it "can use azure_client default client" do
management_api_client = Azure::Resources::Profiles::Latest::Mgmt::Client
client = connection.azure_client
client.class.must_equal management_api_client
end

it 'can use azure_client graph client' do
it "can use azure_client graph client" do
graph_api_client = Azure::GraphRbac::Profiles::Latest::Client
client = connection.azure_client(graph_api_client)
client.class.must_equal graph_api_client
end

it 'can use azure_client vault client' do
it "can use azure_client vault client" do
vault_api_client = ::Azure::KeyVault::Profiles::Latest::Mgmt::Client
client = connection.azure_client(vault_api_client, vault_name: 'Test Vault')
client = connection.azure_client(vault_api_client, vault_name: "Test Vault")
client.class.must_equal vault_api_client
end

it 'cannot instantiate azure_client vault client without a vault name' do
it "cannot instantiate azure_client vault client without a vault name" do
vault_api_client = ::Azure::KeyVault::Profiles::Latest::Mgmt::Client
assert_raises(Train::UserError) do
connection.azure_client(vault_api_client)
Expand Down
2 changes: 1 addition & 1 deletion test/unit/transports/cisco_ios_connection_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

describe "CiscoIOSConnection" do
let(:cls) do
plat = Train::Platforms.name('mock').in_family('cisco_ios')
plat = Train::Platforms.name("mock").in_family("cisco_ios")
plat.add_platform_methods
plat.stubs(:cisco_ios?).returns(true)
Train::Platforms::Detect.stubs(:scan).returns(plat)
Expand Down
2 changes: 1 addition & 1 deletion test/unit/transports/local_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class TransportHelper
attr_accessor :transport

def initialize(user_opts = {})
opts = {platform_name: 'mock', family_hierarchy: ['mock']}.merge(user_opts)
opts = { platform_name: "mock", family_hierarchy: ["mock"] }.merge(user_opts)
plat = Train::Platforms.name(opts[:platform_name])
plat.family_hierarchy = opts[:family_hierarchy]
plat.add_platform_methods
Expand Down
4 changes: 2 additions & 2 deletions test/unit/transports/mock_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
connection.mock_command("test", out).must_equal res
end

it 'handles nil commands' do
it "handles nil commands" do
assert_output "", /Command not mocked/ do
connection.run_command(nil).stdout.must_equal('')
connection.run_command(nil).stdout.must_equal("")
end
end

Expand Down
6 changes: 3 additions & 3 deletions test/unit/transports/ssh_connection_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'helper'
require 'train/transports/ssh'
require 'train/transports/ssh_connection'
require "helper"
require "train/transports/ssh"
require "train/transports/ssh_connection"

# Mocha limitations don't let us mock a function
# such that it can receive a block, so here's a minimal
Expand Down
14 changes: 7 additions & 7 deletions test/unit/transports/ssh_test.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# encoding: utf-8

require 'helper'
require 'train/transports/ssh'
require "helper"
require "train/transports/ssh"

describe "ssh transport" do
let(:cls) do
Expand Down Expand Up @@ -89,7 +89,7 @@
end
end

it 'defaults verify_host_key option to :never' do
it "defaults verify_host_key option to :never" do
connection_options[:verify_host_key].must_equal :never
end
end
Expand Down Expand Up @@ -219,10 +219,10 @@
proc { cls_agent.connection }.must_raise Train::ClientError
end

it 'wont connect if it is not possible' do
it "wont connect if it is not possible" do
conf[:connection_timeout] = 1
conf[:connection_retries] = 1
conf[:host] = 'localhost'
conf[:host] = "localhost"
conf[:port] = 1
conf.delete :proxy_command
conn = cls.new(conf).connection
Expand Down Expand Up @@ -299,9 +299,9 @@
connection.login_command.command.must_equal "ssh"
end

make_my_diffs_pretty!
make_my_diffs_pretty!

it 'has login command arguments' do
it "has login command arguments" do
connection.login_command.arguments.must_equal([
"-o", "UserKnownHostsFile=/dev/null",
"-o", "StrictHostKeyChecking=no",
Expand Down
4 changes: 2 additions & 2 deletions test/unit/transports/vmware_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# encoding: utf-8
require 'helper'
require 'train/transports/vmware'
require "helper"
require "train/transports/vmware"

describe "Train::Transports::VMware::Connection" do
def add_stubs(stub_options)
Expand Down
13 changes: 7 additions & 6 deletions test/unit/transports/winrm_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,17 @@
end

describe 'when configuring the connection' do
let(:winrm) {
let(:winrm) do
cls.new(conf)
end

let(:conf) do
{
winrm_transport: :negotiate,
host: rand.to_s,
password: rand.to_s,
} end
{
winrm_transport: :negotiate,
host: rand.to_s,
password: rand.to_s,
}
end

def connection_option_value(name)
winrm.send(:connection_options, conf)[name]
Expand Down

0 comments on commit ecb5b77

Please sign in to comment.