Skip to content

Commit 1fe748e

Browse files
committed
Experiment with reusing the ApacheDS LDAP server for each test
1 parent b3ac5f3 commit 1fe748e

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

test/test_helper.rb

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@
1212

1313
require 'minitest/autorun'
1414

15+
if ENV.fetch('TESTENV', "apacheds") == "apacheds"
16+
# Make sure we clean up running test server
17+
# NOTE: We need to do this manually since its internal `at_exit` hook
18+
# collides with Minitest's autorun at_exit handling, hence this hook.
19+
Minitest.after_run do
20+
GitHub::Ldap.stop_server
21+
end
22+
end
23+
1524
class GitHub::Ldap::Test < Minitest::Test
1625
def self.test_env
1726
ENV.fetch("TESTENV", "apacheds")
@@ -25,7 +34,8 @@ def self.run(reporter, options = {})
2534

2635
def self.stop_server
2736
if test_env == "apacheds"
28-
GitHub::Ldap.stop_server
37+
# see Minitest.after_run hook above.
38+
# GitHub::Ldap.stop_server
2939
end
3040
end
3141

@@ -40,6 +50,9 @@ def self.test_server_options
4050

4151
def self.start_server
4252
if test_env == "apacheds"
53+
# skip this if a server has already been started
54+
return if GitHub::Ldap.ldap_server
55+
4356
GitHub::Ldap.start_server(test_server_options)
4457
end
4558
end

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy