test-kitchen 1.4.2 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.travis.yml +29 -33
- data/CHANGELOG.md +86 -2
- data/CONTRIBUTING.md +17 -0
- data/Gemfile.proxy_tests +5 -0
- data/MAINTAINERS.md +24 -0
- data/features/kitchen_driver_discover_command.feature +6 -0
- data/features/kitchen_init_command.feature +55 -7
- data/features/step_definitions/gem_steps.rb +12 -4
- data/features/step_definitions/git_steps.rb +1 -1
- data/features/step_definitions/output_steps.rb +1 -1
- data/features/support/env.rb +13 -9
- data/lib/kitchen/cli.rb +46 -5
- data/lib/kitchen/command/driver_discover.rb +8 -0
- data/lib/kitchen/command.rb +1 -0
- data/lib/kitchen/config.rb +4 -0
- data/lib/kitchen/configurable.rb +32 -0
- data/lib/kitchen/driver/ssh_base.rb +18 -4
- data/lib/kitchen/generator/driver_create.rb +2 -2
- data/lib/kitchen/generator/init.rb +4 -4
- data/lib/kitchen/instance.rb +7 -0
- data/lib/kitchen/lazy_hash.rb +20 -0
- data/lib/kitchen/logger.rb +4 -7
- data/lib/kitchen/provisioner/base.rb +16 -1
- data/lib/kitchen/provisioner/chef_base.rb +43 -98
- data/lib/kitchen/provisioner/chef_solo.rb +7 -4
- data/lib/kitchen/provisioner/chef_zero.rb +12 -5
- data/lib/kitchen/ssh.rb +1 -1
- data/lib/kitchen/transport/base.rb +7 -0
- data/lib/kitchen/transport/ssh.rb +13 -6
- data/lib/kitchen/transport/winrm.rb +168 -50
- data/lib/kitchen/verifier/base.rb +18 -1
- data/lib/kitchen/verifier/busser.rb +12 -5
- data/lib/kitchen/verifier/shell.rb +101 -0
- data/lib/kitchen/version.rb +1 -2
- data/spec/kitchen/collection_spec.rb +1 -1
- data/spec/kitchen/configurable_spec.rb +211 -2
- data/spec/kitchen/driver/ssh_base_spec.rb +131 -8
- data/spec/kitchen/lazy_hash_spec.rb +27 -0
- data/spec/kitchen/logger_spec.rb +10 -0
- data/spec/kitchen/provisioner/base_spec.rb +25 -0
- data/spec/kitchen/provisioner/chef_base_spec.rb +133 -252
- data/spec/kitchen/provisioner/chef_solo_spec.rb +30 -0
- data/spec/kitchen/provisioner/chef_zero_spec.rb +27 -2
- data/spec/kitchen/provisioner/shell_spec.rb +60 -12
- data/spec/kitchen/ssh_spec.rb +1 -1
- data/spec/kitchen/transport/ssh_spec.rb +2 -1
- data/spec/kitchen/transport/winrm_spec.rb +228 -48
- data/spec/kitchen/verifier/base_spec.rb +26 -0
- data/spec/kitchen/verifier/busser_spec.rb +69 -3
- data/spec/kitchen/verifier/shell_spec.rb +157 -0
- data/support/busser_install_command.sh +1 -2
- data/support/chef_base_install_command.ps1 +19 -12
- data/templates/driver/README.md.erb +1 -1
- data/test-kitchen.gemspec +12 -3
- metadata +106 -10
|
@@ -727,6 +727,19 @@ describe Kitchen::Configurable do
|
|
|
727
727
|
|
|
728
728
|
let(:cmd) { subject.send(:wrap_shell_code, "mkdir foo") }
|
|
729
729
|
|
|
730
|
+
before do
|
|
731
|
+
@original_env = ENV.to_hash
|
|
732
|
+
ENV.replace("http_proxy" => nil, "HTTP_PROXY" => nil,
|
|
733
|
+
"https_proxy" => nil, "HTTPS_PROXY" => nil,
|
|
734
|
+
"ftp_proxy" => nil, "FTP_PROXY" => nil,
|
|
735
|
+
"no_proxy" => nil, "NO_PROXY" => nil)
|
|
736
|
+
end
|
|
737
|
+
|
|
738
|
+
after do
|
|
739
|
+
ENV.clear
|
|
740
|
+
ENV.replace(@original_env)
|
|
741
|
+
end
|
|
742
|
+
|
|
730
743
|
describe "for bourne shells" do
|
|
731
744
|
|
|
732
745
|
before { platform.stubs(:shell_type).returns("bourne") }
|
|
@@ -764,16 +777,121 @@ describe Kitchen::Configurable do
|
|
|
764
777
|
CODE
|
|
765
778
|
end
|
|
766
779
|
|
|
767
|
-
it "exports
|
|
780
|
+
it "exports ftp_proxy & FTP_PROXY when :ftp_proxy is set" do
|
|
781
|
+
config[:ftp_proxy] = "ftp://proxy"
|
|
782
|
+
|
|
783
|
+
cmd.must_equal(outdent!(<<-CODE.chomp))
|
|
784
|
+
sh -c '
|
|
785
|
+
ftp_proxy="ftp://proxy"; export ftp_proxy
|
|
786
|
+
FTP_PROXY="ftp://proxy"; export FTP_PROXY
|
|
787
|
+
mkdir foo
|
|
788
|
+
'
|
|
789
|
+
CODE
|
|
790
|
+
end
|
|
791
|
+
|
|
792
|
+
it "exports all http proxy variables when all are set" do
|
|
768
793
|
config[:http_proxy] = "http://proxy"
|
|
769
794
|
config[:https_proxy] = "https://proxy"
|
|
795
|
+
config[:ftp_proxy] = "ftp://proxy"
|
|
796
|
+
|
|
797
|
+
cmd.must_equal(outdent!(<<-CODE.chomp))
|
|
798
|
+
sh -c '
|
|
799
|
+
http_proxy="http://proxy"; export http_proxy
|
|
800
|
+
HTTP_PROXY="http://proxy"; export HTTP_PROXY
|
|
801
|
+
https_proxy="https://proxy"; export https_proxy
|
|
802
|
+
HTTPS_PROXY="https://proxy"; export HTTPS_PROXY
|
|
803
|
+
ftp_proxy="ftp://proxy"; export ftp_proxy
|
|
804
|
+
FTP_PROXY="ftp://proxy"; export FTP_PROXY
|
|
805
|
+
mkdir foo
|
|
806
|
+
'
|
|
807
|
+
CODE
|
|
808
|
+
end
|
|
809
|
+
|
|
810
|
+
it "exports http_proxy & HTTP_PROXY from workstation when :http_proxy isn't set" do
|
|
811
|
+
ENV["http_proxy"] = "http://proxy"
|
|
812
|
+
ENV["HTTP_PROXY"] = "http://proxy"
|
|
813
|
+
|
|
814
|
+
cmd.must_equal(outdent!(<<-CODE.chomp))
|
|
815
|
+
sh -c '
|
|
816
|
+
http_proxy="http://proxy"; export http_proxy
|
|
817
|
+
HTTP_PROXY="http://proxy"; export HTTP_PROXY
|
|
818
|
+
mkdir foo
|
|
819
|
+
'
|
|
820
|
+
CODE
|
|
821
|
+
end
|
|
822
|
+
|
|
823
|
+
it "exports https_proxy & HTTPS_PROXY from workstation when :https_proxy isn't set" do
|
|
824
|
+
ENV["https_proxy"] = "https://proxy"
|
|
825
|
+
ENV["HTTPS_PROXY"] = "https://proxy"
|
|
826
|
+
|
|
827
|
+
cmd.must_equal(outdent!(<<-CODE.chomp))
|
|
828
|
+
sh -c '
|
|
829
|
+
https_proxy="https://proxy"; export https_proxy
|
|
830
|
+
HTTPS_PROXY="https://proxy"; export HTTPS_PROXY
|
|
831
|
+
mkdir foo
|
|
832
|
+
'
|
|
833
|
+
CODE
|
|
834
|
+
end
|
|
835
|
+
|
|
836
|
+
it "exports ftp_proxy & FTP_PROXY from workstation when :ftp_proxy isn't set" do
|
|
837
|
+
ENV["ftp_proxy"] = "ftp://proxy"
|
|
838
|
+
ENV["FTP_PROXY"] = "ftp://proxy"
|
|
839
|
+
|
|
840
|
+
cmd.must_equal(outdent!(<<-CODE.chomp))
|
|
841
|
+
sh -c '
|
|
842
|
+
ftp_proxy="ftp://proxy"; export ftp_proxy
|
|
843
|
+
FTP_PROXY="ftp://proxy"; export FTP_PROXY
|
|
844
|
+
mkdir foo
|
|
845
|
+
'
|
|
846
|
+
CODE
|
|
847
|
+
end
|
|
848
|
+
|
|
849
|
+
it "exports no_proxy & NO_PROXY from workstation when http_proxy is set from workstation" do
|
|
850
|
+
ENV["http_proxy"] = "http://proxy"
|
|
851
|
+
ENV["HTTP_PROXY"] = "http://proxy"
|
|
852
|
+
ENV["no_proxy"] = "http://no"
|
|
853
|
+
ENV["NO_PROXY"] = "http://no"
|
|
770
854
|
|
|
771
855
|
cmd.must_equal(outdent!(<<-CODE.chomp))
|
|
772
856
|
sh -c '
|
|
773
857
|
http_proxy="http://proxy"; export http_proxy
|
|
774
858
|
HTTP_PROXY="http://proxy"; export HTTP_PROXY
|
|
859
|
+
no_proxy="http://no"; export no_proxy
|
|
860
|
+
NO_PROXY="http://no"; export NO_PROXY
|
|
861
|
+
mkdir foo
|
|
862
|
+
'
|
|
863
|
+
CODE
|
|
864
|
+
end
|
|
865
|
+
|
|
866
|
+
it "exports no_proxy & NO_PROXY from workstation when https_proxy is set from workstation" do
|
|
867
|
+
ENV["https_proxy"] = "https://proxy"
|
|
868
|
+
ENV["HTTPS_PROXY"] = "https://proxy"
|
|
869
|
+
ENV["no_proxy"] = "http://no"
|
|
870
|
+
ENV["NO_PROXY"] = "http://no"
|
|
871
|
+
|
|
872
|
+
cmd.must_equal(outdent!(<<-CODE.chomp))
|
|
873
|
+
sh -c '
|
|
775
874
|
https_proxy="https://proxy"; export https_proxy
|
|
776
875
|
HTTPS_PROXY="https://proxy"; export HTTPS_PROXY
|
|
876
|
+
no_proxy="http://no"; export no_proxy
|
|
877
|
+
NO_PROXY="http://no"; export NO_PROXY
|
|
878
|
+
mkdir foo
|
|
879
|
+
'
|
|
880
|
+
CODE
|
|
881
|
+
end
|
|
882
|
+
|
|
883
|
+
it "exports no_proxy & NO_PROXY from workstation when ftp_proxy is set from workstation" do
|
|
884
|
+
ENV["ftp_proxy"] = "ftp://proxy"
|
|
885
|
+
ENV["FTP_PROXY"] = "ftp://proxy"
|
|
886
|
+
ENV["no_proxy"] = "http://no"
|
|
887
|
+
ENV["NO_PROXY"] = "http://no"
|
|
888
|
+
|
|
889
|
+
cmd.must_equal(outdent!(<<-CODE.chomp))
|
|
890
|
+
sh -c '
|
|
891
|
+
ftp_proxy="ftp://proxy"; export ftp_proxy
|
|
892
|
+
FTP_PROXY="ftp://proxy"; export FTP_PROXY
|
|
893
|
+
no_proxy="http://no"; export no_proxy
|
|
894
|
+
NO_PROXY="http://no"; export NO_PROXY
|
|
777
895
|
mkdir foo
|
|
778
896
|
'
|
|
779
897
|
CODE
|
|
@@ -808,15 +926,106 @@ describe Kitchen::Configurable do
|
|
|
808
926
|
CODE
|
|
809
927
|
end
|
|
810
928
|
|
|
811
|
-
it "exports
|
|
929
|
+
it "exports ftp_proxy & FTP_PROXY when :ftp_proxy is set" do
|
|
930
|
+
config[:ftp_proxy] = "ftp://proxy"
|
|
931
|
+
|
|
932
|
+
cmd.must_equal(outdent!(<<-CODE.chomp))
|
|
933
|
+
$env:ftp_proxy = "ftp://proxy"
|
|
934
|
+
$env:FTP_PROXY = "ftp://proxy"
|
|
935
|
+
mkdir foo
|
|
936
|
+
CODE
|
|
937
|
+
end
|
|
938
|
+
|
|
939
|
+
it "exports all http proxy variables when all are set" do
|
|
812
940
|
config[:http_proxy] = "http://proxy"
|
|
813
941
|
config[:https_proxy] = "https://proxy"
|
|
942
|
+
config[:ftp_proxy] = "ftp://proxy"
|
|
943
|
+
|
|
944
|
+
cmd.must_equal(outdent!(<<-CODE.chomp))
|
|
945
|
+
$env:http_proxy = "http://proxy"
|
|
946
|
+
$env:HTTP_PROXY = "http://proxy"
|
|
947
|
+
$env:https_proxy = "https://proxy"
|
|
948
|
+
$env:HTTPS_PROXY = "https://proxy"
|
|
949
|
+
$env:ftp_proxy = "ftp://proxy"
|
|
950
|
+
$env:FTP_PROXY = "ftp://proxy"
|
|
951
|
+
mkdir foo
|
|
952
|
+
CODE
|
|
953
|
+
end
|
|
954
|
+
|
|
955
|
+
it "exports http_proxy & HTTP_PROXY from workstation when :http_proxy isn't set" do
|
|
956
|
+
ENV["http_proxy"] = "http://proxy"
|
|
957
|
+
ENV["HTTP_PROXY"] = "http://proxy"
|
|
958
|
+
|
|
959
|
+
cmd.must_equal(outdent!(<<-CODE.chomp))
|
|
960
|
+
$env:http_proxy = "http://proxy"
|
|
961
|
+
$env:HTTP_PROXY = "http://proxy"
|
|
962
|
+
mkdir foo
|
|
963
|
+
CODE
|
|
964
|
+
end
|
|
965
|
+
|
|
966
|
+
it "exports https_proxy & HTTPS_PROXY from workstation when :https_proxy isn't set" do
|
|
967
|
+
ENV["https_proxy"] = "https://proxy"
|
|
968
|
+
ENV["HTTPS_PROXY"] = "https://proxy"
|
|
969
|
+
|
|
970
|
+
cmd.must_equal(outdent!(<<-CODE.chomp))
|
|
971
|
+
$env:https_proxy = "https://proxy"
|
|
972
|
+
$env:HTTPS_PROXY = "https://proxy"
|
|
973
|
+
mkdir foo
|
|
974
|
+
CODE
|
|
975
|
+
end
|
|
976
|
+
|
|
977
|
+
it "exports ftp_proxy & FTP_PROXY from workstation when :ftp_proxy isn't set" do
|
|
978
|
+
ENV["ftp_proxy"] = "ftp://proxy"
|
|
979
|
+
ENV["FTP_PROXY"] = "ftp://proxy"
|
|
980
|
+
|
|
981
|
+
cmd.must_equal(outdent!(<<-CODE.chomp))
|
|
982
|
+
$env:ftp_proxy = "ftp://proxy"
|
|
983
|
+
$env:FTP_PROXY = "ftp://proxy"
|
|
984
|
+
mkdir foo
|
|
985
|
+
CODE
|
|
986
|
+
end
|
|
987
|
+
|
|
988
|
+
it "exports no_proxy & NO_PROXY from workstation when http_proxy is set from workstation" do
|
|
989
|
+
ENV["http_proxy"] = "http://proxy"
|
|
990
|
+
ENV["HTTP_PROXY"] = "http://proxy"
|
|
991
|
+
ENV["no_proxy"] = "http://no"
|
|
992
|
+
ENV["NO_PROXY"] = "http://no"
|
|
814
993
|
|
|
815
994
|
cmd.must_equal(outdent!(<<-CODE.chomp))
|
|
816
995
|
$env:http_proxy = "http://proxy"
|
|
817
996
|
$env:HTTP_PROXY = "http://proxy"
|
|
997
|
+
$env:no_proxy = "http://no"
|
|
998
|
+
$env:NO_PROXY = "http://no"
|
|
999
|
+
mkdir foo
|
|
1000
|
+
CODE
|
|
1001
|
+
end
|
|
1002
|
+
|
|
1003
|
+
it "exports no_proxy & NO_PROXY from workstation when https_proxy is set from workstation" do
|
|
1004
|
+
ENV["https_proxy"] = "https://proxy"
|
|
1005
|
+
ENV["HTTPS_PROXY"] = "https://proxy"
|
|
1006
|
+
ENV["no_proxy"] = "http://no"
|
|
1007
|
+
ENV["NO_PROXY"] = "http://no"
|
|
1008
|
+
|
|
1009
|
+
cmd.must_equal(outdent!(<<-CODE.chomp))
|
|
818
1010
|
$env:https_proxy = "https://proxy"
|
|
819
1011
|
$env:HTTPS_PROXY = "https://proxy"
|
|
1012
|
+
$env:no_proxy = "http://no"
|
|
1013
|
+
$env:NO_PROXY = "http://no"
|
|
1014
|
+
mkdir foo
|
|
1015
|
+
CODE
|
|
1016
|
+
end
|
|
1017
|
+
|
|
1018
|
+
it "exports no_proxy & NO_PROXY from workstation when ftp_proxy is set from workstation" do
|
|
1019
|
+
ENV["ftp_proxy"] = "ftp://proxy"
|
|
1020
|
+
ENV["FTP_PROXY"] = "ftp://proxy"
|
|
1021
|
+
ENV["no_proxy"] = "http://no"
|
|
1022
|
+
ENV["NO_PROXY"] = "http://no"
|
|
1023
|
+
|
|
1024
|
+
cmd.must_equal(outdent!(<<-CODE.chomp))
|
|
1025
|
+
$env:ftp_proxy = "ftp://proxy"
|
|
1026
|
+
$env:FTP_PROXY = "ftp://proxy"
|
|
1027
|
+
$env:no_proxy = "http://no"
|
|
1028
|
+
$env:NO_PROXY = "http://no"
|
|
820
1029
|
mkdir foo
|
|
821
1030
|
CODE
|
|
822
1031
|
end
|
|
@@ -288,11 +288,18 @@ describe Kitchen::Driver::SSHBase do
|
|
|
288
288
|
provisioner.stubs(:[]).with(:root_path).returns("/rooty")
|
|
289
289
|
FakeFS.activate!
|
|
290
290
|
FileUtils.mkdir_p("/tmp")
|
|
291
|
+
@original_env = ENV.to_hash
|
|
292
|
+
ENV.replace("http_proxy" => nil, "HTTP_PROXY" => nil,
|
|
293
|
+
"https_proxy" => nil, "HTTPS_PROXY" => nil,
|
|
294
|
+
"ftp_proxy" => nil, "FTP_PROXY" => nil,
|
|
295
|
+
"no_proxy" => nil, "NO_PROXY" => nil)
|
|
291
296
|
end
|
|
292
297
|
|
|
293
298
|
after do
|
|
294
299
|
FakeFS.deactivate!
|
|
295
300
|
FakeFS::FileSystem.clear
|
|
301
|
+
ENV.clear
|
|
302
|
+
ENV.replace(@original_env)
|
|
296
303
|
end
|
|
297
304
|
|
|
298
305
|
constructs_an_ssh_connection
|
|
@@ -333,6 +340,33 @@ describe Kitchen::Driver::SSHBase do
|
|
|
333
340
|
cmd
|
|
334
341
|
end
|
|
335
342
|
|
|
343
|
+
it "invokes the #install_command with ENV[\"http_proxy\"] set" do
|
|
344
|
+
ENV["http_proxy"] = "http://proxy"
|
|
345
|
+
transport.stubs(:connection).yields(connection)
|
|
346
|
+
if running_tests_on_windows?
|
|
347
|
+
connection.expects(:execute).
|
|
348
|
+
with("env http_proxy=http://proxy HTTP_PROXY=http://proxy install")
|
|
349
|
+
else
|
|
350
|
+
connection.expects(:execute).with("env http_proxy=http://proxy install")
|
|
351
|
+
end
|
|
352
|
+
cmd
|
|
353
|
+
end
|
|
354
|
+
|
|
355
|
+
it "invokes the #install_command with ENV[\"http_proxy\"] and ENV[\"no_proxy\"] set" do
|
|
356
|
+
ENV["http_proxy"] = "http://proxy"
|
|
357
|
+
ENV["no_proxy"] = "http://no"
|
|
358
|
+
transport.stubs(:connection).yields(connection)
|
|
359
|
+
if running_tests_on_windows?
|
|
360
|
+
connection.expects(:execute).
|
|
361
|
+
with("env http_proxy=http://proxy HTTP_PROXY=http://proxy " \
|
|
362
|
+
"no_proxy=http://no NO_PROXY=http://no install")
|
|
363
|
+
else
|
|
364
|
+
connection.expects(:execute).with("env http_proxy=http://proxy " \
|
|
365
|
+
"no_proxy=http://no install")
|
|
366
|
+
end
|
|
367
|
+
cmd
|
|
368
|
+
end
|
|
369
|
+
|
|
336
370
|
it "invokes the #install_command with :https_proxy set in config" do
|
|
337
371
|
config[:https_proxy] = "https://proxy"
|
|
338
372
|
transport.stubs(:connection).yields(connection)
|
|
@@ -341,12 +375,75 @@ describe Kitchen::Driver::SSHBase do
|
|
|
341
375
|
cmd
|
|
342
376
|
end
|
|
343
377
|
|
|
344
|
-
it "invokes the #install_command with
|
|
378
|
+
it "invokes the #install_command with ENV[\"https_proxy\"] set" do
|
|
379
|
+
ENV["https_proxy"] = "https://proxy"
|
|
380
|
+
transport.stubs(:connection).yields(connection)
|
|
381
|
+
if running_tests_on_windows?
|
|
382
|
+
connection.expects(:execute).
|
|
383
|
+
with("env https_proxy=https://proxy HTTPS_PROXY=https://proxy install")
|
|
384
|
+
else
|
|
385
|
+
connection.expects(:execute).with("env https_proxy=https://proxy install")
|
|
386
|
+
end
|
|
387
|
+
cmd
|
|
388
|
+
end
|
|
389
|
+
|
|
390
|
+
it "invokes the #install_command with ENV[\"https_proxy\"] and ENV[\"no_proxy\"] set" do
|
|
391
|
+
ENV["https_proxy"] = "https://proxy"
|
|
392
|
+
ENV["no_proxy"] = "https://no"
|
|
393
|
+
transport.stubs(:connection).yields(connection)
|
|
394
|
+
if running_tests_on_windows?
|
|
395
|
+
connection.expects(:execute).
|
|
396
|
+
with("env https_proxy=https://proxy HTTPS_PROXY=https://proxy " \
|
|
397
|
+
"no_proxy=https://no NO_PROXY=https://no install")
|
|
398
|
+
else
|
|
399
|
+
connection.expects(:execute).with("env https_proxy=https://proxy " \
|
|
400
|
+
"no_proxy=https://no install")
|
|
401
|
+
end
|
|
402
|
+
cmd
|
|
403
|
+
end
|
|
404
|
+
|
|
405
|
+
it "invokes the #install_command with :ftp_proxy set in config" do
|
|
406
|
+
config[:ftp_proxy] = "ftp://proxy"
|
|
407
|
+
transport.stubs(:connection).yields(connection)
|
|
408
|
+
connection.expects(:execute).with("env ftp_proxy=ftp://proxy install")
|
|
409
|
+
|
|
410
|
+
cmd
|
|
411
|
+
end
|
|
412
|
+
|
|
413
|
+
it "invokes the #install_command with ENV[\"ftp_proxy\"] set" do
|
|
414
|
+
ENV["ftp_proxy"] = "ftp://proxy"
|
|
415
|
+
transport.stubs(:connection).yields(connection)
|
|
416
|
+
if running_tests_on_windows?
|
|
417
|
+
connection.expects(:execute).
|
|
418
|
+
with("env ftp_proxy=ftp://proxy FTP_PROXY=ftp://proxy install")
|
|
419
|
+
else
|
|
420
|
+
connection.expects(:execute).with("env ftp_proxy=ftp://proxy install")
|
|
421
|
+
end
|
|
422
|
+
cmd
|
|
423
|
+
end
|
|
424
|
+
|
|
425
|
+
it "invokes the #install_command with ENV[\"ftp_proxy\"] and ENV[\"no_proxy\"] set" do
|
|
426
|
+
ENV["ftp_proxy"] = "ftp://proxy"
|
|
427
|
+
ENV["no_proxy"] = "http://no"
|
|
428
|
+
transport.stubs(:connection).yields(connection)
|
|
429
|
+
if running_tests_on_windows?
|
|
430
|
+
connection.expects(:execute).
|
|
431
|
+
with("env ftp_proxy=ftp://proxy FTP_PROXY=http://proxy " \
|
|
432
|
+
"no_proxy=http://no NO_PROXY=http://no install")
|
|
433
|
+
else
|
|
434
|
+
connection.expects(:execute).with("env ftp_proxy=ftp://proxy " \
|
|
435
|
+
"no_proxy=http://no install")
|
|
436
|
+
end
|
|
437
|
+
cmd
|
|
438
|
+
end
|
|
439
|
+
|
|
440
|
+
it "invokes the #install_command with :http_proxy & :https_proxy & :ftp_proxy set" do
|
|
345
441
|
config[:http_proxy] = "http://proxy"
|
|
346
442
|
config[:https_proxy] = "https://proxy"
|
|
443
|
+
config[:ftp_proxy] = "ftp://proxy"
|
|
347
444
|
transport.stubs(:connection).yields(connection)
|
|
348
445
|
connection.expects(:execute).with(
|
|
349
|
-
"env http_proxy=http://proxy https_proxy=https://proxy install")
|
|
446
|
+
"env http_proxy=http://proxy https_proxy=https://proxy ftp_proxy=ftp://proxy install")
|
|
350
447
|
|
|
351
448
|
cmd
|
|
352
449
|
end
|
|
@@ -428,12 +525,21 @@ describe Kitchen::Driver::SSHBase do
|
|
|
428
525
|
cmd
|
|
429
526
|
end
|
|
430
527
|
|
|
431
|
-
it "invokes the Verifier#install_command with :
|
|
528
|
+
it "invokes the Verifier#install_command with :ftp_proxy set in config" do
|
|
529
|
+
config[:ftp_proxy] = "ftp://proxy"
|
|
530
|
+
transport.stubs(:connection).yields(connection)
|
|
531
|
+
connection.expects(:execute).with("env ftp_proxy=ftp://proxy install")
|
|
532
|
+
|
|
533
|
+
cmd
|
|
534
|
+
end
|
|
535
|
+
|
|
536
|
+
it "invokes the Verifier#install_command with :http_proxy & :https_proxy & :ftp_proxy set" do
|
|
432
537
|
config[:http_proxy] = "http://proxy"
|
|
433
538
|
config[:https_proxy] = "https://proxy"
|
|
539
|
+
config[:ftp_proxy] = "ftp://proxy"
|
|
434
540
|
transport.stubs(:connection).yields(connection)
|
|
435
541
|
connection.expects(:execute).with(
|
|
436
|
-
"env http_proxy=http://proxy https_proxy=https://proxy install")
|
|
542
|
+
"env http_proxy=http://proxy https_proxy=https://proxy ftp_proxy=ftp://proxy install")
|
|
437
543
|
|
|
438
544
|
cmd
|
|
439
545
|
end
|
|
@@ -505,11 +611,19 @@ describe Kitchen::Driver::SSHBase do
|
|
|
505
611
|
cmd
|
|
506
612
|
end
|
|
507
613
|
|
|
508
|
-
it "invokes Verifier##{phase}_command with :
|
|
614
|
+
it "invokes Verifier##{phase}_command with :ftp_proxy set in config" do
|
|
615
|
+
config[:ftp_proxy] = "ftp://proxy"
|
|
616
|
+
connection.expects(:execute).with("env ftp_proxy=ftp://proxy #{phase}")
|
|
617
|
+
|
|
618
|
+
cmd
|
|
619
|
+
end
|
|
620
|
+
|
|
621
|
+
it "invokes Verifier##{phase}_command with :http_proxy & :https_proxy & :ftp_proxy set" do
|
|
509
622
|
config[:http_proxy] = "http://proxy"
|
|
510
623
|
config[:https_proxy] = "https://proxy"
|
|
624
|
+
config[:ftp_proxy] = "ftp://proxy"
|
|
511
625
|
connection.expects(:execute).with(
|
|
512
|
-
"env http_proxy=http://proxy https_proxy=https://proxy #{phase}")
|
|
626
|
+
"env http_proxy=http://proxy https_proxy=https://proxy ftp_proxy=ftp://proxy #{phase}")
|
|
513
627
|
|
|
514
628
|
cmd
|
|
515
629
|
end
|
|
@@ -919,12 +1033,21 @@ describe Kitchen::Driver::SSHBase do
|
|
|
919
1033
|
cmd
|
|
920
1034
|
end
|
|
921
1035
|
|
|
922
|
-
it "invokes the #install_command with :
|
|
1036
|
+
it "invokes the #install_command with :ftp_proxy set in config" do
|
|
1037
|
+
config[:ftp_proxy] = "ftp://proxy"
|
|
1038
|
+
Kitchen::SSH.stubs(:new).returns(connection)
|
|
1039
|
+
connection.expects(:exec).with("env ftp_proxy=ftp://proxy huh")
|
|
1040
|
+
|
|
1041
|
+
cmd
|
|
1042
|
+
end
|
|
1043
|
+
|
|
1044
|
+
it "invokes the #install_command with :http_proxy & :https_proxy & :ftp_proxy set" do
|
|
923
1045
|
config[:http_proxy] = "http://proxy"
|
|
924
1046
|
config[:https_proxy] = "https://proxy"
|
|
1047
|
+
config[:ftp_proxy] = "ftp://proxy"
|
|
925
1048
|
Kitchen::SSH.stubs(:new).returns(connection)
|
|
926
1049
|
connection.expects(:exec).with(
|
|
927
|
-
"env http_proxy=http://proxy https_proxy=https://proxy huh")
|
|
1050
|
+
"env http_proxy=http://proxy https_proxy=https://proxy ftp_proxy=ftp://proxy huh")
|
|
928
1051
|
|
|
929
1052
|
cmd
|
|
930
1053
|
end
|
|
@@ -87,4 +87,31 @@ describe Kitchen::LazyHash do
|
|
|
87
87
|
converted.fetch(:genre).must_equal "heavy metal"
|
|
88
88
|
end
|
|
89
89
|
end
|
|
90
|
+
|
|
91
|
+
describe "select" do
|
|
92
|
+
it "calls Procs when appropriate" do
|
|
93
|
+
Kitchen::LazyHash.new(hash_obj, context).select { |_, _| true }.
|
|
94
|
+
must_equal :shed_color => "blue", :barn => "locked", :genre => "heavy metal"
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
describe "enumerable" do
|
|
99
|
+
it "is an Enumerable" do
|
|
100
|
+
assert Kitchen::LazyHash.new(hash_obj, context).is_a? Enumerable
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
it "returns an Enumerator from each() if no block given" do
|
|
104
|
+
e = Kitchen::LazyHash.new(hash_obj, context).each
|
|
105
|
+
e.is_a? Enumerator
|
|
106
|
+
e.next.must_equal [:shed_color, "blue"]
|
|
107
|
+
e.next.must_equal [:barn, "locked"]
|
|
108
|
+
e.next.must_equal [:genre, "heavy metal"]
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
it "yields each item to the block if a block is given to each()" do
|
|
112
|
+
items = []
|
|
113
|
+
Kitchen::LazyHash.new(hash_obj, context).each { |i| items << i }
|
|
114
|
+
items.must_equal [[:shed_color, "blue"], [:barn, "locked"], [:genre, "heavy metal"]]
|
|
115
|
+
end
|
|
116
|
+
end
|
|
90
117
|
end
|
data/spec/kitchen/logger_spec.rb
CHANGED
|
@@ -282,6 +282,16 @@ describe Kitchen::Logger do
|
|
|
282
282
|
)
|
|
283
283
|
end
|
|
284
284
|
|
|
285
|
+
it "logger that receives mixed first chunk will flush next message with newline" do
|
|
286
|
+
logger << "partially\no"
|
|
287
|
+
logger << "kay\n"
|
|
288
|
+
|
|
289
|
+
stdout.string.must_equal(
|
|
290
|
+
colorize(" partially", opts[:color]) + "\n" +
|
|
291
|
+
colorize(" okay", opts[:color]) + "\n"
|
|
292
|
+
)
|
|
293
|
+
end
|
|
294
|
+
|
|
285
295
|
it "logger chomps carriage return characters" do
|
|
286
296
|
logger << [
|
|
287
297
|
"-----> banner\r",
|
|
@@ -131,6 +131,10 @@ describe Kitchen::Provisioner::Base do
|
|
|
131
131
|
it ":http_proxys defaults to nil" do
|
|
132
132
|
provisioner[:https_proxy].must_equal nil
|
|
133
133
|
end
|
|
134
|
+
|
|
135
|
+
it ":ftp_proxy defaults to nil" do
|
|
136
|
+
provisioner[:ftp_proxy].must_equal nil
|
|
137
|
+
end
|
|
134
138
|
end
|
|
135
139
|
|
|
136
140
|
describe "#call" do
|
|
@@ -325,4 +329,25 @@ describe Kitchen::Provisioner::Base do
|
|
|
325
329
|
end
|
|
326
330
|
end
|
|
327
331
|
end
|
|
332
|
+
|
|
333
|
+
describe "#prefix_command" do
|
|
334
|
+
|
|
335
|
+
describe "with :command_prefix set" do
|
|
336
|
+
|
|
337
|
+
before { config[:command_prefix] = "my_prefix" }
|
|
338
|
+
|
|
339
|
+
it "prepends the command with the prefix" do
|
|
340
|
+
provisioner.send(:prefix_command, "my_command").must_equal("my_prefix my_command")
|
|
341
|
+
end
|
|
342
|
+
end
|
|
343
|
+
|
|
344
|
+
describe "with :command_prefix unset" do
|
|
345
|
+
|
|
346
|
+
before { config[:command_prefix] = nil }
|
|
347
|
+
|
|
348
|
+
it "returns an unaltered command" do
|
|
349
|
+
provisioner.send(:prefix_command, "my_command").must_equal("my_command")
|
|
350
|
+
end
|
|
351
|
+
end
|
|
352
|
+
end
|
|
328
353
|
end
|