-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.rb
66 lines (59 loc) · 1.59 KB
/
test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/ruby
require 'minitest/autorun'
require './client.rb'
describe Ichnaea do
before do
@ichnaea = Ichnaea.new
@app = @ichnaea.request("http://#{ENV.fetch('MARATHON')}:8080/v2/apps/registry")
@registry_nerve = {
:host => "test",
:port => @app['app']['tasks'].first['ports'].join,
:reporter_type => "zookeeper",
:zk_hosts => [
"zk01"
],
:zk_path => "/services/registry",
:check_interval => 2,
:checks => [
{
:type => "http",
:uri => "/v2/",
:timeout => 20,
:fall => 3
}
]
}
@registry_synapse = {
:discovery => {
:method => "zookeeper",
:path => "/services/registry",
:hosts => ["zk01"]
},
:haproxy => {
:port => @app['app']['container']['docker']['portMappings'].first['servicePort'],
:server_options => "check inter 2s rise 3 fall 2",
:listen => [
"mode http"
]
}
}
# @zk_hosts = ['zk01', 'zk02', 'zk03']
end
describe "#request" do
it "gets the registry app json" do
@app.wont_be :empty?
end
end
describe "#build nerve config" do
it "builds the nerve configuration for the registry" do
test = @ichnaea.build_nerve_json('test', 'zk01', @app['app'], @app['app']['tasks'].first)
test.must_equal @registry_nerve
end
end
describe "#build synapse config" do
it "builds the synapse configuration for the registry" do
test = @ichnaea.build_synapse_json('zk01', @app['app'])
test.must_equal @registry_synapse
end
end
end