tengine_support 0.3.27 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -20
- data/lib/tengine/support/core_ext/enumerable/map_to_hash.rb +20 -0
- data/lib/tengine/support/mongoid.rb +59 -0
- data/lib/tengine/support/null_logger.rb +1 -1
- data/lib/tengine/support.rb +4 -3
- metadata +80 -76
- data/.document +0 -5
- data/.rspec +0 -1
- data/.travis.yml +0 -11
- data/NULL +0 -1
- data/Rakefile +0 -43
- data/VERSION +0 -1
- data/gemfiles/Gemfile.activesupport-3.0.10 +0 -24
- data/gemfiles/Gemfile.activesupport-3.1.1 +0 -24
- data/gemfiles/Gemfile.activesupport-3.2.3 +0 -24
- data/spec/spec_helper.rb +0 -15
- data/spec/support/app1.rb +0 -27
- data/spec/support/suite.rb +0 -182
- data/spec/tengine/support/config/amqp_spec.rb +0 -32
- data/spec/tengine/support/config/logger_spec.rb +0 -316
- data/spec/tengine/support/config/mongoid_spec.rb +0 -24
- data/spec/tengine/support/config_spec/dump_skelton_spec.rb +0 -171
- data/spec/tengine/support/config_spec/load_config_file_by_config_option_spec.rb +0 -94
- data/spec/tengine/support/config_spec/load_spec.rb +0 -239
- data/spec/tengine/support/config_spec/load_spec_01.yml.erb +0 -43
- data/spec/tengine/support/config_spec/load_spec_01_with_other_settings.yml.erb +0 -48
- data/spec/tengine/support/config_spec/load_spec_02.yml.erb +0 -52
- data/spec/tengine/support/config_spec/parse_spec.rb +0 -178
- data/spec/tengine/support/config_spec.rb +0 -217
- data/spec/tengine/support/core_ext/array/deep_dup_spec.rb +0 -69
- data/spec/tengine/support/core_ext/enumerable/deep_freeze_spec.rb +0 -16
- data/spec/tengine/support/core_ext/enumerable/each_next_tick_spec.rb +0 -29
- data/spec/tengine/support/core_ext/hash/compact_spec.rb +0 -28
- data/spec/tengine/support/core_ext/hash/deep_dup_spec.rb +0 -66
- data/spec/tengine/support/core_ext/hash/keys_spec.rb +0 -88
- data/spec/tengine/support/mongoid_spec.rb +0 -36
- data/spec/tengine/support/null_logger_spec.rb +0 -13
- data/spec/tengine/support/yaml_with_erb_spec/test1.yml.erb +0 -2
- data/spec/tengine/support/yaml_with_erb_spec/test2_with_erb.yml +0 -2
- data/spec/tengine/support/yaml_with_erb_spec/test3_without_erb.yml +0 -2
- data/spec/tengine/support/yaml_with_erb_spec/test4_with_invalid_erb.yml +0 -2
- data/spec/tengine/support/yaml_with_erb_spec.rb +0 -76
- data/tengine_support.gemspec +0 -125
@@ -1,171 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
|
3
|
-
|
4
|
-
require 'tengine/support/yaml_with_erb'
|
5
|
-
|
6
|
-
describe "dump_skelton" do
|
7
|
-
context :suite1 do
|
8
|
-
suite1_skelton = {
|
9
|
-
:action => 'start',
|
10
|
-
:config => nil,
|
11
|
-
:process => {
|
12
|
-
:daemon => nil,
|
13
|
-
:pid_dir => nil,
|
14
|
-
},
|
15
|
-
:db => {
|
16
|
-
:host => 'localhost',
|
17
|
-
:port => 27017,
|
18
|
-
:username => nil,
|
19
|
-
:password => nil,
|
20
|
-
:database => 'tengine_production'
|
21
|
-
},
|
22
|
-
:event_queue => {
|
23
|
-
:connection => {
|
24
|
-
:host => 'localhost',
|
25
|
-
:port => 5672,
|
26
|
-
:vhost => nil,
|
27
|
-
:user => nil,
|
28
|
-
:pass => nil,
|
29
|
-
:heartbeat_interval => 0,
|
30
|
-
},
|
31
|
-
:exchange => {
|
32
|
-
:name => 'tengine_event_exchange',
|
33
|
-
:type => 'direct',
|
34
|
-
:durable => true,
|
35
|
-
},
|
36
|
-
:queue => {
|
37
|
-
:name => 'tengine_event_queue',
|
38
|
-
:durable => true,
|
39
|
-
},
|
40
|
-
},
|
41
|
-
|
42
|
-
:log_common => {
|
43
|
-
:output => "STDOUT" ,
|
44
|
-
:rotation => 3 ,
|
45
|
-
:rotation_size => 1024 * 1024,
|
46
|
-
:level => 'info' ,
|
47
|
-
:progname => nil, :datetime_format => nil,
|
48
|
-
}.freeze,
|
49
|
-
|
50
|
-
:application_log => {
|
51
|
-
:output => "STDOUT",
|
52
|
-
:rotation=>3, :rotation_size=>1048576, :level=>"info",
|
53
|
-
:progname => nil, :datetime_format => nil,
|
54
|
-
}.freeze,
|
55
|
-
|
56
|
-
:process_stdout_log => {
|
57
|
-
:output => "STDOUT",
|
58
|
-
:rotation=>3, :rotation_size=>1048576, :level=>"info",
|
59
|
-
:progname => nil, :datetime_format => nil,
|
60
|
-
}.freeze,
|
61
|
-
|
62
|
-
:process_stderr_log => {
|
63
|
-
:output => "STDOUT",
|
64
|
-
:rotation=>3, :rotation_size=>1048576, :level=>"info",
|
65
|
-
:progname => nil, :datetime_format => nil,
|
66
|
-
}.freeze,
|
67
|
-
}
|
68
|
-
|
69
|
-
it do
|
70
|
-
@suite = build_suite1
|
71
|
-
STDOUT.should_receive(:puts).with(YAML.dump(suite1_skelton))
|
72
|
-
expect{
|
73
|
-
@suite.parse!(%w[--dump-skelton])
|
74
|
-
}.to raise_error(SystemExit)
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
|
79
|
-
suite2_skelton = {
|
80
|
-
:action => 'start',
|
81
|
-
:config => nil,
|
82
|
-
:process => {
|
83
|
-
:daemon => nil,
|
84
|
-
:pid_dir => nil,
|
85
|
-
},
|
86
|
-
:db => {
|
87
|
-
:host => 'localhost',
|
88
|
-
:port => 27017,
|
89
|
-
:username => nil,
|
90
|
-
:password => nil,
|
91
|
-
:database => 'tengine_production',
|
92
|
-
},
|
93
|
-
:event_queue => {
|
94
|
-
:connection => {
|
95
|
-
:host => 'localhost',
|
96
|
-
:port => 5672,
|
97
|
-
:vhost => nil,
|
98
|
-
:user => nil,
|
99
|
-
:pass => nil,
|
100
|
-
:heartbeat_interval => 0,
|
101
|
-
},
|
102
|
-
:exchange => {
|
103
|
-
:name => 'tengine_event_exchange',
|
104
|
-
:type => 'direct',
|
105
|
-
:durable => true,
|
106
|
-
},
|
107
|
-
:queue => {
|
108
|
-
:name => 'tengine_event_queue',
|
109
|
-
:durable => true,
|
110
|
-
},
|
111
|
-
},
|
112
|
-
|
113
|
-
:log_common => {
|
114
|
-
:output => "STDOUT" ,
|
115
|
-
:rotation => 3 ,
|
116
|
-
:rotation_size => 1024 * 1024,
|
117
|
-
:level => 'info' ,
|
118
|
-
:progname => nil, :datetime_format => nil,
|
119
|
-
}.freeze,
|
120
|
-
|
121
|
-
:application_log => {
|
122
|
-
:output => "STDOUT",
|
123
|
-
:rotation=>3, :rotation_size=>1048576, :level=>"info",
|
124
|
-
:progname => nil, :datetime_format => nil,
|
125
|
-
}.freeze,
|
126
|
-
|
127
|
-
:process_stdout_log => {
|
128
|
-
:output => "STDOUT",
|
129
|
-
:rotation=>3, :rotation_size=>1048576, :level=>"info",
|
130
|
-
:progname => nil, :datetime_format => nil,
|
131
|
-
}.freeze,
|
132
|
-
|
133
|
-
:process_stderr_log => {
|
134
|
-
:output => "STDOUT",
|
135
|
-
:rotation=>3, :rotation_size=>1048576, :level=>"info",
|
136
|
-
:progname => nil, :datetime_format => nil,
|
137
|
-
}.freeze,
|
138
|
-
}
|
139
|
-
|
140
|
-
|
141
|
-
context :suite2 do
|
142
|
-
subject{ build_suite2 }
|
143
|
-
it do
|
144
|
-
STDOUT.should_receive(:puts).with(YAML.dump(suite2_skelton))
|
145
|
-
expect{
|
146
|
-
subject.parse!(%w[--dump-skelton])
|
147
|
-
}.to raise_error(SystemExit)
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
context :suite3 do
|
152
|
-
subject{ build_suite3 }
|
153
|
-
it do
|
154
|
-
STDOUT.should_receive(:puts).with(YAML.dump(suite2_skelton))
|
155
|
-
expect{
|
156
|
-
subject.parse!(%w[--dump-skelton])
|
157
|
-
}.to raise_error(SystemExit)
|
158
|
-
end
|
159
|
-
it do
|
160
|
-
subject.db.should == {
|
161
|
-
:host => 'localhost',
|
162
|
-
:port => 27017,
|
163
|
-
:username => nil,
|
164
|
-
:password => nil,
|
165
|
-
:database => 'tengine_production',
|
166
|
-
}
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
170
|
-
end
|
171
|
-
|
@@ -1,94 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
|
3
|
-
|
4
|
-
describe "config" do
|
5
|
-
describe :parse! do
|
6
|
-
before(:all) do
|
7
|
-
@config_filepath = File.expand_path('load_spec_01.yml.erb', File.dirname(__FILE__))
|
8
|
-
end
|
9
|
-
|
10
|
-
context "setting1" do
|
11
|
-
shared_examples_for "load_config_file_by_config_option_common" do
|
12
|
-
it { subject.process.should be_a(App1::ProcessConfig) }
|
13
|
-
it { subject.process.daemon.should == true}
|
14
|
-
it { subject.process.pid_dir.should == "./tmp/pids"}
|
15
|
-
it { subject.db.should be_a(Tengine::Support::Config::Mongoid::Connection) }
|
16
|
-
it { subject.db.host.should == "localhost"}
|
17
|
-
it { subject.db.port.should == 27020}
|
18
|
-
it { subject.db.username.should == nil}
|
19
|
-
it { subject.db.password.should == nil}
|
20
|
-
it { subject.db.database.should == "tengine_production"}
|
21
|
-
it { subject.event_queue.connection.host.should == "rabbitmq1"}
|
22
|
-
it { subject.event_queue.connection.port.should == 5672}
|
23
|
-
it { subject.event_queue.exchange.name.should == "tengine_event_exchange"}
|
24
|
-
it { subject.event_queue.exchange.type.should == 'direct'}
|
25
|
-
it { subject.event_queue.exchange.durable.should == true}
|
26
|
-
it { subject.event_queue.queue.name.should == "tengine_event_queue"}
|
27
|
-
it { subject.event_queue.queue.durable.should == true}
|
28
|
-
it { subject.log_common.output.should == "STDOUT"}
|
29
|
-
it { subject.log_common.rotation.should == 5}
|
30
|
-
it { subject.log_common.rotation_size.should == 1024 * 1024 * 1024}
|
31
|
-
it { subject.application_log.output.should == "log/application.log"}
|
32
|
-
it { subject.application_log.rotation.should == 'daily'}
|
33
|
-
it { subject.application_log.rotation_size.should == 1024 * 1024 * 1024}
|
34
|
-
it { subject.application_log.level.should == "debug"}
|
35
|
-
it { subject.process_stdout_log.output.should == "log/stdout.log"}
|
36
|
-
it { subject.process_stdout_log.rotation.should == 5}
|
37
|
-
it { subject.process_stdout_log.rotation_size.should == 1024 * 1024 * 1024}
|
38
|
-
it { subject.process_stderr_log.output.should == "log/stderr.log"}
|
39
|
-
it { subject.process_stderr_log.rotation.should == 5}
|
40
|
-
it { subject.process_stderr_log.rotation_size.should == 1024 * 1024 * 1024}
|
41
|
-
it { subject.process_stderr_log.level.should == "info"}
|
42
|
-
end
|
43
|
-
|
44
|
-
shared_examples_for "load_config_file_by_config_option_on_file" do
|
45
|
-
it { subject.action.should == 'start'}
|
46
|
-
it { subject.config.should == nil}
|
47
|
-
it { subject.log_common.level.should == "info"}
|
48
|
-
it { subject.process_stdout_log.level.should == "warn"}
|
49
|
-
end
|
50
|
-
|
51
|
-
shared_examples_for "load_config_file_by_config_option_override" do
|
52
|
-
it { subject.action.should == 'test'}
|
53
|
-
it { subject.config.should == @config_filepath}
|
54
|
-
it { subject.log_common.level.should == "debug"}
|
55
|
-
it { subject.process_stdout_log.level.should == "info"}
|
56
|
-
end
|
57
|
-
|
58
|
-
context "only load_file" do
|
59
|
-
before(:all) do
|
60
|
-
@suite = build_suite1
|
61
|
-
@suite.load_file(@config_filepath)
|
62
|
-
end
|
63
|
-
subject{ @suite }
|
64
|
-
it_should_behave_like "load_config_file_by_config_option_common"
|
65
|
-
it_should_behave_like "load_config_file_by_config_option_on_file"
|
66
|
-
end
|
67
|
-
|
68
|
-
context "use long option name" do
|
69
|
-
before(:all) do
|
70
|
-
@suite = build_suite1
|
71
|
-
@suite.parse!(%w[--action=test --log-common-level=debug --process-stdout-log-level=info] +
|
72
|
-
["--config=" + @config_filepath])
|
73
|
-
end
|
74
|
-
subject{ @suite }
|
75
|
-
it_should_behave_like "load_config_file_by_config_option_common"
|
76
|
-
it_should_behave_like "load_config_file_by_config_option_override"
|
77
|
-
end
|
78
|
-
|
79
|
-
context "use short option name" do
|
80
|
-
before(:all) do
|
81
|
-
@suite = build_suite1
|
82
|
-
@suite.parse!(%w[-k test --log-common-level=debug --process-stdout-log-level=info] +
|
83
|
-
["-f", @config_filepath])
|
84
|
-
end
|
85
|
-
subject{ @suite }
|
86
|
-
it_should_behave_like "load_config_file_by_config_option_common"
|
87
|
-
it_should_behave_like "load_config_file_by_config_option_override"
|
88
|
-
end
|
89
|
-
|
90
|
-
end
|
91
|
-
|
92
|
-
end
|
93
|
-
|
94
|
-
end
|
@@ -1,239 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
|
3
|
-
|
4
|
-
require 'tengine/support/yaml_with_erb'
|
5
|
-
|
6
|
-
describe "config" do
|
7
|
-
shared_examples_for "load_spec_01.yml's data common" do
|
8
|
-
describe "accessors" do
|
9
|
-
it { subject.action.should == "start"}
|
10
|
-
it { subject.config.should == nil}
|
11
|
-
it { subject.process.should be_a(App1::ProcessConfig) }
|
12
|
-
it { subject.process.daemon.should == true}
|
13
|
-
it { subject.process.pid_dir.should == "./tmp/pids"}
|
14
|
-
it { subject.event_queue.connection.host.should == "rabbitmq1"}
|
15
|
-
it { subject.event_queue.connection.port.should == 5672}
|
16
|
-
it { subject.event_queue.exchange.name.should == "tengine_event_exchange"}
|
17
|
-
it { subject.event_queue.exchange.type.should == 'direct'}
|
18
|
-
it { subject.event_queue.exchange.durable.should == true}
|
19
|
-
it { subject.event_queue.queue.name.should == "tengine_event_queue"}
|
20
|
-
it { subject.event_queue.queue.durable.should == true}
|
21
|
-
it { subject.log_common.output.should == "STDOUT"}
|
22
|
-
it { subject.log_common.rotation.should == 5}
|
23
|
-
it { subject.log_common.rotation_size.should == 1024 * 1024 * 1024}
|
24
|
-
it { subject.log_common.level.should == "info"}
|
25
|
-
it { subject.application_log.output.should == "log/application.log"}
|
26
|
-
it { subject.application_log.rotation.should == 'daily'}
|
27
|
-
it { subject.application_log.rotation_size.should == 1024 * 1024 * 1024}
|
28
|
-
it { subject.application_log.level.should == "debug"}
|
29
|
-
it { subject.process_stdout_log.output.should == "log/stdout.log"}
|
30
|
-
it { subject.process_stdout_log.rotation.should == 5}
|
31
|
-
it { subject.process_stdout_log.rotation_size.should == 1024 * 1024 * 1024}
|
32
|
-
it { subject.process_stdout_log.level.should == "warn"}
|
33
|
-
it { subject.process_stderr_log.output.should == "log/stderr.log"}
|
34
|
-
it { subject.process_stderr_log.rotation.should == 5}
|
35
|
-
it { subject.process_stderr_log.rotation_size.should == 1024 * 1024 * 1024}
|
36
|
-
it { subject.process_stderr_log.level.should == "info"}
|
37
|
-
end
|
38
|
-
|
39
|
-
describe "like Hash" do
|
40
|
-
it { subject[:action].should == "start"}
|
41
|
-
it { subject[:config].should == nil}
|
42
|
-
it { subject[:process].should be_a(App1::ProcessConfig) }
|
43
|
-
it { subject[:process][:daemon].should == true}
|
44
|
-
it { subject[:process][:pid_dir].should == "./tmp/pids"}
|
45
|
-
it { subject[:event_queue][:connection][:host].should == "rabbitmq1"}
|
46
|
-
it { subject[:event_queue][:connection][:port].should == 5672}
|
47
|
-
it { subject[:event_queue][:exchange][:name].should == "tengine_event_exchange"}
|
48
|
-
it { subject[:event_queue][:exchange][:type].should == 'direct'}
|
49
|
-
it { subject[:event_queue][:exchange][:durable].should == true}
|
50
|
-
it { subject[:event_queue][:queue][:name].should == "tengine_event_queue"}
|
51
|
-
it { subject[:event_queue][:queue][:durable].should == true}
|
52
|
-
it { subject[:log_common][:output].should == "STDOUT"}
|
53
|
-
it { subject[:log_common][:rotation].should == 5}
|
54
|
-
it { subject[:log_common][:rotation_size].should == 1024 * 1024 * 1024}
|
55
|
-
it { subject[:log_common][:level].should == "info"}
|
56
|
-
it { subject[:application_log][:output].should == "log/application.log"}
|
57
|
-
it { subject[:application_log][:rotation].should == 'daily'}
|
58
|
-
it { subject[:application_log][:rotation_size].should == 1024 * 1024 * 1024}
|
59
|
-
it { subject[:application_log][:level].should == "debug"}
|
60
|
-
it { subject[:process_stdout_log][:output].should == "log/stdout.log"}
|
61
|
-
it { subject[:process_stdout_log][:rotation].should == 5}
|
62
|
-
it { subject[:process_stdout_log][:rotation_size].should == 1024 * 1024 * 1024}
|
63
|
-
it { subject[:process_stdout_log][:level].should == "warn"}
|
64
|
-
it { subject[:process_stderr_log][:output].should == "log/stderr.log"}
|
65
|
-
it { subject[:process_stderr_log][:rotation].should == 5}
|
66
|
-
it { subject[:process_stderr_log][:rotation_size].should == 1024 * 1024 * 1024}
|
67
|
-
it { subject[:process_stderr_log][:level].should == "info"}
|
68
|
-
end
|
69
|
-
|
70
|
-
describe "process to_hash" do
|
71
|
-
it do
|
72
|
-
subject.event_queue.connection.to_hash.should == {
|
73
|
-
:host => "rabbitmq1",
|
74
|
-
:port => 5672,
|
75
|
-
:vhost=>nil,
|
76
|
-
:user=>nil,
|
77
|
-
:pass=>nil,
|
78
|
-
:heartbeat_interval=>0
|
79
|
-
}
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
shared_examples_for "load_spec_01.yml's data with db config" do
|
85
|
-
describe "accessors" do
|
86
|
-
it { subject.db.should be_a(Tengine::Support::Config::Mongoid::Connection) }
|
87
|
-
it { subject.db.host.should == "localhost"}
|
88
|
-
it { subject.db.port.should == 27020}
|
89
|
-
it { subject.db.username.should == nil}
|
90
|
-
it { subject.db.password.should == nil}
|
91
|
-
it { subject.db.database.should == "tengine_production"}
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
shared_examples_for "load_spec_01.yml's data with db Hash" do
|
96
|
-
describe "accessors" do
|
97
|
-
it do
|
98
|
-
subject.db.should == {
|
99
|
-
'host'=> "localhost",
|
100
|
-
'port' => 27020,
|
101
|
-
'username' => nil,
|
102
|
-
'password' => nil,
|
103
|
-
'database' => "tengine_production"
|
104
|
-
}
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
context "app1 setting" do
|
110
|
-
describe :load do
|
111
|
-
before(:all) do
|
112
|
-
@suite = build_suite1
|
113
|
-
@suite.load(YAML.load_file(File.expand_path('load_spec_01.yml.erb', File.dirname(__FILE__))))
|
114
|
-
end
|
115
|
-
subject{ @suite }
|
116
|
-
it_should_behave_like "load_spec_01.yml's data common"
|
117
|
-
it_should_behave_like "load_spec_01.yml's data with db config"
|
118
|
-
end
|
119
|
-
|
120
|
-
describe :load_file do
|
121
|
-
context "normal" do
|
122
|
-
before(:all) do
|
123
|
-
@suite = build_suite1
|
124
|
-
@suite.load_file(File.expand_path('load_spec_01.yml.erb', File.dirname(__FILE__)))
|
125
|
-
end
|
126
|
-
subject{ @suite }
|
127
|
-
it_should_behave_like "load_spec_01.yml's data common"
|
128
|
-
it_should_behave_like "load_spec_01.yml's data with db config"
|
129
|
-
end
|
130
|
-
|
131
|
-
context "accept other settings" do
|
132
|
-
before(:all) do
|
133
|
-
@suite = build_suite1
|
134
|
-
@suite.load_file(File.expand_path('load_spec_01_with_other_settings.yml.erb', File.dirname(__FILE__)))
|
135
|
-
end
|
136
|
-
subject{ @suite }
|
137
|
-
it_should_behave_like "load_spec_01.yml's data common"
|
138
|
-
it_should_behave_like "load_spec_01.yml's data with db config"
|
139
|
-
end
|
140
|
-
|
141
|
-
describe "error for other settings" do
|
142
|
-
before(:all) do
|
143
|
-
@suite = build_suite2
|
144
|
-
end
|
145
|
-
it do
|
146
|
-
begin
|
147
|
-
@suite.load_file(File.expand_path('load_spec_01_with_other_settings.yml.erb', File.dirname(__FILE__)))
|
148
|
-
rescue Exception => e
|
149
|
-
e.message.should =~ /child not found for \"app[23]_settings\"/
|
150
|
-
end
|
151
|
-
end
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
describe :load_file_by_suite3 do
|
156
|
-
before(:all) do
|
157
|
-
@suite = build_suite3
|
158
|
-
@suite.load_file(File.expand_path('load_spec_01.yml.erb', File.dirname(__FILE__)))
|
159
|
-
end
|
160
|
-
subject{ @suite }
|
161
|
-
it_should_behave_like "load_spec_01.yml's data common"
|
162
|
-
it_should_behave_like "load_spec_01.yml's data with db Hash"
|
163
|
-
end
|
164
|
-
|
165
|
-
describe :load_file_by_suite3_with_filepath do
|
166
|
-
before(:all) do
|
167
|
-
@suite = build_suite3(File.expand_path('load_spec_01.yml.erb', File.dirname(__FILE__)))
|
168
|
-
end
|
169
|
-
subject{ @suite }
|
170
|
-
it_should_behave_like "load_spec_01.yml's data common"
|
171
|
-
it_should_behave_like "load_spec_01.yml's data with db Hash"
|
172
|
-
end
|
173
|
-
|
174
|
-
describe :load_file_by_suite3_with_hash do
|
175
|
-
before(:all) do
|
176
|
-
@suite = build_suite3(YAML.load_file(File.expand_path('load_spec_01.yml.erb', File.dirname(__FILE__))))
|
177
|
-
end
|
178
|
-
subject{ @suite }
|
179
|
-
it_should_behave_like "load_spec_01.yml's data common"
|
180
|
-
it_should_behave_like "load_spec_01.yml's data with db Hash"
|
181
|
-
end
|
182
|
-
|
183
|
-
|
184
|
-
context "set like a Hash" do
|
185
|
-
before do
|
186
|
-
@suite = build_suite1
|
187
|
-
@suite.load_file(File.expand_path('load_spec_01.yml.erb', File.dirname(__FILE__)))
|
188
|
-
end
|
189
|
-
|
190
|
-
describe "#[]=" do
|
191
|
-
it "set value to field" do
|
192
|
-
@suite[:event_queue][:connection][:port] = 2765
|
193
|
-
@suite[:event_queue][:connection][:port].should == 2765
|
194
|
-
end
|
195
|
-
|
196
|
-
it "set value to group" do
|
197
|
-
event_queue = @suite[:event_queue]
|
198
|
-
expect{
|
199
|
-
event_queue[:connection] = :hoge
|
200
|
-
}.to raise_error(ArgumentError, "can't replace :connection")
|
201
|
-
end
|
202
|
-
end
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
|
-
context "hash for db settings" do
|
207
|
-
describe :load do
|
208
|
-
before(:all) do
|
209
|
-
@suite = build_suite2
|
210
|
-
@suite.load(YAML.load_file(File.expand_path('load_spec_02.yml.erb', File.dirname(__FILE__))))
|
211
|
-
end
|
212
|
-
subject{ @suite }
|
213
|
-
it_should_behave_like "load_spec_01.yml's data common"
|
214
|
-
it "should has a hash for db settings" do
|
215
|
-
subject.db.should == {
|
216
|
-
'hosts' => [['tgndb001', 27017], ['tgndb002', 27017], ['tgndb003', 27017]],
|
217
|
-
'host' => 'localhost',
|
218
|
-
'port' => 27017,
|
219
|
-
'username' => nil,
|
220
|
-
'password' => nil,
|
221
|
-
'database' => 'tengine_production',
|
222
|
-
'read_secondary' => false,
|
223
|
-
'max_retries_on_connection_failure' => 3
|
224
|
-
}
|
225
|
-
end
|
226
|
-
end
|
227
|
-
|
228
|
-
describe :load_file do
|
229
|
-
before(:all) do
|
230
|
-
@suite = build_suite1
|
231
|
-
@suite.load_file(File.expand_path('load_spec_01.yml.erb', File.dirname(__FILE__)))
|
232
|
-
end
|
233
|
-
subject{ @suite }
|
234
|
-
it_should_behave_like "load_spec_01.yml's data common"
|
235
|
-
it_should_behave_like "load_spec_01.yml's data with db config"
|
236
|
-
end
|
237
|
-
end
|
238
|
-
|
239
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
process:
|
2
|
-
daemon: true
|
3
|
-
pid_dir: "./tmp/pids"
|
4
|
-
|
5
|
-
db:
|
6
|
-
host: 'localhost'
|
7
|
-
port: 27020
|
8
|
-
username:
|
9
|
-
password:
|
10
|
-
database: 'tengine_production'
|
11
|
-
|
12
|
-
event_queue:
|
13
|
-
connection:
|
14
|
-
host: 'rabbitmq1'
|
15
|
-
port: 5672
|
16
|
-
# vhost:
|
17
|
-
# user:
|
18
|
-
# pass:
|
19
|
-
exchange:
|
20
|
-
name: 'tengine_event_exchange'
|
21
|
-
type: 'direct'
|
22
|
-
durable: true
|
23
|
-
queue:
|
24
|
-
name: 'tengine_event_queue'
|
25
|
-
durable: true
|
26
|
-
|
27
|
-
log_common:
|
28
|
-
rotation: 5
|
29
|
-
rotation_size: <%= 1024 * 1024 * 1024 %>
|
30
|
-
level: 'info'
|
31
|
-
|
32
|
-
application_log:
|
33
|
-
output: "log/application.log"
|
34
|
-
rotation: 'daily'
|
35
|
-
level: 'debug'
|
36
|
-
|
37
|
-
process_stdout_log:
|
38
|
-
output: "log/stdout.log"
|
39
|
-
level: 'warn'
|
40
|
-
|
41
|
-
process_stderr_log:
|
42
|
-
output: "log/stderr.log"
|
43
|
-
level: 'info'
|
@@ -1,48 +0,0 @@
|
|
1
|
-
process:
|
2
|
-
daemon: true
|
3
|
-
pid_dir: "./tmp/pids"
|
4
|
-
|
5
|
-
db:
|
6
|
-
host: 'localhost'
|
7
|
-
port: 27020
|
8
|
-
username:
|
9
|
-
password:
|
10
|
-
database: 'tengine_production'
|
11
|
-
|
12
|
-
event_queue:
|
13
|
-
connection:
|
14
|
-
host: 'rabbitmq1'
|
15
|
-
port: 5672
|
16
|
-
# vhost:
|
17
|
-
# user:
|
18
|
-
# pass:
|
19
|
-
exchange:
|
20
|
-
name: 'tengine_event_exchange'
|
21
|
-
type: 'direct'
|
22
|
-
durable: true
|
23
|
-
queue:
|
24
|
-
name: 'tengine_event_queue'
|
25
|
-
durable: true
|
26
|
-
|
27
|
-
log_common:
|
28
|
-
rotation: 5
|
29
|
-
rotation_size: <%= 1024 * 1024 * 1024 %>
|
30
|
-
level: 'info'
|
31
|
-
|
32
|
-
application_log:
|
33
|
-
output: "log/application.log"
|
34
|
-
rotation: 'daily'
|
35
|
-
level: 'debug'
|
36
|
-
|
37
|
-
process_stdout_log:
|
38
|
-
output: "log/stdout.log"
|
39
|
-
level: 'warn'
|
40
|
-
|
41
|
-
process_stderr_log:
|
42
|
-
output: "log/stderr.log"
|
43
|
-
level: 'info'
|
44
|
-
|
45
|
-
app2_settings: foo
|
46
|
-
app3_settings:
|
47
|
-
foo: 10
|
48
|
-
bar: 20
|
@@ -1,52 +0,0 @@
|
|
1
|
-
process:
|
2
|
-
daemon: true
|
3
|
-
pid_dir: "./tmp/pids"
|
4
|
-
|
5
|
-
db:
|
6
|
-
hosts:
|
7
|
-
- - tgndb001
|
8
|
-
- 27017
|
9
|
-
- - tgndb002
|
10
|
-
- 27017
|
11
|
-
- - tgndb003
|
12
|
-
- 27017
|
13
|
-
host: localhost
|
14
|
-
port: 27017
|
15
|
-
username:
|
16
|
-
password:
|
17
|
-
database: 'tengine_production'
|
18
|
-
read_secondary: false
|
19
|
-
max_retries_on_connection_failure: 3
|
20
|
-
|
21
|
-
event_queue:
|
22
|
-
connection:
|
23
|
-
host: 'rabbitmq1'
|
24
|
-
port: 5672
|
25
|
-
# vhost:
|
26
|
-
# user:
|
27
|
-
# pass:
|
28
|
-
exchange:
|
29
|
-
name: 'tengine_event_exchange'
|
30
|
-
type: 'direct'
|
31
|
-
durable: true
|
32
|
-
queue:
|
33
|
-
name: 'tengine_event_queue'
|
34
|
-
durable: true
|
35
|
-
|
36
|
-
log_common:
|
37
|
-
rotation: 5
|
38
|
-
rotation_size: <%= 1024 * 1024 * 1024 %>
|
39
|
-
level: 'info'
|
40
|
-
|
41
|
-
application_log:
|
42
|
-
output: "log/application.log"
|
43
|
-
rotation: 'daily'
|
44
|
-
level: 'debug'
|
45
|
-
|
46
|
-
process_stdout_log:
|
47
|
-
output: "log/stdout.log"
|
48
|
-
level: 'warn'
|
49
|
-
|
50
|
-
process_stderr_log:
|
51
|
-
output: "log/stderr.log"
|
52
|
-
level: 'info'
|