Skip to content

Commit fb4c76d

Browse files
committed
adjust hostname to the new certificate for TLS tests
I couldn't manage to get the container running with a cert issued to a given IP, like 127.0.0.1 or localhost. Instead, I specified a static hostname (the container uses hostname to generate the cert) and injected it in travis. Unfortunately, in local development this means changing /etc/hosts, but I feel that's a better option that having to install LDAP locally
1 parent 683d660 commit fb4c76d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

test/integration/test_bind.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
require_relative '../test_helper'
22

33
class TestBindIntegration < LDAPIntegrationTestCase
4+
5+
INTEGRATION_HOSTNAME = 'ldap.example.org'.freeze
6+
47
def test_bind_success
58
assert @ldap.bind(BIND_CREDS),
69
@ldap.get_operation_result.inspect
@@ -34,6 +37,7 @@ def test_bind_fail
3437
end
3538

3639
def test_bind_tls_with_cafile
40+
@ldap.host = INTEGRATION_HOSTNAME
3741
@ldap.encryption(
3842
method: :start_tls,
3943
tls_options: TLS_OPTS.merge(ca_file: CA_FILE),
@@ -43,7 +47,7 @@ def test_bind_tls_with_cafile
4347
end
4448

4549
def test_bind_tls_with_bad_hostname_verify_none_no_ca_passes
46-
@ldap.host = '127.0.0.1'
50+
@ldap.host = INTEGRATION_HOSTNAME
4751
@ldap.encryption(
4852
method: :start_tls,
4953
tls_options: { verify_mode: OpenSSL::SSL::VERIFY_NONE },
@@ -112,7 +116,7 @@ def test_bind_tls_with_bad_hostname_ca_no_opt_merge_fails
112116
end
113117

114118
def test_bind_tls_with_valid_hostname_default_opts_passes
115-
@ldap.host = 'localhost'
119+
@ldap.host = INTEGRATION_HOSTNAME
116120
@ldap.encryption(
117121
method: :start_tls,
118122
tls_options: TLS_OPTS.merge(verify_mode: OpenSSL::SSL::VERIFY_PEER,
@@ -123,7 +127,7 @@ def test_bind_tls_with_valid_hostname_default_opts_passes
123127
end
124128

125129
def test_bind_tls_with_valid_hostname_just_verify_peer_ca_passes
126-
@ldap.host = 'localhost'
130+
@ldap.host = INTEGRATION_HOSTNAME
127131
@ldap.encryption(
128132
method: :start_tls,
129133
tls_options: { verify_mode: OpenSSL::SSL::VERIFY_PEER,

0 commit comments

Comments
 (0)