Setup test hosts for connection caching
This commit is contained in:
Родитель
2b80058206
Коммит
e7de8e7e45
|
@ -7,6 +7,12 @@ env:
|
|||
- TESTENV=openldap
|
||||
- TESTENV=apacheds
|
||||
|
||||
# https://docs.travis-ci.com/user/hosts/
|
||||
addons:
|
||||
hosts:
|
||||
- ad1.ghe.dev
|
||||
- ad2.ghe.dev
|
||||
|
||||
install:
|
||||
- if [ "$TESTENV" = "openldap" ]; then ./script/install-openldap; fi
|
||||
- bundle install
|
||||
|
|
|
@ -2,24 +2,16 @@ require_relative 'test_helper'
|
|||
|
||||
class GitHubLdapConnectionCacheTestCases < GitHub::Ldap::Test
|
||||
|
||||
def options
|
||||
{
|
||||
admin_user: "uid=admin,dc=github,dc=com",
|
||||
admin_password: "passworD1",
|
||||
port: 389
|
||||
}
|
||||
end
|
||||
|
||||
def test_returns_cached_connection
|
||||
conn1 = GitHub::Ldap::ConnectionCache.get_connection(options.merge(:host => "ghe.gh"))
|
||||
conn2 = GitHub::Ldap::ConnectionCache.get_connection(options.merge(:host => "ghe.gh"))
|
||||
conn1 = GitHub::Ldap::ConnectionCache.get_connection(options.merge(:host => "ad1.ghe.dev"))
|
||||
conn2 = GitHub::Ldap::ConnectionCache.get_connection(options.merge(:host => "ad1.ghe.dev"))
|
||||
assert_equal conn1.object_id, conn2.object_id
|
||||
end
|
||||
|
||||
def test_creates_new_connections_per_host
|
||||
conn1 = GitHub::Ldap::ConnectionCache.get_connection(options.merge(:host => "ghe.gh"))
|
||||
conn2 = GitHub::Ldap::ConnectionCache.get_connection(options.merge(:host => "ghe.dev"))
|
||||
conn3 = GitHub::Ldap::ConnectionCache.get_connection(options.merge(:host => "ghe.dev"))
|
||||
conn1 = GitHub::Ldap::ConnectionCache.get_connection(options.merge(:host => "ad1.ghe.dev"))
|
||||
conn2 = GitHub::Ldap::ConnectionCache.get_connection(options.merge(:host => "ad2.ghe.dev"))
|
||||
conn3 = GitHub::Ldap::ConnectionCache.get_connection(options.merge(:host => "ad2.ghe.dev"))
|
||||
refute_equal conn1.object_id, conn2.object_id
|
||||
assert_equal conn2.object_id, conn3.object_id
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче