|
9 | 9 | describe 'ssl-gateway reachability spec for apps' do
|
10 | 10 | let(:app_name) { "checker" }
|
11 | 11 |
|
12 |
| - before(:all) do |
13 |
| - app_name = "checker" |
14 |
| - manifest = "reachability.yml" |
15 |
| - properties = { |
16 |
| - :release_version => ENV["RELEASE"].gsub("ssl-gateway-", "").gsub(".yml", ""), |
17 |
| - :local_ip => ENV["LOCALHOST_IP"] |
18 |
| - } |
19 |
| - |
20 |
| - ManifestHelpers::render_manifest(manifest, properties) |
21 |
| - BoshHelpers::deploy(manifest, ENV['IAAS_CONFIG'], ENV['EXTERNAL_SECRETS'], ENV['OPS_FILE']) |
22 |
| - |
23 |
| - CFHelpers::push_checker_app(app_name, 80) |
24 |
| - CFHelpers::push_checker_app(app_name, 443) |
25 |
| - CFHelpers::push_checker_app(app_name, 4443) |
26 |
| - |
27 |
| - CFHelpers::push_checker_app(app_name, 80, ENV["REACHABLE_BLACKLIST_DOMAIN"]) |
28 |
| - CFHelpers::push_checker_app(app_name, 80, ENV["UNREACHABLE_BLACKLIST_DOMAIN"]) |
29 |
| - |
30 |
| - CFHelpers::push_checker_app(app_name, 80, ENV["REACHABLE_SSL_BLACKLIST_DOMAIN"]) |
31 |
| - CFHelpers::push_checker_app(app_name, 443, ENV["REACHABLE_SSL_BLACKLIST_DOMAIN"]) |
32 |
| - CFHelpers::push_checker_app(app_name, 4443, ENV["REACHABLE_SSL_BLACKLIST_DOMAIN"]) |
33 |
| - |
34 |
| - CFHelpers::push_checker_app(app_name, 80, ENV["UNREACHABLE_SSL_BLACKLIST_DOMAIN"]) |
35 |
| - CFHelpers::push_checker_app(app_name, 443, ENV["UNREACHABLE_SSL_BLACKLIST_DOMAIN"]) |
36 |
| - CFHelpers::push_checker_app(app_name, 4443, ENV["UNREACHABLE_SSL_BLACKLIST_DOMAIN"]) |
37 |
| - end |
38 |
| - |
39 |
| - context 'when a ssl-gateway is deployed with service checker apps' do |
| 12 | + context 'when service checker apps are pushed' do |
40 | 13 | context "reachable blacklist domain #{ENV["REACHABLE_BLACKLIST_DOMAIN"]}" do
|
41 | 14 | it 'it is possible to send a http request on port 80 to the reachable blacklist domain' do
|
42 | 15 | expect(HTTParty.get("http://#{app_name}.#{ENV["REACHABLE_BLACKLIST_DOMAIN"]}").code == 200)
|
|
54 | 27 | expect(HTTParty.get("http://#{app_name}.#{ENV["RANDOM_DOMAIN"]}").code == 200)
|
55 | 28 | end
|
56 | 29 |
|
| 30 | + it 'it redirects http requests to port 443' do |
| 31 | + response = HTTParty.get("http://#{app_name}.#{ENV["RANDOM_DOMAIN"]}", follow_redirects: false) |
| 32 | + expect(response.headers["location"]).to eq("https://#{app_name}.#{ENV["DEFAULT_APP_DOMAIN"]}") |
| 33 | + end |
| 34 | + |
57 | 35 | it 'it is possible to send a https request on port 443 to the random domain' do
|
58 | 36 | expect(HTTParty.get("https://#{app_name}.#{ENV["RANDOM_DOMAIN"]}:443", :verify => false).code == 200)
|
59 | 37 | end
|
|
68 | 46 | expect(HTTParty.get("http://#{app_name}.#{ENV["DEFAULT_APP_DOMAIN"]}").code == 200)
|
69 | 47 | end
|
70 | 48 |
|
| 49 | + it 'it redirects http requests to port 443' do |
| 50 | + response = HTTParty.get("http://#{app_name}.#{ENV["DEFAULT_APP_DOMAIN"]}", follow_redirects: false) |
| 51 | + expect(response.headers["location"]).to eq("https://#{app_name}.#{ENV["DEFAULT_APP_DOMAIN"]}") |
| 52 | + end |
| 53 | + |
71 | 54 | it 'it is possible to send a https request on port 443 to the default app domain' do
|
72 | 55 | expect(HTTParty.get("https://#{app_name}.#{ENV["DEFAULT_APP_DOMAIN"]}:443", :verify => false).code == 200)
|
73 | 56 | end
|
|
82 | 65 | expect(HTTParty.get("http://#{app_name}.#{ENV["REACHABLE_BLACKLIST_DOMAIN"]}").code == 200)
|
83 | 66 | end
|
84 | 67 |
|
| 68 | + it 'it redirects http requests to port 443' do |
| 69 | + response = HTTParty.get("http://#{app_name}.#{ENV["REACHABLE_BLACKLIST_DOMAIN"]}", follow_redirects: false) |
| 70 | + expect(response.headers["location"]).to eq("https://#{app_name}.#{ENV["DEFAULT_APP_DOMAIN"]}") |
| 71 | + end |
| 72 | + |
85 | 73 | it 'it is possible to send a https request on port 443 to the reachable blacklist domain' do
|
86 | 74 | expect(HTTParty.get("https://#{app_name}.#{ENV["REACHABLE_BLACKLIST_DOMAIN"]}:443", :verify => false).code == 200)
|
87 | 75 | end
|
|
0 commit comments