20
20
desc 'The acceptance tests for r10k, run in the beaker framework'
21
21
rototiller_task :beaker => [ :beaker_hostgenerator ] do |t |
22
22
23
- common_setup = <<-EOS
24
- pre-suite/00_pe_install.rb,
25
- component/pre-suite/05_install_dev_r10k.rb,
26
- pre-suite/10_git_config.rb,
27
- pre-suite/20_pe_r10k.rb,
28
- EOS
29
- common_setup . gsub! ( "\n " , '' )
30
-
31
- flags = [
32
- { :name => '--hosts' , :default => 'configs/generated' , :override_env => 'BEAKER_HOST' } ,
33
- { :name => '--keyfile' , :default => "#{ ENV [ 'HOME' ] } /.ssh/id_rsa-acceptance" , :override_env => 'BEAKER_KEYFILE' } ,
34
- { :name => '--load-path' , :default => 'lib' } ,
35
- { :name => '--pre-suite' , :default => @acceptance_pre_suite || common_setup , :override_env => 'BEAKER_PRE_SUITE' } ,
36
- { :name => '--tests' , :default => 'tests' , :override_env => 'BEAKER_TESTS' } ,
37
- { :name => '--preserve-hosts' , :default => 'onfail' , :override_env => 'BEAKER_PRESERVE_HOSTS' } ,
38
- ]
39
- t . add_flag ( *flags )
40
-
41
23
t . add_env do |env |
42
24
env . name = 'PE_FAMILY'
43
25
env . message = 'The puppet enterprise major branch to install from'
54
36
env . message = 'The git provider that r10k should use on a SUT'
55
37
end
56
38
57
- t . add_command ( { :name => 'beaker --debug' , :override_env => 'BEAKER_EXECUTABLE' } )
39
+ t . add_command do |cmd |
40
+ cmd . name = 'beaker --debug'
41
+
42
+ common_setup = <<-EOS
43
+ pre-suite/00_pe_install.rb,
44
+ component/pre-suite/05_install_dev_r10k.rb,
45
+ pre-suite/10_git_config.rb,
46
+ pre-suite/20_pe_r10k.rb,
47
+ EOS
48
+ common_setup . gsub! ( "\n " , '' )
49
+
50
+ cmd . add_option do |opt |
51
+ opt . name = '--hosts'
52
+ opt . add_argument do |arg |
53
+ arg . name = 'configs/generated'
54
+ arg . add_env ( { name : 'BEAKER_HOST' } )
55
+ end
56
+ end
57
+
58
+ cmd . add_option do |opt |
59
+ opt . name = '--keyfile'
60
+ opt . add_argument do |arg |
61
+ arg . name = "#{ ENV [ 'HOME' ] } /.ssh/id_rsa-acceptance"
62
+ arg . add_env ( { name : 'BEAKER_KEYFILE' } )
63
+ end
64
+ end
65
+
66
+ cmd . add_option do |opt |
67
+ opt . name = '--pre-suite'
68
+ opt . add_argument do |arg |
69
+ arg . name = @acceptance_pre_suite || common_setup
70
+ arg . add_env ( { name : 'BEAKER_PRE_SUITE' } )
71
+ end
72
+ end
73
+
74
+ cmd . add_option do |opt |
75
+ opt . name = '--tests'
76
+ opt . add_argument do |arg |
77
+ arg . name = 'tests'
78
+ arg . add_env ( { name : 'BEAKER_TESTS' } )
79
+ end
80
+ end
81
+
82
+ cmd . add_option do |opt |
83
+ opt . name = '--preserve-hosts'
84
+ opt . add_argument do |arg |
85
+ arg . name = 'onfail'
86
+ arg . add_env ( { name : 'BEAKER_PRESERVE_HOSTS' } )
87
+ end
88
+ end
89
+
90
+ cmd . add_option do |opt |
91
+ opt . name = '--load-path'
92
+ opt . add_argument ( { name : 'lib' } )
93
+ end
94
+ end
58
95
end
59
96
60
97
desc 'Generate a host configuration used by Beaker'
@@ -64,12 +101,10 @@ rototiller_task :beaker_hostgenerator do |t|
64
101
t . add_command do |c |
65
102
c . name = 'beaker-hostgenerator'
66
103
c . argument = '> configs/generated'
104
+ c . add_option ( :name => '' , :default => 'centos7-64mdca-64.fa' , :override_env => 'TEST_TARGET' )
105
+ c . add_option ( :name => '--global-config' , :default => '{forge_host=forgeapi.puppet.com}' , :override_env => 'BHG_GLOBAL_CONFIG' )
67
106
end
68
107
69
- # This is a hack :(
70
- t . add_flag ( :name => '' , :default => 'centos7-64mdca-64.fa' , :override_env => 'TEST_TARGET' )
71
-
72
- t . add_flag ( :name => '--global-config' , :default => '{forge_host=forgeapi.puppet.com}' , :override_env => 'BHG_GLOBAL_CONFIG' )
73
108
end
74
109
end
75
110
0 commit comments