import glob
import httplib2
import os
-import pipes
import random
import re
+import shlex
import shutil
import signal
import socket
os.makedirs(gitdir)
subprocess.check_output(['tar', '-xC', gitdir, '-f', gittarball])
+ # Customizing the passenger config template is the only documented
+ # way to override the default passenger_stat_throttle_rate (10 s).
+ # In the testing environment, we want restart.txt to take effect
+ # immediately.
+ resdir = subprocess.check_output(['bundle', 'exec', 'passenger-config', 'about', 'resourcesdir']).decode().rstrip()
+ with open(resdir + '/templates/standalone/config.erb') as f:
+ template = f.read()
+ newtemplate = re.sub(r'http \{', 'http {\n passenger_stat_throttle_rate 0;', template)
+ if newtemplate == template:
+ raise "template edit failed"
+ with open('tmp/passenger-nginx.conf.erb', 'w') as f:
+ f.write(newtemplate)
+
port = internal_port_from_config("RailsAPI")
env = os.environ.copy()
env['RAILS_ENV'] = 'test'
railsapi = subprocess.Popen(
['bundle', 'exec',
'passenger', 'start', '-p{}'.format(port),
+ '--nginx-config-template', 'tmp/passenger-nginx.conf.erb',
+ '--no-friendly-error-pages',
+ '--disable-anonymous-telemetry',
+ '--disable-security-update-check',
'--pid-file', pid_file,
'--log-file', '/dev/stdout',
'--ssl',
return
stop_nginx()
nginxconf = {}
- nginxconf['LISTENHOST'] = 'localhost'
+ nginxconf['UPSTREAMHOST'] = '127.0.0.1'
+ nginxconf['LISTENHOST'] = '127.0.0.1'
nginxconf['CONTROLLERPORT'] = internal_port_from_config("Controller")
nginxconf['ARVADOS_API_HOST'] = "0.0.0.0:" + str(external_port_from_config("Controller"))
nginxconf['CONTROLLERSSLPORT'] = external_port_from_config("Controller")
nginxconf['ACCESSLOG'] = _logfilename('nginx_access')
nginxconf['ERRORLOG'] = _logfilename('nginx_error')
nginxconf['TMPDIR'] = TEST_TMPDIR + '/nginx'
+ nginxconf['INTERNALSUBNETS'] = '169.254.0.0/16 0;'
conftemplatefile = os.path.join(MY_DIRNAME, 'nginx.conf')
conffile = os.path.join(TEST_TMPDIR, 'nginx.conf')
"SystemRootToken": auth_token('system_user'),
"API": {
"RequestTimeout": "30s",
+ "LockBeforeUpdate": True,
},
"Login": {
"Test": {
"JobsAPI": {
"GitInternalDir": os.path.join(SERVICES_SRC_DIR, 'api', 'tmp', 'internal.git'),
},
+ "LocalKeepBlobBuffersPerVCPU": 0,
+ "Logging": {
+ "SweepInterval": 0, # disable, otherwise test cases can't acquire dblock
+ },
"SupportedDockerImageFormats": {"v1": {}},
"ShellAccess": {
"Admin": True,
cls._orig_config = arvados.config.settings().copy()
cls._cleanup_funcs = []
os.environ.pop('ARVADOS_KEEP_SERVICES', None)
- os.environ.pop('ARVADOS_EXTERNAL_CLIENT', None)
for server_kwargs, start_func, stop_func in (
(cls.MAIN_SERVER, run, reset),
(cls.WS_SERVER, run_ws, stop_ws),
format(args.action, actions),
file=sys.stderr)
sys.exit(1)
+ # Create a new process group so our child processes don't exit on
+ # ^C in run-tests.sh interactive mode.
+ os.setpgid(0, 0)
if args.action == 'start':
stop(force=('ARVADOS_TEST_API_HOST' not in os.environ))
run(leave_running_atexit=True)
host = os.environ['ARVADOS_API_HOST']
if args.auth is not None:
token = auth_token(args.auth)
- print("export ARVADOS_API_TOKEN={}".format(pipes.quote(token)))
- print("export ARVADOS_API_HOST={}".format(pipes.quote(host)))
+ print("export ARVADOS_API_TOKEN={}".format(shlex.quote(token)))
+ print("export ARVADOS_API_HOST={}".format(shlex.quote(host)))
print("export ARVADOS_API_HOST_INSECURE=true")
else:
print(host)