Setup test hosts for connection caching

This commit is contained in:
Matt Todd 2016-08-05 09:53:59 -04:00
Родитель 2b80058206
Коммит e7de8e7e45
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 63F98EA7CF9EE8C3
2 изменённых файлов: 11 добавлений и 13 удалений

Просмотреть файл

@ -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