test-kitchen 1.3.1 → 1.4.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.cane +2 -0
- data/.gitignore +4 -0
- data/CHANGELOG.md +45 -0
- data/Rakefile +15 -0
- data/features/kitchen_action_commands.feature +12 -9
- data/features/kitchen_defaults.feature +38 -0
- data/features/kitchen_init_command.feature +0 -1
- data/features/kitchen_list_command.feature +2 -2
- data/features/kitchen_login_command.feature +7 -1
- data/features/kitchen_test_command.feature +4 -4
- data/lib/kitchen.rb +40 -11
- data/lib/kitchen/cli.rb +38 -22
- data/lib/kitchen/command/list.rb +5 -2
- data/lib/kitchen/config.rb +45 -18
- data/lib/kitchen/configurable.rb +137 -1
- data/lib/kitchen/data_munger.rb +248 -17
- data/lib/kitchen/driver.rb +1 -1
- data/lib/kitchen/driver/base.rb +1 -83
- data/lib/kitchen/driver/dummy.rb +0 -5
- data/lib/kitchen/driver/ssh_base.rb +177 -22
- data/lib/kitchen/instance.rb +140 -20
- data/lib/kitchen/logger.rb +43 -8
- data/lib/kitchen/login_command.rb +14 -5
- data/lib/kitchen/platform.rb +19 -0
- data/lib/kitchen/provisioner.rb +5 -3
- data/lib/kitchen/provisioner/base.rb +46 -48
- data/lib/kitchen/provisioner/chef/common_sandbox.rb +322 -0
- data/lib/kitchen/provisioner/chef_base.rb +179 -286
- data/lib/kitchen/provisioner/chef_solo.rb +11 -5
- data/lib/kitchen/provisioner/chef_zero.rb +108 -94
- data/lib/kitchen/provisioner/dummy.rb +47 -0
- data/lib/kitchen/provisioner/shell.rb +45 -12
- data/lib/kitchen/rake_tasks.rb +1 -1
- data/lib/kitchen/ssh.rb +1 -1
- data/lib/kitchen/thor_tasks.rb +1 -1
- data/lib/kitchen/transport.rb +54 -0
- data/lib/kitchen/transport/base.rb +146 -0
- data/lib/kitchen/transport/dummy.rb +75 -0
- data/lib/kitchen/transport/ssh.rb +325 -0
- data/lib/kitchen/transport/winrm.rb +508 -0
- data/lib/kitchen/transport/winrm/command_executor.rb +188 -0
- data/lib/kitchen/transport/winrm/file_transporter.rb +454 -0
- data/lib/kitchen/transport/winrm/logging.rb +50 -0
- data/lib/kitchen/transport/winrm/template.rb +74 -0
- data/lib/kitchen/transport/winrm/tmp_zip.rb +187 -0
- data/lib/kitchen/verifier.rb +55 -0
- data/lib/kitchen/verifier/base.rb +191 -0
- data/lib/kitchen/verifier/busser.rb +266 -0
- data/lib/kitchen/verifier/dummy.rb +75 -0
- data/lib/kitchen/version.rb +1 -1
- data/spec/kitchen/cli_spec.rb +56 -0
- data/spec/kitchen/config_spec.rb +61 -20
- data/spec/kitchen/configurable_spec.rb +327 -1
- data/spec/kitchen/data_munger_spec.rb +777 -14
- data/spec/kitchen/driver/base_spec.rb +7 -38
- data/spec/kitchen/driver/dummy_spec.rb +0 -29
- data/spec/kitchen/driver/ssh_base_spec.rb +580 -236
- data/spec/kitchen/driver_spec.rb +1 -0
- data/spec/kitchen/instance_spec.rb +383 -83
- data/spec/kitchen/login_command_spec.rb +29 -10
- data/spec/kitchen/platform_spec.rb +58 -2
- data/spec/kitchen/provisioner/base_spec.rb +170 -18
- data/spec/kitchen/provisioner/chef_base_spec.rb +454 -104
- data/spec/kitchen/provisioner/chef_solo_spec.rb +307 -104
- data/spec/kitchen/provisioner/chef_zero_spec.rb +561 -230
- data/spec/kitchen/provisioner/dummy_spec.rb +91 -0
- data/spec/kitchen/provisioner/shell_spec.rb +158 -56
- data/spec/kitchen/provisioner_spec.rb +37 -0
- data/spec/kitchen/ssh_spec.rb +19 -19
- data/spec/kitchen/transport/base_spec.rb +89 -0
- data/spec/kitchen/transport/ssh_spec.rb +1147 -0
- data/spec/kitchen/transport/winrm/command_executor_spec.rb +400 -0
- data/spec/kitchen/transport/winrm/file_transporter_spec.rb +876 -0
- data/spec/kitchen/transport/winrm/logging_spec.rb +92 -0
- data/spec/kitchen/transport/winrm/template_spec.rb +51 -0
- data/spec/kitchen/transport/winrm/tmp_zip_spec.rb +132 -0
- data/spec/kitchen/transport/winrm_spec.rb +1069 -0
- data/spec/kitchen/transport_spec.rb +112 -0
- data/spec/kitchen/verifier/base_spec.rb +310 -0
- data/spec/kitchen/verifier/busser_spec.rb +540 -0
- data/spec/kitchen/verifier/dummy_spec.rb +91 -0
- data/spec/kitchen/verifier_spec.rb +120 -0
- data/spec/kitchen_spec.rb +7 -0
- data/spec/spec_helper.rb +8 -0
- data/spec/support/powershell_max_size_spec.rb +40 -0
- data/support/busser_install_command.ps1 +14 -0
- data/support/busser_install_command.sh +15 -0
- data/support/check_files.ps1.erb +48 -0
- data/support/chef_base_init_command.ps1 +18 -0
- data/support/chef_base_init_command.sh +2 -0
- data/support/chef_base_install_command.ps1 +76 -0
- data/support/chef_base_install_command.sh +137 -0
- data/support/chef_zero_prepare_command_legacy.ps1 +9 -0
- data/support/chef_zero_prepare_command_legacy.sh +10 -0
- data/support/decode_files.ps1.erb +61 -0
- data/test-kitchen.gemspec +2 -0
- metadata +97 -8
- data/lib/kitchen/busser.rb +0 -316
- data/spec/kitchen/busser_spec.rb +0 -490
- data/support/chef_helpers.sh +0 -16
@@ -19,6 +19,7 @@
|
|
19
19
|
require_relative "../spec_helper"
|
20
20
|
require "stringio"
|
21
21
|
|
22
|
+
require "kitchen"
|
22
23
|
require "kitchen/errors"
|
23
24
|
require "kitchen/configurable"
|
24
25
|
|
@@ -30,8 +31,11 @@ module Kitchen
|
|
30
31
|
|
31
32
|
include Kitchen::Configurable
|
32
33
|
|
34
|
+
attr_reader :instance
|
35
|
+
|
33
36
|
def initialize(config = {})
|
34
37
|
init_config(config)
|
38
|
+
@instance = config[:instance]
|
35
39
|
end
|
36
40
|
end
|
37
41
|
|
@@ -44,6 +48,7 @@ module Kitchen
|
|
44
48
|
default_config :edible, true
|
45
49
|
default_config :fetch_command, "curl"
|
46
50
|
default_config :success_path, "./success"
|
51
|
+
default_config :bunch_of_paths, %W[./a ./b ./c]
|
47
52
|
default_config :beans_url do |subject|
|
48
53
|
"http://gim.me/#{subject[:beans]}"
|
49
54
|
end
|
@@ -61,6 +66,7 @@ module Kitchen
|
|
61
66
|
end
|
62
67
|
|
63
68
|
expand_path_for :success_path
|
69
|
+
expand_path_for :bunch_of_paths
|
64
70
|
expand_path_for :relative_path, false
|
65
71
|
expand_path_for :another_path
|
66
72
|
expand_path_for :complex_path do |subject|
|
@@ -90,7 +96,10 @@ end
|
|
90
96
|
describe Kitchen::Configurable do
|
91
97
|
|
92
98
|
let(:config) { Hash.new }
|
93
|
-
let(:
|
99
|
+
let(:platform) { stub }
|
100
|
+
let(:instance) do
|
101
|
+
stub(:name => "coolbeans", :to_str => "<instance>", :platform => platform)
|
102
|
+
end
|
94
103
|
|
95
104
|
let(:subject) do
|
96
105
|
Kitchen::Thing::Tiny.new(config).finalize_config!(instance)
|
@@ -312,6 +321,12 @@ describe Kitchen::Configurable do
|
|
312
321
|
subject[:success_path].must_equal "/the/other/one"
|
313
322
|
end
|
314
323
|
|
324
|
+
it "expands all items if path is an array" do
|
325
|
+
subject[:bunch_of_paths].must_equal %W[
|
326
|
+
/tmp/yo/self/a /tmp/yo/self/b /tmp/yo/self/c
|
327
|
+
]
|
328
|
+
end
|
329
|
+
|
315
330
|
it "doesn't expand path with a falsy expand_path_for value" do
|
316
331
|
config[:relative_path] = "./rel"
|
317
332
|
|
@@ -354,6 +369,10 @@ describe Kitchen::Configurable do
|
|
354
369
|
end
|
355
370
|
end
|
356
371
|
|
372
|
+
it "#name returns the name of the plugin" do
|
373
|
+
subject.name.must_equal "Tiny"
|
374
|
+
end
|
375
|
+
|
357
376
|
describe "#diagnose" do
|
358
377
|
|
359
378
|
it "returns an empty hash for no config" do
|
@@ -487,4 +506,311 @@ describe Kitchen::Configurable do
|
|
487
506
|
end
|
488
507
|
end
|
489
508
|
end
|
509
|
+
|
510
|
+
describe "#remote_path_join" do
|
511
|
+
|
512
|
+
it "returns unix style path separators for unix os_type" do
|
513
|
+
platform.stubs(:os_type).returns("unix")
|
514
|
+
|
515
|
+
subject.remote_path_join("a", "b", "c").must_equal "a/b/c"
|
516
|
+
end
|
517
|
+
|
518
|
+
it "returns windows style path separators for windows os_type" do
|
519
|
+
platform.stubs(:os_type).returns("windows")
|
520
|
+
|
521
|
+
subject.remote_path_join("a", "b", "c").must_equal "a\\b\\c"
|
522
|
+
end
|
523
|
+
|
524
|
+
it "accepts combinations of strings and arrays" do
|
525
|
+
platform.stubs(:os_type).returns("unix")
|
526
|
+
|
527
|
+
subject.remote_path_join(%W[a b], "c", %W[d e]).must_equal "a/b/c/d/e"
|
528
|
+
end
|
529
|
+
|
530
|
+
it "accepts a single array" do
|
531
|
+
platform.stubs(:os_type).returns("windows")
|
532
|
+
|
533
|
+
subject.remote_path_join(%W[a b]).must_equal "a\\b"
|
534
|
+
end
|
535
|
+
|
536
|
+
it "converts all windows path separators to unix for unix os_type" do
|
537
|
+
platform.stubs(:os_type).returns("unix")
|
538
|
+
|
539
|
+
subject.remote_path_join("\\a\\b", "c/d").must_equal "/a/b/c/d"
|
540
|
+
end
|
541
|
+
|
542
|
+
it "converts all unix path separators to windows for windows os_type" do
|
543
|
+
platform.stubs(:os_type).returns("windows")
|
544
|
+
|
545
|
+
subject.remote_path_join("/a/b", "c\\d").must_equal "\\a\\b\\c\\d"
|
546
|
+
end
|
547
|
+
end
|
548
|
+
|
549
|
+
describe "#windows_os?" do
|
550
|
+
|
551
|
+
it "for windows type platform returns true" do
|
552
|
+
platform.stubs(:os_type).returns("windows")
|
553
|
+
|
554
|
+
subject.windows_os?.must_equal true
|
555
|
+
end
|
556
|
+
|
557
|
+
it "for unix type platform returns false" do
|
558
|
+
platform.stubs(:os_type).returns("unix")
|
559
|
+
|
560
|
+
subject.windows_os?.must_equal false
|
561
|
+
end
|
562
|
+
|
563
|
+
it "for newfangled type platform return false" do
|
564
|
+
platform.stubs(:os_type).returns("internet_cat")
|
565
|
+
|
566
|
+
subject.windows_os?.must_equal false
|
567
|
+
end
|
568
|
+
|
569
|
+
it "for unset type platform returns false" do
|
570
|
+
platform.stubs(:os_type).returns(nil)
|
571
|
+
|
572
|
+
subject.windows_os?.must_equal false
|
573
|
+
end
|
574
|
+
end
|
575
|
+
|
576
|
+
describe "#unix_os?" do
|
577
|
+
|
578
|
+
it "for windows type platform returns false" do
|
579
|
+
platform.stubs(:os_type).returns("windows")
|
580
|
+
|
581
|
+
subject.unix_os?.must_equal false
|
582
|
+
end
|
583
|
+
|
584
|
+
it "for unix type platform returns true" do
|
585
|
+
platform.stubs(:os_type).returns("unix")
|
586
|
+
|
587
|
+
subject.unix_os?.must_equal true
|
588
|
+
end
|
589
|
+
|
590
|
+
it "for newfangled type platform return false" do
|
591
|
+
platform.stubs(:os_type).returns("internet_cat")
|
592
|
+
|
593
|
+
subject.unix_os?.must_equal false
|
594
|
+
end
|
595
|
+
|
596
|
+
it "for unset type platform returns true" do
|
597
|
+
platform.stubs(:os_type).returns(nil)
|
598
|
+
|
599
|
+
subject.unix_os?.must_equal true
|
600
|
+
end
|
601
|
+
end
|
602
|
+
|
603
|
+
describe "#powershell_shell?" do
|
604
|
+
|
605
|
+
it "for powershell type shell returns true" do
|
606
|
+
platform.stubs(:shell_type).returns("powershell")
|
607
|
+
|
608
|
+
subject.powershell_shell?.must_equal true
|
609
|
+
end
|
610
|
+
|
611
|
+
it "for bourne type shell returns false" do
|
612
|
+
platform.stubs(:shell_type).returns("bourne")
|
613
|
+
|
614
|
+
subject.powershell_shell?.must_equal false
|
615
|
+
end
|
616
|
+
|
617
|
+
it "for newfangled type shell return false" do
|
618
|
+
platform.stubs(:shell_type).returns("internet_cat")
|
619
|
+
|
620
|
+
subject.powershell_shell?.must_equal false
|
621
|
+
end
|
622
|
+
|
623
|
+
it "for unset type shell returns false" do
|
624
|
+
platform.stubs(:shell_type).returns(nil)
|
625
|
+
|
626
|
+
subject.powershell_shell?.must_equal false
|
627
|
+
end
|
628
|
+
end
|
629
|
+
|
630
|
+
describe "#bourne_shell?" do
|
631
|
+
|
632
|
+
it "for powershell type shell returns false" do
|
633
|
+
platform.stubs(:shell_type).returns("powershell")
|
634
|
+
|
635
|
+
subject.bourne_shell?.must_equal false
|
636
|
+
end
|
637
|
+
|
638
|
+
it "for bourne type shell returns true" do
|
639
|
+
platform.stubs(:shell_type).returns("bourne")
|
640
|
+
|
641
|
+
subject.bourne_shell?.must_equal true
|
642
|
+
end
|
643
|
+
|
644
|
+
it "for newfangled type shell return false" do
|
645
|
+
platform.stubs(:shell_type).returns("internet_cat")
|
646
|
+
|
647
|
+
subject.bourne_shell?.must_equal false
|
648
|
+
end
|
649
|
+
|
650
|
+
it "for unset type shell returns true" do
|
651
|
+
platform.stubs(:shell_type).returns(nil)
|
652
|
+
|
653
|
+
subject.bourne_shell?.must_equal true
|
654
|
+
end
|
655
|
+
end
|
656
|
+
|
657
|
+
describe "#shell_env_var" do
|
658
|
+
|
659
|
+
it "for powershell type shells returns a powershell environment variable" do
|
660
|
+
platform.stubs(:shell_type).returns("powershell")
|
661
|
+
|
662
|
+
subject.send(:shell_env_var, "foo", "bar").
|
663
|
+
must_equal %{$env:foo = "bar"}
|
664
|
+
end
|
665
|
+
|
666
|
+
it "for bourne type shells returns a bourne environment variable" do
|
667
|
+
platform.stubs(:shell_type).returns("bourne")
|
668
|
+
|
669
|
+
subject.send(:shell_env_var, "foo", "bar").
|
670
|
+
must_equal %{foo="bar"; export foo}
|
671
|
+
end
|
672
|
+
end
|
673
|
+
|
674
|
+
describe "#shell_var" do
|
675
|
+
|
676
|
+
it "for powershell type shells returns a powershell variable" do
|
677
|
+
platform.stubs(:shell_type).returns("powershell")
|
678
|
+
|
679
|
+
subject.send(:shell_var, "foo", "bar").must_equal %{$foo = "bar"}
|
680
|
+
end
|
681
|
+
|
682
|
+
it "for bourne type shells returns a bourne variable" do
|
683
|
+
platform.stubs(:shell_type).returns("bourne")
|
684
|
+
|
685
|
+
subject.send(:shell_var, "foo", "bar").must_equal %{foo="bar"}
|
686
|
+
end
|
687
|
+
end
|
688
|
+
|
689
|
+
describe "#wrap_shell_code" do
|
690
|
+
|
691
|
+
let(:cmd) { subject.send(:wrap_shell_code, "mkdir foo") }
|
692
|
+
|
693
|
+
describe "for bourne shells" do
|
694
|
+
|
695
|
+
before { platform.stubs(:shell_type).returns("bourne") }
|
696
|
+
|
697
|
+
it "uses bourne shell (sh)" do
|
698
|
+
cmd.must_equal(outdent!(<<-CODE.chomp))
|
699
|
+
sh -c '
|
700
|
+
|
701
|
+
mkdir foo
|
702
|
+
'
|
703
|
+
CODE
|
704
|
+
end
|
705
|
+
|
706
|
+
it "exports http_proxy & HTTP_PROXY when :http_proxy is set" do
|
707
|
+
config[:http_proxy] = "http://proxy"
|
708
|
+
|
709
|
+
cmd.must_equal(outdent!(<<-CODE.chomp))
|
710
|
+
sh -c '
|
711
|
+
http_proxy="http://proxy"; export http_proxy
|
712
|
+
HTTP_PROXY="http://proxy"; export HTTP_PROXY
|
713
|
+
mkdir foo
|
714
|
+
'
|
715
|
+
CODE
|
716
|
+
end
|
717
|
+
|
718
|
+
it "exports https_proxy & HTTPS_PROXY when :https_proxy is set" do
|
719
|
+
config[:https_proxy] = "https://proxy"
|
720
|
+
|
721
|
+
cmd.must_equal(outdent!(<<-CODE.chomp))
|
722
|
+
sh -c '
|
723
|
+
https_proxy="https://proxy"; export https_proxy
|
724
|
+
HTTPS_PROXY="https://proxy"; export HTTPS_PROXY
|
725
|
+
mkdir foo
|
726
|
+
'
|
727
|
+
CODE
|
728
|
+
end
|
729
|
+
|
730
|
+
it "exports all http proxy variables when both are set" do
|
731
|
+
config[:http_proxy] = "http://proxy"
|
732
|
+
config[:https_proxy] = "https://proxy"
|
733
|
+
|
734
|
+
cmd.must_equal(outdent!(<<-CODE.chomp))
|
735
|
+
sh -c '
|
736
|
+
http_proxy="http://proxy"; export http_proxy
|
737
|
+
HTTP_PROXY="http://proxy"; export HTTP_PROXY
|
738
|
+
https_proxy="https://proxy"; export https_proxy
|
739
|
+
HTTPS_PROXY="https://proxy"; export HTTPS_PROXY
|
740
|
+
mkdir foo
|
741
|
+
'
|
742
|
+
CODE
|
743
|
+
end
|
744
|
+
end
|
745
|
+
|
746
|
+
describe "for powershell shells" do
|
747
|
+
|
748
|
+
before { platform.stubs(:shell_type).returns("powershell") }
|
749
|
+
|
750
|
+
it "uses powershell shell" do
|
751
|
+
cmd.must_equal("\nmkdir foo")
|
752
|
+
end
|
753
|
+
|
754
|
+
it "exports http_proxy & HTTP_PROXY when :http_proxy is set" do
|
755
|
+
config[:http_proxy] = "http://proxy"
|
756
|
+
|
757
|
+
cmd.must_equal(outdent!(<<-CODE.chomp))
|
758
|
+
$env:http_proxy = "http://proxy"
|
759
|
+
$env:HTTP_PROXY = "http://proxy"
|
760
|
+
mkdir foo
|
761
|
+
CODE
|
762
|
+
end
|
763
|
+
|
764
|
+
it "exports https_proxy & HTTPS_PROXY when :https_proxy is set" do
|
765
|
+
config[:https_proxy] = "https://proxy"
|
766
|
+
|
767
|
+
cmd.must_equal(outdent!(<<-CODE.chomp))
|
768
|
+
$env:https_proxy = "https://proxy"
|
769
|
+
$env:HTTPS_PROXY = "https://proxy"
|
770
|
+
mkdir foo
|
771
|
+
CODE
|
772
|
+
end
|
773
|
+
|
774
|
+
it "exports all http proxy variables when both are set" do
|
775
|
+
config[:http_proxy] = "http://proxy"
|
776
|
+
config[:https_proxy] = "https://proxy"
|
777
|
+
|
778
|
+
cmd.must_equal(outdent!(<<-CODE.chomp))
|
779
|
+
$env:http_proxy = "http://proxy"
|
780
|
+
$env:HTTP_PROXY = "http://proxy"
|
781
|
+
$env:https_proxy = "https://proxy"
|
782
|
+
$env:HTTPS_PROXY = "https://proxy"
|
783
|
+
mkdir foo
|
784
|
+
CODE
|
785
|
+
end
|
786
|
+
end
|
787
|
+
end
|
788
|
+
|
789
|
+
it "has a default verify dependencies method" do
|
790
|
+
subject.verify_dependencies.must_be_nil
|
791
|
+
end
|
792
|
+
|
793
|
+
describe "#logger" do
|
794
|
+
|
795
|
+
before { @klog = Kitchen.logger }
|
796
|
+
after { Kitchen.logger = @klog }
|
797
|
+
|
798
|
+
it "returns the instance's logger" do
|
799
|
+
logger = stub("logger")
|
800
|
+
instance = stub(:logger => logger)
|
801
|
+
subject = Kitchen::Thing::Tiny.new(config.merge(:instance => instance))
|
802
|
+
subject.send(:logger).must_equal logger
|
803
|
+
end
|
804
|
+
|
805
|
+
it "returns the default logger if instance's logger is not set" do
|
806
|
+
subject = Kitchen::Thing::Tiny.new(config)
|
807
|
+
Kitchen.logger = "yep"
|
808
|
+
|
809
|
+
subject.send(:logger).must_equal Kitchen.logger
|
810
|
+
end
|
811
|
+
end
|
812
|
+
|
813
|
+
def outdent!(*args)
|
814
|
+
Kitchen::Util.outdent!(*args)
|
815
|
+
end
|
490
816
|
end
|
@@ -89,7 +89,8 @@ module Kitchen
|
|
89
89
|
DATA_KEYS = {
|
90
90
|
:driver => :name,
|
91
91
|
:provisioner => :name,
|
92
|
-
:
|
92
|
+
:transport => :name,
|
93
|
+
:verifier => :name
|
93
94
|
}
|
94
95
|
|
95
96
|
DATA_KEYS.each_pair do |key, default_key|
|
@@ -127,6 +128,19 @@ module Kitchen
|
|
127
128
|
)
|
128
129
|
end
|
129
130
|
|
131
|
+
it "returns kitchen config #{key} name from callable" do
|
132
|
+
DataMunger.new(
|
133
|
+
{},
|
134
|
+
{
|
135
|
+
:defaults => {
|
136
|
+
key => ->(suite, platform) { "#{suite}++#{platform}" }
|
137
|
+
}
|
138
|
+
}
|
139
|
+
).public_send("#{key}_data_for", "suite", "platform").must_equal(
|
140
|
+
default_key => "suite++platform"
|
141
|
+
)
|
142
|
+
end
|
143
|
+
|
130
144
|
it "returns common #{key} name" do
|
131
145
|
DataMunger.new(
|
132
146
|
{
|
@@ -1049,12 +1063,12 @@ module Kitchen
|
|
1049
1063
|
end
|
1050
1064
|
end
|
1051
1065
|
|
1052
|
-
describe "for #
|
1066
|
+
describe "for #verifier_data_for" do
|
1053
1067
|
|
1054
1068
|
it "is returned when provided" do
|
1055
1069
|
DataMunger.new(
|
1056
1070
|
{
|
1057
|
-
:
|
1071
|
+
:verifier => "chefy",
|
1058
1072
|
:platforms => [
|
1059
1073
|
{ :name => "plat" }
|
1060
1074
|
],
|
@@ -1065,8 +1079,8 @@ module Kitchen
|
|
1065
1079
|
{
|
1066
1080
|
key => "datvalue"
|
1067
1081
|
}
|
1068
|
-
).
|
1069
|
-
:
|
1082
|
+
).verifier_data_for("sweet", "plat").must_equal(
|
1083
|
+
:name => "chefy",
|
1070
1084
|
key => "datvalue"
|
1071
1085
|
)
|
1072
1086
|
end
|
@@ -1077,7 +1091,7 @@ module Kitchen
|
|
1077
1091
|
:kitchen => {
|
1078
1092
|
key => "datvalue"
|
1079
1093
|
},
|
1080
|
-
:
|
1094
|
+
:verifier => "chefy",
|
1081
1095
|
:platforms => [
|
1082
1096
|
{ :name => "plat" }
|
1083
1097
|
],
|
@@ -1086,8 +1100,8 @@ module Kitchen
|
|
1086
1100
|
]
|
1087
1101
|
},
|
1088
1102
|
{}
|
1089
|
-
).
|
1090
|
-
:
|
1103
|
+
).verifier_data_for("sweet", "plat").must_equal(
|
1104
|
+
:name => "chefy",
|
1091
1105
|
key => "datvalue"
|
1092
1106
|
)
|
1093
1107
|
end
|
@@ -1098,7 +1112,7 @@ module Kitchen
|
|
1098
1112
|
:kitchen => {
|
1099
1113
|
key => "datvalue"
|
1100
1114
|
},
|
1101
|
-
:
|
1115
|
+
:verifier => "chefy",
|
1102
1116
|
:platforms => [
|
1103
1117
|
{ :name => "plat" }
|
1104
1118
|
],
|
@@ -1109,16 +1123,16 @@ module Kitchen
|
|
1109
1123
|
{
|
1110
1124
|
key => "ilose"
|
1111
1125
|
}
|
1112
|
-
).
|
1113
|
-
:
|
1126
|
+
).verifier_data_for("sweet", "plat").must_equal(
|
1127
|
+
:name => "chefy",
|
1114
1128
|
key => "datvalue"
|
1115
1129
|
)
|
1116
1130
|
end
|
1117
1131
|
|
1118
|
-
it "rejects any value in
|
1132
|
+
it "rejects any value in verifier data" do
|
1119
1133
|
DataMunger.new(
|
1120
1134
|
{
|
1121
|
-
:
|
1135
|
+
:verifier => {
|
1122
1136
|
:version => "chefy",
|
1123
1137
|
key => "imevil"
|
1124
1138
|
},
|
@@ -1130,11 +1144,98 @@ module Kitchen
|
|
1130
1144
|
]
|
1131
1145
|
},
|
1132
1146
|
{}
|
1133
|
-
).
|
1147
|
+
).verifier_data_for("sweet", "plat").must_equal(
|
1134
1148
|
:version => "chefy"
|
1135
1149
|
)
|
1136
1150
|
end
|
1137
1151
|
end
|
1152
|
+
|
1153
|
+
describe "for #transport_data_for" do
|
1154
|
+
|
1155
|
+
it "is returned when provided" do
|
1156
|
+
DataMunger.new(
|
1157
|
+
{
|
1158
|
+
:transport => "pipes",
|
1159
|
+
:platforms => [
|
1160
|
+
{ :name => "plat" }
|
1161
|
+
],
|
1162
|
+
:suites => [
|
1163
|
+
{ :name => "sweet" }
|
1164
|
+
]
|
1165
|
+
},
|
1166
|
+
{
|
1167
|
+
key => "datvalue"
|
1168
|
+
}
|
1169
|
+
).transport_data_for("sweet", "plat").must_equal(
|
1170
|
+
:name => "pipes",
|
1171
|
+
key => "datvalue"
|
1172
|
+
)
|
1173
|
+
end
|
1174
|
+
|
1175
|
+
it "is returned when provided in user data" do
|
1176
|
+
DataMunger.new(
|
1177
|
+
{
|
1178
|
+
:kitchen => {
|
1179
|
+
key => "datvalue"
|
1180
|
+
},
|
1181
|
+
:transport => "pipes",
|
1182
|
+
:platforms => [
|
1183
|
+
{ :name => "plat" }
|
1184
|
+
],
|
1185
|
+
:suites => [
|
1186
|
+
{ :name => "sweet" }
|
1187
|
+
]
|
1188
|
+
},
|
1189
|
+
{}
|
1190
|
+
).transport_data_for("sweet", "plat").must_equal(
|
1191
|
+
:name => "pipes",
|
1192
|
+
key => "datvalue"
|
1193
|
+
)
|
1194
|
+
end
|
1195
|
+
|
1196
|
+
it "user data value beats provided value" do
|
1197
|
+
DataMunger.new(
|
1198
|
+
{
|
1199
|
+
:kitchen => {
|
1200
|
+
key => "datvalue"
|
1201
|
+
},
|
1202
|
+
:transport => "pipes",
|
1203
|
+
:platforms => [
|
1204
|
+
{ :name => "plat" }
|
1205
|
+
],
|
1206
|
+
:suites => [
|
1207
|
+
{ :name => "sweet" }
|
1208
|
+
]
|
1209
|
+
},
|
1210
|
+
{
|
1211
|
+
key => "ilose"
|
1212
|
+
}
|
1213
|
+
).transport_data_for("sweet", "plat").must_equal(
|
1214
|
+
:name => "pipes",
|
1215
|
+
key => "datvalue"
|
1216
|
+
)
|
1217
|
+
end
|
1218
|
+
|
1219
|
+
it "rejects any value in transport data" do
|
1220
|
+
DataMunger.new(
|
1221
|
+
{
|
1222
|
+
:transport => {
|
1223
|
+
:name => "pipes",
|
1224
|
+
key => "imevil"
|
1225
|
+
},
|
1226
|
+
:platforms => [
|
1227
|
+
{ :name => "plat" }
|
1228
|
+
],
|
1229
|
+
:suites => [
|
1230
|
+
{ :name => "sweet" }
|
1231
|
+
]
|
1232
|
+
},
|
1233
|
+
{}
|
1234
|
+
).transport_data_for("sweet", "plat").must_equal(
|
1235
|
+
:name => "pipes"
|
1236
|
+
)
|
1237
|
+
end
|
1238
|
+
end
|
1138
1239
|
end
|
1139
1240
|
end
|
1140
1241
|
end
|
@@ -1616,5 +1717,667 @@ module Kitchen
|
|
1616
1717
|
end
|
1617
1718
|
end
|
1618
1719
|
end
|
1720
|
+
|
1721
|
+
describe "legacy http_proxy & https_proxy from driver" do
|
1722
|
+
|
1723
|
+
describe "from a single source" do
|
1724
|
+
|
1725
|
+
it "common driver value remains in driver" do
|
1726
|
+
DataMunger.new(
|
1727
|
+
{
|
1728
|
+
:provisioner => "chefy",
|
1729
|
+
:driver => {
|
1730
|
+
:name => "starship",
|
1731
|
+
:http_proxy => "http://proxy",
|
1732
|
+
:https_proxy => "https://proxy"
|
1733
|
+
}
|
1734
|
+
},
|
1735
|
+
{}
|
1736
|
+
).driver_data_for("suite", "platform").must_equal(
|
1737
|
+
:name => "starship",
|
1738
|
+
:http_proxy => "http://proxy",
|
1739
|
+
:https_proxy => "https://proxy"
|
1740
|
+
)
|
1741
|
+
end
|
1742
|
+
|
1743
|
+
it "common driver value copies into provisioner" do
|
1744
|
+
DataMunger.new(
|
1745
|
+
{
|
1746
|
+
:provisioner => "chefy",
|
1747
|
+
:driver => {
|
1748
|
+
:name => "starship",
|
1749
|
+
:http_proxy => "http://proxy",
|
1750
|
+
:https_proxy => "https://proxy"
|
1751
|
+
}
|
1752
|
+
},
|
1753
|
+
{}
|
1754
|
+
).provisioner_data_for("suite", "platform").must_equal(
|
1755
|
+
:name => "chefy",
|
1756
|
+
:http_proxy => "http://proxy",
|
1757
|
+
:https_proxy => "https://proxy"
|
1758
|
+
)
|
1759
|
+
end
|
1760
|
+
|
1761
|
+
it "common driver value copies into verifier" do
|
1762
|
+
DataMunger.new(
|
1763
|
+
{
|
1764
|
+
:verifier => "bussy",
|
1765
|
+
:driver => {
|
1766
|
+
:name => "starship",
|
1767
|
+
:http_proxy => "http://proxy",
|
1768
|
+
:https_proxy => "https://proxy"
|
1769
|
+
}
|
1770
|
+
},
|
1771
|
+
{}
|
1772
|
+
).verifier_data_for("suite", "platform").must_equal(
|
1773
|
+
:name => "bussy",
|
1774
|
+
:http_proxy => "http://proxy",
|
1775
|
+
:https_proxy => "https://proxy"
|
1776
|
+
)
|
1777
|
+
end
|
1778
|
+
|
1779
|
+
it "common driver value loses to existing provisioner value" do
|
1780
|
+
DataMunger.new(
|
1781
|
+
{
|
1782
|
+
:provisioner => {
|
1783
|
+
:name => "chefy",
|
1784
|
+
:http_proxy => "it's probably fine",
|
1785
|
+
:https_proxy => "la quinta"
|
1786
|
+
},
|
1787
|
+
:driver => {
|
1788
|
+
:name => "starship",
|
1789
|
+
:http_proxy => "dragons",
|
1790
|
+
:https_proxy => "cats"
|
1791
|
+
}
|
1792
|
+
},
|
1793
|
+
{}
|
1794
|
+
).provisioner_data_for("suite", "platform").must_equal(
|
1795
|
+
:name => "chefy",
|
1796
|
+
:http_proxy => "it's probably fine",
|
1797
|
+
:https_proxy => "la quinta"
|
1798
|
+
)
|
1799
|
+
end
|
1800
|
+
|
1801
|
+
it "common driver value loses to existing verifier value" do
|
1802
|
+
DataMunger.new(
|
1803
|
+
{
|
1804
|
+
:verifier => {
|
1805
|
+
:name => "bussy",
|
1806
|
+
:http_proxy => "it's probably fine",
|
1807
|
+
:https_proxy => "la quinta"
|
1808
|
+
},
|
1809
|
+
:driver => {
|
1810
|
+
:name => "starship",
|
1811
|
+
:http_proxy => "dragons",
|
1812
|
+
:https_proxy => "cats"
|
1813
|
+
}
|
1814
|
+
},
|
1815
|
+
{}
|
1816
|
+
).verifier_data_for("suite", "platform").must_equal(
|
1817
|
+
:name => "bussy",
|
1818
|
+
:http_proxy => "it's probably fine",
|
1819
|
+
:https_proxy => "la quinta"
|
1820
|
+
)
|
1821
|
+
end
|
1822
|
+
|
1823
|
+
it "suite driver value remains in driver" do
|
1824
|
+
DataMunger.new(
|
1825
|
+
{
|
1826
|
+
:suites => [
|
1827
|
+
{
|
1828
|
+
:name => "sweet",
|
1829
|
+
:provisioner => "chefy",
|
1830
|
+
:driver => {
|
1831
|
+
:name => "starship",
|
1832
|
+
:http_proxy => "it's probably fine",
|
1833
|
+
:https_proxy => "la quinta"
|
1834
|
+
}
|
1835
|
+
}
|
1836
|
+
]
|
1837
|
+
},
|
1838
|
+
{}
|
1839
|
+
).driver_data_for("sweet", "platform").must_equal(
|
1840
|
+
:name => "starship",
|
1841
|
+
:http_proxy => "it's probably fine",
|
1842
|
+
:https_proxy => "la quinta"
|
1843
|
+
)
|
1844
|
+
end
|
1845
|
+
|
1846
|
+
it "suite driver value copies into provisioner" do
|
1847
|
+
DataMunger.new(
|
1848
|
+
{
|
1849
|
+
:suites => [
|
1850
|
+
{
|
1851
|
+
:name => "sweet",
|
1852
|
+
:provisioner => "chefy",
|
1853
|
+
:driver => {
|
1854
|
+
:name => "starship",
|
1855
|
+
:http_proxy => "it's probably fine",
|
1856
|
+
:https_proxy => "la quinta"
|
1857
|
+
}
|
1858
|
+
}
|
1859
|
+
]
|
1860
|
+
},
|
1861
|
+
{}
|
1862
|
+
).provisioner_data_for("sweet", "platform").must_equal(
|
1863
|
+
:name => "chefy",
|
1864
|
+
:http_proxy => "it's probably fine",
|
1865
|
+
:https_proxy => "la quinta"
|
1866
|
+
)
|
1867
|
+
end
|
1868
|
+
|
1869
|
+
it "suite driver value copies into verifier" do
|
1870
|
+
DataMunger.new(
|
1871
|
+
{
|
1872
|
+
:suites => [
|
1873
|
+
{
|
1874
|
+
:name => "sweet",
|
1875
|
+
:verifier => "bussy",
|
1876
|
+
:driver => {
|
1877
|
+
:name => "starship",
|
1878
|
+
:http_proxy => "it's probably fine",
|
1879
|
+
:https_proxy => "la quinta"
|
1880
|
+
}
|
1881
|
+
}
|
1882
|
+
]
|
1883
|
+
},
|
1884
|
+
{}
|
1885
|
+
).verifier_data_for("sweet", "platform").must_equal(
|
1886
|
+
:name => "bussy",
|
1887
|
+
:http_proxy => "it's probably fine",
|
1888
|
+
:https_proxy => "la quinta"
|
1889
|
+
)
|
1890
|
+
end
|
1891
|
+
|
1892
|
+
it "suite driver value loses to existing provisioner value" do
|
1893
|
+
DataMunger.new(
|
1894
|
+
{
|
1895
|
+
:suites => [
|
1896
|
+
{
|
1897
|
+
:name => "sweet",
|
1898
|
+
:provisioner => {
|
1899
|
+
:name => "chefy",
|
1900
|
+
:http_proxy => "it's probably fine",
|
1901
|
+
:https_proxy => "la quinta"
|
1902
|
+
},
|
1903
|
+
:driver => {
|
1904
|
+
:name => "starship",
|
1905
|
+
:http_proxy => "dragons",
|
1906
|
+
:https_proxy => "cats"
|
1907
|
+
}
|
1908
|
+
}
|
1909
|
+
]
|
1910
|
+
},
|
1911
|
+
{}
|
1912
|
+
).provisioner_data_for("sweet", "platform").must_equal(
|
1913
|
+
:name => "chefy",
|
1914
|
+
:http_proxy => "it's probably fine",
|
1915
|
+
:https_proxy => "la quinta"
|
1916
|
+
)
|
1917
|
+
end
|
1918
|
+
|
1919
|
+
it "suite driver value loses to existing verifier value" do
|
1920
|
+
DataMunger.new(
|
1921
|
+
{
|
1922
|
+
:suites => [
|
1923
|
+
{
|
1924
|
+
:name => "sweet",
|
1925
|
+
:verifier => {
|
1926
|
+
:name => "bussy",
|
1927
|
+
:http_proxy => "it's probably fine",
|
1928
|
+
:https_proxy => "la quinta"
|
1929
|
+
},
|
1930
|
+
:driver => {
|
1931
|
+
:name => "starship",
|
1932
|
+
:http_proxy => "dragons",
|
1933
|
+
:https_proxy => "cats"
|
1934
|
+
}
|
1935
|
+
}
|
1936
|
+
]
|
1937
|
+
},
|
1938
|
+
{}
|
1939
|
+
).verifier_data_for("sweet", "platform").must_equal(
|
1940
|
+
:name => "bussy",
|
1941
|
+
:http_proxy => "it's probably fine",
|
1942
|
+
:https_proxy => "la quinta"
|
1943
|
+
)
|
1944
|
+
end
|
1945
|
+
|
1946
|
+
it "platform driver value remains in driver" do
|
1947
|
+
DataMunger.new(
|
1948
|
+
{
|
1949
|
+
:platforms => [
|
1950
|
+
{
|
1951
|
+
:name => "plat",
|
1952
|
+
:provisioner => "chefy",
|
1953
|
+
:driver => {
|
1954
|
+
:name => "starship",
|
1955
|
+
:http_proxy => "it's probably fine",
|
1956
|
+
:https_proxy => "la quinta"
|
1957
|
+
}
|
1958
|
+
}
|
1959
|
+
]
|
1960
|
+
},
|
1961
|
+
{}
|
1962
|
+
).driver_data_for("suite", "plat").must_equal(
|
1963
|
+
:name => "starship",
|
1964
|
+
:http_proxy => "it's probably fine",
|
1965
|
+
:https_proxy => "la quinta"
|
1966
|
+
)
|
1967
|
+
end
|
1968
|
+
|
1969
|
+
it "platform driver value copies into provisioner" do
|
1970
|
+
DataMunger.new(
|
1971
|
+
{
|
1972
|
+
:platforms => [
|
1973
|
+
{
|
1974
|
+
:name => "plat",
|
1975
|
+
:provisioner => "chefy",
|
1976
|
+
:driver => {
|
1977
|
+
:name => "starship",
|
1978
|
+
:http_proxy => "it's probably fine",
|
1979
|
+
:https_proxy => "la quinta"
|
1980
|
+
}
|
1981
|
+
}
|
1982
|
+
]
|
1983
|
+
},
|
1984
|
+
{}
|
1985
|
+
).provisioner_data_for("suite", "plat").must_equal(
|
1986
|
+
:name => "chefy",
|
1987
|
+
:http_proxy => "it's probably fine",
|
1988
|
+
:https_proxy => "la quinta"
|
1989
|
+
)
|
1990
|
+
end
|
1991
|
+
|
1992
|
+
it "platform driver value copies into verifier" do
|
1993
|
+
DataMunger.new(
|
1994
|
+
{
|
1995
|
+
:platforms => [
|
1996
|
+
{
|
1997
|
+
:name => "plat",
|
1998
|
+
:verifier => "bussy",
|
1999
|
+
:driver => {
|
2000
|
+
:name => "starship",
|
2001
|
+
:http_proxy => "it's probably fine",
|
2002
|
+
:https_proxy => "la quinta"
|
2003
|
+
}
|
2004
|
+
}
|
2005
|
+
]
|
2006
|
+
},
|
2007
|
+
{}
|
2008
|
+
).verifier_data_for("suite", "plat").must_equal(
|
2009
|
+
:name => "bussy",
|
2010
|
+
:http_proxy => "it's probably fine",
|
2011
|
+
:https_proxy => "la quinta"
|
2012
|
+
)
|
2013
|
+
end
|
2014
|
+
|
2015
|
+
it "platform driver value loses to existing provisioner value" do
|
2016
|
+
DataMunger.new(
|
2017
|
+
{
|
2018
|
+
:platforms => [
|
2019
|
+
{
|
2020
|
+
:name => "plat",
|
2021
|
+
:provisioner => {
|
2022
|
+
:name => "chefy",
|
2023
|
+
:http_proxy => "it's probably fine",
|
2024
|
+
:https_proxy => "la quinta"
|
2025
|
+
},
|
2026
|
+
:driver => {
|
2027
|
+
:name => "starship",
|
2028
|
+
:http_proxy => "dragons",
|
2029
|
+
:https_proxy => "cats"
|
2030
|
+
}
|
2031
|
+
}
|
2032
|
+
]
|
2033
|
+
},
|
2034
|
+
{}
|
2035
|
+
).provisioner_data_for("suite", "plat").must_equal(
|
2036
|
+
:name => "chefy",
|
2037
|
+
:http_proxy => "it's probably fine",
|
2038
|
+
:https_proxy => "la quinta"
|
2039
|
+
)
|
2040
|
+
end
|
2041
|
+
|
2042
|
+
it "platform driver value loses to existing verifier value" do
|
2043
|
+
DataMunger.new(
|
2044
|
+
{
|
2045
|
+
:platforms => [
|
2046
|
+
{
|
2047
|
+
:name => "plat",
|
2048
|
+
:verifier => {
|
2049
|
+
:name => "bussy",
|
2050
|
+
:http_proxy => "it's probably fine",
|
2051
|
+
:https_proxy => "la quinta"
|
2052
|
+
},
|
2053
|
+
:driver => {
|
2054
|
+
:name => "starship",
|
2055
|
+
:http_proxy => "dragons",
|
2056
|
+
:https_proxy => "cats"
|
2057
|
+
}
|
2058
|
+
}
|
2059
|
+
]
|
2060
|
+
},
|
2061
|
+
{}
|
2062
|
+
).verifier_data_for("suite", "plat").must_equal(
|
2063
|
+
:name => "bussy",
|
2064
|
+
:http_proxy => "it's probably fine",
|
2065
|
+
:https_proxy => "la quinta"
|
2066
|
+
)
|
2067
|
+
end
|
2068
|
+
end
|
2069
|
+
end
|
2070
|
+
|
2071
|
+
describe "legacy busser blocks to verifier" do
|
2072
|
+
|
2073
|
+
describe "from a single source" do
|
2074
|
+
|
2075
|
+
it "merges old common busser name to version into verifier" do
|
2076
|
+
DataMunger.new(
|
2077
|
+
{
|
2078
|
+
:busser => "starship"
|
2079
|
+
},
|
2080
|
+
{}
|
2081
|
+
).verifier_data_for("suite", "platform").must_equal(
|
2082
|
+
:name => "busser",
|
2083
|
+
:version => "starship"
|
2084
|
+
)
|
2085
|
+
end
|
2086
|
+
|
2087
|
+
it "merges old common busser name to version with exising verifier" do
|
2088
|
+
DataMunger.new(
|
2089
|
+
{
|
2090
|
+
:busser => "starship",
|
2091
|
+
:verifier => {
|
2092
|
+
:a => "b"
|
2093
|
+
}
|
2094
|
+
},
|
2095
|
+
{}
|
2096
|
+
).verifier_data_for("suite", "platform").must_equal(
|
2097
|
+
:name => "busser",
|
2098
|
+
:version => "starship",
|
2099
|
+
:a => "b"
|
2100
|
+
)
|
2101
|
+
end
|
2102
|
+
|
2103
|
+
it "merges old common busser name to version into verifier with name" do
|
2104
|
+
DataMunger.new(
|
2105
|
+
{
|
2106
|
+
:busser => "starship",
|
2107
|
+
:verifier => "stellar"
|
2108
|
+
},
|
2109
|
+
{}
|
2110
|
+
).verifier_data_for("suite", "platform").must_equal(
|
2111
|
+
:name => "stellar",
|
2112
|
+
:version => "starship"
|
2113
|
+
)
|
2114
|
+
end
|
2115
|
+
|
2116
|
+
it "merges old busser data into verifier with name" do
|
2117
|
+
DataMunger.new(
|
2118
|
+
{
|
2119
|
+
:busser => {
|
2120
|
+
:a => "b"
|
2121
|
+
},
|
2122
|
+
:verifier => "stellar"
|
2123
|
+
},
|
2124
|
+
{}
|
2125
|
+
).verifier_data_for("suite", "platform").must_equal(
|
2126
|
+
:name => "stellar",
|
2127
|
+
:a => "b"
|
2128
|
+
)
|
2129
|
+
end
|
2130
|
+
|
2131
|
+
it "merges old busser data into verifier data" do
|
2132
|
+
DataMunger.new(
|
2133
|
+
{
|
2134
|
+
:busser => {
|
2135
|
+
:a => "b",
|
2136
|
+
:both => "legacy"
|
2137
|
+
},
|
2138
|
+
:verifier => {
|
2139
|
+
:name => "stellar",
|
2140
|
+
:c => "d",
|
2141
|
+
:both => "modern"
|
2142
|
+
}
|
2143
|
+
},
|
2144
|
+
{}
|
2145
|
+
).verifier_data_for("suite", "platform").must_equal(
|
2146
|
+
:name => "stellar",
|
2147
|
+
:a => "b",
|
2148
|
+
:c => "d",
|
2149
|
+
:both => "modern"
|
2150
|
+
)
|
2151
|
+
end
|
2152
|
+
|
2153
|
+
it "returns platform verifier name" do
|
2154
|
+
DataMunger.new(
|
2155
|
+
{
|
2156
|
+
:platforms => [
|
2157
|
+
{
|
2158
|
+
:name => "plat",
|
2159
|
+
:busser => "flip"
|
2160
|
+
}
|
2161
|
+
]
|
2162
|
+
},
|
2163
|
+
{}
|
2164
|
+
).verifier_data_for("suite", "plat").must_equal(
|
2165
|
+
:name => "busser",
|
2166
|
+
:version => "flip"
|
2167
|
+
)
|
2168
|
+
end
|
2169
|
+
|
2170
|
+
it "return platform config containing verifier hash" do
|
2171
|
+
DataMunger.new(
|
2172
|
+
{
|
2173
|
+
:platforms => [
|
2174
|
+
{
|
2175
|
+
:name => "plat",
|
2176
|
+
:busser => "flip",
|
2177
|
+
:verifier => {
|
2178
|
+
:flop => "yep"
|
2179
|
+
}
|
2180
|
+
}
|
2181
|
+
]
|
2182
|
+
},
|
2183
|
+
{}
|
2184
|
+
).verifier_data_for("suite", "plat").must_equal(
|
2185
|
+
:name => "busser",
|
2186
|
+
:version => "flip",
|
2187
|
+
:flop => "yep"
|
2188
|
+
)
|
2189
|
+
end
|
2190
|
+
|
2191
|
+
it "returns suite driver name" do
|
2192
|
+
DataMunger.new(
|
2193
|
+
{
|
2194
|
+
:suites => [
|
2195
|
+
{
|
2196
|
+
:name => "sweet",
|
2197
|
+
:busser => "waz"
|
2198
|
+
}
|
2199
|
+
]
|
2200
|
+
},
|
2201
|
+
{}
|
2202
|
+
).verifier_data_for("sweet", "platform").must_equal(
|
2203
|
+
:name => "busser",
|
2204
|
+
:version => "waz"
|
2205
|
+
)
|
2206
|
+
end
|
2207
|
+
|
2208
|
+
it "returns suite config containing verifier hash" do
|
2209
|
+
DataMunger.new(
|
2210
|
+
{
|
2211
|
+
:suites => [
|
2212
|
+
{
|
2213
|
+
:name => "sweet",
|
2214
|
+
:busser => "waz",
|
2215
|
+
:verifier => {
|
2216
|
+
:up => "nope"
|
2217
|
+
}
|
2218
|
+
}
|
2219
|
+
]
|
2220
|
+
},
|
2221
|
+
{}
|
2222
|
+
).verifier_data_for("sweet", "platform").must_equal(
|
2223
|
+
:name => "busser",
|
2224
|
+
:version => "waz",
|
2225
|
+
:up => "nope"
|
2226
|
+
)
|
2227
|
+
end
|
2228
|
+
end
|
2229
|
+
|
2230
|
+
describe "from multiple sources" do
|
2231
|
+
|
2232
|
+
it "suite into platform into common" do
|
2233
|
+
DataMunger.new(
|
2234
|
+
{
|
2235
|
+
:busser => {
|
2236
|
+
:version => "commony",
|
2237
|
+
:color => "purple",
|
2238
|
+
:fruit => %w[apple pear],
|
2239
|
+
:deep => { :common => "junk" }
|
2240
|
+
},
|
2241
|
+
:platforms => [
|
2242
|
+
{
|
2243
|
+
:name => "plat",
|
2244
|
+
:busser => {
|
2245
|
+
:version => "platformy",
|
2246
|
+
:fruit => ["banana"],
|
2247
|
+
:deep => { :platform => "stuff" }
|
2248
|
+
}
|
2249
|
+
}
|
2250
|
+
],
|
2251
|
+
:suites => [
|
2252
|
+
{
|
2253
|
+
:name => "sweet",
|
2254
|
+
:busser => {
|
2255
|
+
:version => "suitey",
|
2256
|
+
:vehicle => "car",
|
2257
|
+
:deep => { :suite => "things" }
|
2258
|
+
}
|
2259
|
+
}
|
2260
|
+
]
|
2261
|
+
},
|
2262
|
+
{}
|
2263
|
+
).verifier_data_for("sweet", "plat").must_equal(
|
2264
|
+
:name => "busser",
|
2265
|
+
:version => "suitey",
|
2266
|
+
:color => "purple",
|
2267
|
+
:fruit => ["banana"],
|
2268
|
+
:vehicle => "car",
|
2269
|
+
:deep => {
|
2270
|
+
:common => "junk",
|
2271
|
+
:platform => "stuff",
|
2272
|
+
:suite => "things"
|
2273
|
+
}
|
2274
|
+
)
|
2275
|
+
end
|
2276
|
+
|
2277
|
+
it "platform into common" do
|
2278
|
+
DataMunger.new(
|
2279
|
+
{
|
2280
|
+
:busser => {
|
2281
|
+
:version => "commony",
|
2282
|
+
:color => "purple",
|
2283
|
+
:fruit => %w[apple pear],
|
2284
|
+
:deep => { :common => "junk" }
|
2285
|
+
},
|
2286
|
+
:platforms => [
|
2287
|
+
{
|
2288
|
+
:name => "plat",
|
2289
|
+
:busser => {
|
2290
|
+
:version => "platformy",
|
2291
|
+
:fruit => ["banana"],
|
2292
|
+
:deep => { :platform => "stuff" }
|
2293
|
+
}
|
2294
|
+
}
|
2295
|
+
]
|
2296
|
+
},
|
2297
|
+
{}
|
2298
|
+
).verifier_data_for("sweet", "plat").must_equal(
|
2299
|
+
:name => "busser",
|
2300
|
+
:version => "platformy",
|
2301
|
+
:color => "purple",
|
2302
|
+
:fruit => ["banana"],
|
2303
|
+
:deep => {
|
2304
|
+
:common => "junk",
|
2305
|
+
:platform => "stuff"
|
2306
|
+
}
|
2307
|
+
)
|
2308
|
+
end
|
2309
|
+
|
2310
|
+
it "suite into common" do
|
2311
|
+
DataMunger.new(
|
2312
|
+
{
|
2313
|
+
:busser => {
|
2314
|
+
:version => "commony",
|
2315
|
+
:color => "purple",
|
2316
|
+
:fruit => %w[apple pear],
|
2317
|
+
:deep => { :common => "junk" }
|
2318
|
+
},
|
2319
|
+
:suites => [
|
2320
|
+
{
|
2321
|
+
:name => "sweet",
|
2322
|
+
:busser => {
|
2323
|
+
:version => "suitey",
|
2324
|
+
:vehicle => "car",
|
2325
|
+
:deep => { :suite => "things" }
|
2326
|
+
}
|
2327
|
+
}
|
2328
|
+
]
|
2329
|
+
},
|
2330
|
+
{}
|
2331
|
+
).verifier_data_for("sweet", "plat").must_equal(
|
2332
|
+
:name => "busser",
|
2333
|
+
:version => "suitey",
|
2334
|
+
:color => "purple",
|
2335
|
+
:fruit => %w[apple pear],
|
2336
|
+
:vehicle => "car",
|
2337
|
+
:deep => {
|
2338
|
+
:common => "junk",
|
2339
|
+
:suite => "things"
|
2340
|
+
}
|
2341
|
+
)
|
2342
|
+
end
|
2343
|
+
|
2344
|
+
it "suite into platform" do
|
2345
|
+
DataMunger.new(
|
2346
|
+
{
|
2347
|
+
:platforms => [
|
2348
|
+
{
|
2349
|
+
:name => "plat",
|
2350
|
+
:busser => {
|
2351
|
+
:version => "platformy",
|
2352
|
+
:fruit => ["banana"],
|
2353
|
+
:deep => { :platform => "stuff" }
|
2354
|
+
}
|
2355
|
+
}
|
2356
|
+
],
|
2357
|
+
:suites => [
|
2358
|
+
{
|
2359
|
+
:name => "sweet",
|
2360
|
+
:busser => {
|
2361
|
+
:version => "suitey",
|
2362
|
+
:vehicle => "car",
|
2363
|
+
:deep => { :suite => "things" }
|
2364
|
+
}
|
2365
|
+
}
|
2366
|
+
]
|
2367
|
+
},
|
2368
|
+
{}
|
2369
|
+
).verifier_data_for("sweet", "plat").must_equal(
|
2370
|
+
:name => "busser",
|
2371
|
+
:version => "suitey",
|
2372
|
+
:fruit => ["banana"],
|
2373
|
+
:vehicle => "car",
|
2374
|
+
:deep => {
|
2375
|
+
:platform => "stuff",
|
2376
|
+
:suite => "things"
|
2377
|
+
}
|
2378
|
+
)
|
2379
|
+
end
|
2380
|
+
end
|
2381
|
+
end
|
1619
2382
|
end
|
1620
2383
|
end
|