Add py3.5 support
Depends-On: Ibda89b467b461b8833515f50a0cf1cc3064cb917 Change-Id: I68ac61b7d1d0d180a7696ae2f0f75b1a4a969995
This commit is contained in:
parent
cb2690a5fc
commit
25cd394bbe
|
@ -70,8 +70,8 @@ def main(argv=sys.argv):
|
||||||
vars_filename, os.O_CREAT | os.O_WRONLY, 0o600), 'w') as var_file:
|
vars_filename, os.O_CREAT | os.O_WRONLY, 0o600), 'w') as var_file:
|
||||||
json.dump(variables, var_file)
|
json.dump(variables, var_file)
|
||||||
# Write the executable, 'config', to file
|
# Write the executable, 'config', to file
|
||||||
with os.fdopen(os.open(fn, os.O_CREAT | os.O_WRONLY, 0o600), 'w') as f:
|
with os.fdopen(os.open(fn, os.O_CREAT | os.O_WRONLY, 0o600), 'wb') as f:
|
||||||
f.write(c.get('config', '').encode('utf-8'))
|
f.write(c.get('config', '').encode('utf-8', 'replace'))
|
||||||
|
|
||||||
cmd = [
|
cmd = [
|
||||||
ANSIBLE_CMD,
|
ANSIBLE_CMD,
|
||||||
|
@ -130,8 +130,8 @@ def main(argv=sys.argv):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
response.update({
|
response.update({
|
||||||
'deploy_stdout': stdout,
|
'deploy_stdout': stdout.decode('utf-8', 'replace'),
|
||||||
'deploy_stderr': stderr,
|
'deploy_stderr': stderr.decode('utf-8', 'replace'),
|
||||||
'deploy_status_code': subproc.returncode,
|
'deploy_status_code': subproc.returncode,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -46,8 +46,8 @@ def main(argv=sys.argv):
|
||||||
log.info('Completed apply-config.')
|
log.info('Completed apply-config.')
|
||||||
|
|
||||||
response = {
|
response = {
|
||||||
'deploy_stdout': stdout,
|
'deploy_stdout': stdout.decode('utf-8', 'replace'),
|
||||||
'deploy_stderr': stderr,
|
'deploy_stderr': stderr.decode('utf-8', 'replace'),
|
||||||
'deploy_status_code': subproc.returncode,
|
'deploy_status_code': subproc.returncode,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,8 +70,8 @@ def main(argv=sys.argv, stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr):
|
||||||
log.info('Completed %s' % CFN_INIT_CMD)
|
log.info('Completed %s' % CFN_INIT_CMD)
|
||||||
|
|
||||||
response = {
|
response = {
|
||||||
'deploy_stdout': cstdout,
|
'deploy_stdout': cstdout.decode('utf-8', 'replace'),
|
||||||
'deploy_stderr': cstderr,
|
'deploy_stderr': cstderr.decode('utf-8', 'replace'),
|
||||||
'deploy_status_code': subproc.returncode,
|
'deploy_status_code': subproc.returncode,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ def main(argv=sys.argv):
|
||||||
labels = collections.OrderedDict()
|
labels = collections.OrderedDict()
|
||||||
labels['deploy_stack_id'] = input_values.get('deploy_stack_id')
|
labels['deploy_stack_id'] = input_values.get('deploy_stack_id')
|
||||||
labels['deploy_resource_name'] = input_values.get('deploy_resource_name')
|
labels['deploy_resource_name'] = input_values.get('deploy_resource_name')
|
||||||
(stdout, stderr, deploy_status_code) = paunch.apply(
|
stdout, stderr, deploy_status_code = paunch.apply(
|
||||||
cid,
|
cid,
|
||||||
config,
|
config,
|
||||||
managed_by='docker-cmd',
|
managed_by='docker-cmd',
|
||||||
|
|
|
@ -39,13 +39,13 @@ def write_input_file(file_path, content):
|
||||||
prepare_dir(os.path.dirname(file_path))
|
prepare_dir(os.path.dirname(file_path))
|
||||||
with os.fdopen(os.open(
|
with os.fdopen(os.open(
|
||||||
file_path, os.O_CREAT | os.O_WRONLY, 0o600), 'w') as f:
|
file_path, os.O_CREAT | os.O_WRONLY, 0o600), 'w') as f:
|
||||||
f.write(content.encode('utf-8'))
|
f.write(content)
|
||||||
|
|
||||||
|
|
||||||
def build_response(deploy_stdout, deploy_stderr, deploy_status_code):
|
def build_response(deploy_stdout, deploy_stderr, deploy_status_code):
|
||||||
return {
|
return {
|
||||||
'deploy_stdout': deploy_stdout,
|
'deploy_stdout': deploy_stdout.decode('utf-8', 'replace'),
|
||||||
'deploy_stderr': deploy_stderr,
|
'deploy_stderr': deploy_stderr.decode('utf-8', 'replace'),
|
||||||
'deploy_status_code': deploy_status_code,
|
'deploy_status_code': deploy_status_code,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,6 @@ def main(argv=sys.argv):
|
||||||
|
|
||||||
if not os.path.exists(CONF_FILE):
|
if not os.path.exists(CONF_FILE):
|
||||||
log.error('No config file %s' % CONF_FILE)
|
log.error('No config file %s' % CONF_FILE)
|
||||||
return 1
|
|
||||||
|
|
||||||
if not os.path.isdir(DOCKER_COMPOSE_DIR):
|
if not os.path.isdir(DOCKER_COMPOSE_DIR):
|
||||||
os.makedirs(DOCKER_COMPOSE_DIR, 0o700)
|
os.makedirs(DOCKER_COMPOSE_DIR, 0o700)
|
||||||
|
@ -59,6 +58,7 @@ def main(argv=sys.argv):
|
||||||
write_compose_config(c)
|
write_compose_config(c)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.exception(e)
|
log.exception(e)
|
||||||
|
return 1
|
||||||
|
|
||||||
|
|
||||||
def cleanup_stale_projects(configs):
|
def cleanup_stale_projects(configs):
|
||||||
|
@ -109,7 +109,7 @@ def write_compose_config(c):
|
||||||
fn = os.path.join(proj_dir, 'docker-compose.yml')
|
fn = os.path.join(proj_dir, 'docker-compose.yml')
|
||||||
with os.fdopen(os.open(fn, os.O_CREAT | os.O_WRONLY | os.O_TRUNC, 0o600),
|
with os.fdopen(os.open(fn, os.O_CREAT | os.O_WRONLY | os.O_TRUNC, 0o600),
|
||||||
'w') as f:
|
'w') as f:
|
||||||
f.write(yaml_config.encode('utf-8'))
|
f.write(yaml_config)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -49,7 +49,7 @@ def exit_legacy_hiera_detected():
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE)
|
stderr=subprocess.PIPE)
|
||||||
stdout, stderr = subproc.communicate()
|
stdout, stderr = subproc.communicate()
|
||||||
rs_stdout = stdout.rstrip()
|
rs_stdout = stdout.rstrip().decode('utf-8', 'replace')
|
||||||
if rs_stdout != 'empty':
|
if rs_stdout != 'empty':
|
||||||
err_msg = ('Legacy hieradata from os-apply-config has been '
|
err_msg = ('Legacy hieradata from os-apply-config has been '
|
||||||
'detected - %s. Please update all of your interfaces '
|
'detected - %s. Please update all of your interfaces '
|
||||||
|
@ -96,7 +96,7 @@ def main(argv=sys.argv):
|
||||||
|
|
||||||
# write out the datafiles as YAML
|
# write out the datafiles as YAML
|
||||||
if 'datafiles' in c:
|
if 'datafiles' in c:
|
||||||
for name, data in c['datafiles'].iteritems():
|
for name, data in c['datafiles'].items():
|
||||||
hiera_data = os.path.join(HIERA_DATADIR, '%s.json' % name)
|
hiera_data = os.path.join(HIERA_DATADIR, '%s.json' % name)
|
||||||
with os.fdopen(os.open(hiera_data,
|
with os.fdopen(os.open(hiera_data,
|
||||||
os.O_CREAT | os.O_TRUNC | os.O_WRONLY,
|
os.O_CREAT | os.O_TRUNC | os.O_WRONLY,
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import cStringIO
|
import io
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
@ -82,13 +82,13 @@ def configure_logging():
|
||||||
handler.setFormatter(formatter)
|
handler.setFormatter(formatter)
|
||||||
log.addHandler(handler)
|
log.addHandler(handler)
|
||||||
|
|
||||||
deploy_stdout = cStringIO.StringIO()
|
deploy_stdout = io.StringIO()
|
||||||
handler = logging.StreamHandler(deploy_stdout)
|
handler = logging.StreamHandler(deploy_stdout)
|
||||||
handler.setFormatter(formatter)
|
handler.setFormatter(formatter)
|
||||||
handler.setLevel('DEBUG')
|
handler.setLevel('DEBUG')
|
||||||
log.addHandler(handler)
|
log.addHandler(handler)
|
||||||
|
|
||||||
deploy_stderr = cStringIO.StringIO()
|
deploy_stderr = io.StringIO()
|
||||||
handler = logging.StreamHandler(deploy_stderr)
|
handler = logging.StreamHandler(deploy_stderr)
|
||||||
handler.setFormatter(formatter)
|
handler.setFormatter(formatter)
|
||||||
handler.setLevel('WARN')
|
handler.setLevel('WARN')
|
||||||
|
|
|
@ -92,7 +92,7 @@ def main(argv=sys.argv):
|
||||||
with os.fdopen(os.open(hiera_data,
|
with os.fdopen(os.open(hiera_data,
|
||||||
os.O_CREAT | os.O_TRUNC | os.O_WRONLY, 0o600),
|
os.O_CREAT | os.O_TRUNC | os.O_WRONLY, 0o600),
|
||||||
'w') as hiera_file:
|
'w') as hiera_file:
|
||||||
hiera_file.write(json.dumps(hiera).encode('utf8'))
|
hiera_file.write(json.dumps(hiera))
|
||||||
facts['FACTER_deploy_config_name'] = c['name']
|
facts['FACTER_deploy_config_name'] = c['name']
|
||||||
|
|
||||||
fn = os.path.join(WORKING_DIR, '%s.pp' % c['id'])
|
fn = os.path.join(WORKING_DIR, '%s.pp' % c['id'])
|
||||||
|
@ -106,7 +106,7 @@ def main(argv=sys.argv):
|
||||||
|
|
||||||
with os.fdopen(os.open(fn, os.O_CREAT | os.O_TRUNC | os.O_WRONLY, 0o700),
|
with os.fdopen(os.open(fn, os.O_CREAT | os.O_TRUNC | os.O_WRONLY, 0o700),
|
||||||
'w') as f:
|
'w') as f:
|
||||||
f.write(c.get('config', '').encode('utf-8'))
|
f.write(c.get('config', ''))
|
||||||
|
|
||||||
cmd = [PUPPET_CMD, 'apply', '--color', 'false', '--detailed-exitcodes', fn]
|
cmd = [PUPPET_CMD, 'apply', '--color', 'false', '--detailed-exitcodes', fn]
|
||||||
# This is the default log destination to print out to the console and
|
# This is the default log destination to print out to the console and
|
||||||
|
|
|
@ -70,7 +70,7 @@ def main(argv=sys.argv):
|
||||||
|
|
||||||
fn = os.path.join(WORKING_DIR, state_file)
|
fn = os.path.join(WORKING_DIR, state_file)
|
||||||
with os.fdopen(os.open(fn, os.O_CREAT | os.O_WRONLY, 0o700), 'w') as f:
|
with os.fdopen(os.open(fn, os.O_CREAT | os.O_WRONLY, 0o700), 'w') as f:
|
||||||
f.write(yaml_config.encode('utf-8'))
|
f.write(yaml_config)
|
||||||
|
|
||||||
caller = salt.cli.caller.Caller.factory(opts)
|
caller = salt.cli.caller.Caller.factory(opts)
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ def main(argv=sys.argv):
|
||||||
env['heat_outputs_path'] = heat_outputs_path
|
env['heat_outputs_path'] = heat_outputs_path
|
||||||
|
|
||||||
with os.fdopen(os.open(fn, os.O_CREAT | os.O_WRONLY, 0o700), 'w') as f:
|
with os.fdopen(os.open(fn, os.O_CREAT | os.O_WRONLY, 0o700), 'w') as f:
|
||||||
f.write(c.get('config', '').encode('utf-8'))
|
f.write(c.get('config', ''))
|
||||||
|
|
||||||
log.debug('Running %s' % fn)
|
log.debug('Running %s' % fn)
|
||||||
subproc = subprocess.Popen([fn], stdout=subprocess.PIPE,
|
subproc = subprocess.Popen([fn], stdout=subprocess.PIPE,
|
||||||
|
@ -85,8 +85,8 @@ def main(argv=sys.argv):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
response.update({
|
response.update({
|
||||||
'deploy_stdout': stdout,
|
'deploy_stdout': stdout.decode('utf-8', 'replace'),
|
||||||
'deploy_stderr': stderr,
|
'deploy_stderr': stderr.decode('utf-8', 'replace'),
|
||||||
'deploy_status_code': subproc.returncode,
|
'deploy_status_code': subproc.returncode,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ def trim_response(response, trimmed_values=None):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
trimmed_values = trimmed_values or ('deploy_stdout', 'deploy_stderr')
|
trimmed_values = trimmed_values or ('deploy_stdout', 'deploy_stderr')
|
||||||
str_response = json.dumps(response, ensure_ascii=True, encoding='utf-8')
|
str_response = json.dumps(response, ensure_ascii=True)
|
||||||
len_total = len(str_response)
|
len_total = len(str_response)
|
||||||
offset = MAX_RESPONSE_SIZE - len_total
|
offset = MAX_RESPONSE_SIZE - len_total
|
||||||
if offset >= 0:
|
if offset >= 0:
|
||||||
|
|
|
@ -20,8 +20,6 @@ import stat
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import requests
|
|
||||||
|
|
||||||
HOOKS_DIR_PATHS = (
|
HOOKS_DIR_PATHS = (
|
||||||
os.environ.get('HEAT_CONFIG_HOOKS'),
|
os.environ.get('HEAT_CONFIG_HOOKS'),
|
||||||
'/usr/libexec/heat-config/hooks',
|
'/usr/libexec/heat-config/hooks',
|
||||||
|
@ -145,7 +143,8 @@ def invoke_hook(c, log):
|
||||||
stdin=subprocess.PIPE,
|
stdin=subprocess.PIPE,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE)
|
stderr=subprocess.PIPE)
|
||||||
stdout, stderr = subproc.communicate(input=json.dumps(c))
|
stdout, stderr = subproc.communicate(
|
||||||
|
input=json.dumps(c).encode('utf-8', 'replace'))
|
||||||
|
|
||||||
log.info(stdout)
|
log.info(stdout)
|
||||||
log.debug(stderr)
|
log.debug(stderr)
|
||||||
|
@ -158,7 +157,7 @@ def invoke_hook(c, log):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if stdout:
|
if stdout:
|
||||||
signal_data = json.loads(stdout)
|
signal_data = json.loads(stdout.decode('utf-8', 'replace'))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
signal_data = {
|
signal_data = {
|
||||||
'deploy_stdout': stdout,
|
'deploy_stdout': stdout,
|
||||||
|
|
|
@ -30,6 +30,8 @@ class RunScriptTest(testtools.TestCase):
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
env=env)
|
env=env)
|
||||||
|
if input_str:
|
||||||
|
input_str = input_str.encode('utf-8')
|
||||||
stdout, stderr = subproc.communicate(input=input_str)
|
stdout, stderr = subproc.communicate(input=input_str)
|
||||||
return subproc.returncode, stdout, stderr
|
return subproc.returncode, stdout, stderr
|
||||||
|
|
||||||
|
|
|
@ -48,8 +48,7 @@ def main(argv=sys.argv):
|
||||||
if isinstance(response, list):
|
if isinstance(response, list):
|
||||||
response = response[suffix]
|
response = response[suffix]
|
||||||
|
|
||||||
for k, v in response.get('files', {}).iteritems():
|
for k, v in response.get('files', {}).items():
|
||||||
open(k, 'w')
|
|
||||||
with open(k, 'w') as f:
|
with open(k, 'w') as f:
|
||||||
f.write(v)
|
f.write(v)
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,7 @@ class HeatConfigTest(common.RunScriptTest):
|
||||||
self.env = os.environ.copy()
|
self.env = os.environ.copy()
|
||||||
|
|
||||||
def write_config_file(self, data):
|
def write_config_file(self, data):
|
||||||
config_file = tempfile.NamedTemporaryFile()
|
config_file = tempfile.NamedTemporaryFile(mode='w')
|
||||||
config_file.write(json.dumps(data))
|
config_file.write(json.dumps(data))
|
||||||
config_file.flush()
|
config_file.flush()
|
||||||
return config_file
|
return config_file
|
||||||
|
|
|
@ -90,7 +90,7 @@ class HeatConfigDockerComposeORCTest(common.RunScriptTest):
|
||||||
os.chmod(hook_name, 0o755)
|
os.chmod(hook_name, 0o755)
|
||||||
|
|
||||||
def write_config_file(self, data):
|
def write_config_file(self, data):
|
||||||
config_file = tempfile.NamedTemporaryFile()
|
config_file = tempfile.NamedTemporaryFile(mode='w')
|
||||||
config_file.write(json.dumps(data))
|
config_file.write(json.dumps(data))
|
||||||
config_file.flush()
|
config_file.flush()
|
||||||
return config_file
|
return config_file
|
||||||
|
|
|
@ -117,7 +117,7 @@ class HeatConfigKubeletORCTest(common.RunScriptTest):
|
||||||
os.chmod(hook_name, 0o755)
|
os.chmod(hook_name, 0o755)
|
||||||
|
|
||||||
def write_config_file(self, data):
|
def write_config_file(self, data):
|
||||||
config_file = tempfile.NamedTemporaryFile()
|
config_file = tempfile.NamedTemporaryFile(mode='w')
|
||||||
config_file.write(json.dumps(data))
|
config_file.write(json.dumps(data))
|
||||||
config_file.flush()
|
config_file.flush()
|
||||||
return config_file
|
return config_file
|
||||||
|
|
|
@ -11,12 +11,13 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import cStringIO
|
import io
|
||||||
import json
|
import json
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
import fixtures
|
import fixtures
|
||||||
import mock
|
import mock
|
||||||
|
import six
|
||||||
|
|
||||||
from tests import common
|
from tests import common
|
||||||
from tests import heat_config_notify as hcn
|
from tests import heat_config_notify as hcn
|
||||||
|
@ -76,9 +77,13 @@ class HeatConfigNotifyTest(common.RunScriptTest):
|
||||||
super(HeatConfigNotifyTest, self).setUp()
|
super(HeatConfigNotifyTest, self).setUp()
|
||||||
self.deployed_dir = self.useFixture(fixtures.TempDir())
|
self.deployed_dir = self.useFixture(fixtures.TempDir())
|
||||||
hcn.init_logging = mock.MagicMock()
|
hcn.init_logging = mock.MagicMock()
|
||||||
|
if six.PY2:
|
||||||
|
self.stdin = io.BytesIO()
|
||||||
|
else:
|
||||||
|
self.stdin = io.StringIO()
|
||||||
|
|
||||||
def write_config_file(self, data):
|
def write_config_file(self, data):
|
||||||
config_file = tempfile.NamedTemporaryFile()
|
config_file = tempfile.NamedTemporaryFile(mode='w')
|
||||||
config_file.write(json.dumps(data))
|
config_file.write(json.dumps(data))
|
||||||
config_file.flush()
|
config_file.flush()
|
||||||
return config_file
|
return config_file
|
||||||
|
@ -86,21 +91,23 @@ class HeatConfigNotifyTest(common.RunScriptTest):
|
||||||
def test_notify_missing_file(self):
|
def test_notify_missing_file(self):
|
||||||
|
|
||||||
signal_data = json.dumps({'foo': 'bar'})
|
signal_data = json.dumps({'foo': 'bar'})
|
||||||
stdin = cStringIO.StringIO(signal_data)
|
self.stdin.write(signal_data)
|
||||||
|
self.stdin.seek(0)
|
||||||
|
|
||||||
with self.write_config_file(self.data_signal_id) as config_file:
|
with self.write_config_file(self.data_signal_id) as config_file:
|
||||||
config_file_name = config_file.name
|
config_file_name = config_file.name
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
1, hcn.main(['heat-config-notify', config_file_name], stdin))
|
1, hcn.main(['heat-config-notify', config_file_name], self.stdin))
|
||||||
|
|
||||||
def test_notify_missing_file_arg(self):
|
def test_notify_missing_file_arg(self):
|
||||||
|
|
||||||
signal_data = json.dumps({'foo': 'bar'})
|
signal_data = json.dumps({'foo': 'bar'})
|
||||||
stdin = cStringIO.StringIO(signal_data)
|
self.stdin.write(signal_data)
|
||||||
|
self.stdin.seek(0)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
1, hcn.main(['heat-config-notify'], stdin))
|
1, hcn.main(['heat-config-notify'], self.stdin))
|
||||||
|
|
||||||
def test_notify_signal_id(self):
|
def test_notify_signal_id(self):
|
||||||
requests = mock.MagicMock()
|
requests = mock.MagicMock()
|
||||||
|
@ -109,11 +116,13 @@ class HeatConfigNotifyTest(common.RunScriptTest):
|
||||||
requests.post.return_value = '[200]'
|
requests.post.return_value = '[200]'
|
||||||
|
|
||||||
signal_data = json.dumps({'foo': 'bar'})
|
signal_data = json.dumps({'foo': 'bar'})
|
||||||
stdin = cStringIO.StringIO(signal_data)
|
self.stdin.write(signal_data)
|
||||||
|
self.stdin.seek(0)
|
||||||
|
|
||||||
with self.write_config_file(self.data_signal_id) as config_file:
|
with self.write_config_file(self.data_signal_id) as config_file:
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
0, hcn.main(['heat-config-notify', config_file.name], stdin))
|
0,
|
||||||
|
hcn.main(['heat-config-notify', config_file.name], self.stdin))
|
||||||
|
|
||||||
requests.post.assert_called_once_with(
|
requests.post.assert_called_once_with(
|
||||||
'mock://192.0.2.3/foo',
|
'mock://192.0.2.3/foo',
|
||||||
|
@ -127,11 +136,13 @@ class HeatConfigNotifyTest(common.RunScriptTest):
|
||||||
requests.post.return_value = '[200]'
|
requests.post.return_value = '[200]'
|
||||||
|
|
||||||
signal_data = json.dumps({'foo': 'bar'})
|
signal_data = json.dumps({'foo': 'bar'})
|
||||||
stdin = cStringIO.StringIO(signal_data)
|
self.stdin.write(signal_data)
|
||||||
|
self.stdin.seek(0)
|
||||||
|
|
||||||
with self.write_config_file(self.data_signal_id_put) as config_file:
|
with self.write_config_file(self.data_signal_id_put) as config_file:
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
0, hcn.main(['heat-config-notify', config_file.name], stdin))
|
0,
|
||||||
|
hcn.main(['heat-config-notify', config_file.name], self.stdin))
|
||||||
|
|
||||||
requests.put.assert_called_once_with(
|
requests.put.assert_called_once_with(
|
||||||
'mock://192.0.2.3/foo',
|
'mock://192.0.2.3/foo',
|
||||||
|
@ -144,11 +155,10 @@ class HeatConfigNotifyTest(common.RunScriptTest):
|
||||||
|
|
||||||
requests.post.return_value = '[200]'
|
requests.post.return_value = '[200]'
|
||||||
|
|
||||||
stdin = cStringIO.StringIO()
|
|
||||||
|
|
||||||
with self.write_config_file(self.data_signal_id) as config_file:
|
with self.write_config_file(self.data_signal_id) as config_file:
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
0, hcn.main(['heat-config-notify', config_file.name], stdin))
|
0,
|
||||||
|
hcn.main(['heat-config-notify', config_file.name], self.stdin))
|
||||||
|
|
||||||
requests.post.assert_called_once_with(
|
requests.post.assert_called_once_with(
|
||||||
'mock://192.0.2.3/foo',
|
'mock://192.0.2.3/foo',
|
||||||
|
@ -161,11 +171,15 @@ class HeatConfigNotifyTest(common.RunScriptTest):
|
||||||
|
|
||||||
requests.post.return_value = '[200]'
|
requests.post.return_value = '[200]'
|
||||||
|
|
||||||
stdin = cStringIO.StringIO('{{{"hi')
|
signal_data = json.dumps({'foo': 'bar'})
|
||||||
|
self.stdin.write(signal_data)
|
||||||
|
self.stdin.write(signal_data[:-3])
|
||||||
|
self.stdin.seek(0)
|
||||||
|
|
||||||
with self.write_config_file(self.data_signal_id) as config_file:
|
with self.write_config_file(self.data_signal_id) as config_file:
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
0, hcn.main(['heat-config-notify', config_file.name], stdin))
|
0,
|
||||||
|
hcn.main(['heat-config-notify', config_file.name], self.stdin))
|
||||||
|
|
||||||
requests.post.assert_called_once_with(
|
requests.post.assert_called_once_with(
|
||||||
'mock://192.0.2.3/foo',
|
'mock://192.0.2.3/foo',
|
||||||
|
@ -184,14 +198,16 @@ class HeatConfigNotifyTest(common.RunScriptTest):
|
||||||
heatclient.Client.return_value = heat
|
heatclient.Client.return_value = heat
|
||||||
|
|
||||||
signal_data = json.dumps({'foo': 'bar'})
|
signal_data = json.dumps({'foo': 'bar'})
|
||||||
stdin = cStringIO.StringIO(signal_data)
|
self.stdin.write(signal_data)
|
||||||
|
self.stdin.seek(0)
|
||||||
|
|
||||||
ks.service_catalog.url_for.return_value = 'mock://192.0.2.3/heat'
|
ks.service_catalog.url_for.return_value = 'mock://192.0.2.3/heat'
|
||||||
heat.resources.signal.return_value = 'all good'
|
heat.resources.signal.return_value = 'all good'
|
||||||
|
|
||||||
with self.write_config_file(self.data_heat_signal) as config_file:
|
with self.write_config_file(self.data_heat_signal) as config_file:
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
0, hcn.main(['heat-config-notify', config_file.name], stdin))
|
0,
|
||||||
|
hcn.main(['heat-config-notify', config_file.name], self.stdin))
|
||||||
|
|
||||||
ksclient.Client.assert_called_once_with(
|
ksclient.Client.assert_called_once_with(
|
||||||
auth_url='mock://192.0.2.3/auth',
|
auth_url='mock://192.0.2.3/auth',
|
||||||
|
|
|
@ -165,7 +165,7 @@ class HookAnsibleTest(common.RunScriptTest):
|
||||||
'deploy_stdout': 'ansible success',
|
'deploy_stdout': 'ansible success',
|
||||||
'deploy_stderr': 'thing happened',
|
'deploy_stderr': 'thing happened',
|
||||||
'deploy_status_code': 0,
|
'deploy_status_code': 0,
|
||||||
}, json.loads(stdout))
|
}, json.loads(stdout.decode('utf-8')))
|
||||||
|
|
||||||
state = self.json_from_file(self.test_state_path)
|
state = self.json_from_file(self.test_state_path)
|
||||||
ansible_playbook = self.working_dir.join('1234_playbook.yaml')
|
ansible_playbook = self.working_dir.join('1234_playbook.yaml')
|
||||||
|
@ -214,7 +214,7 @@ class HookAnsibleTest(common.RunScriptTest):
|
||||||
'deploy_stdout': 'ansible success',
|
'deploy_stdout': 'ansible success',
|
||||||
'deploy_stderr': 'thing happened',
|
'deploy_stderr': 'thing happened',
|
||||||
'deploy_status_code': 0,
|
'deploy_status_code': 0,
|
||||||
}, json.loads(stdout))
|
}, json.loads(stdout.decode('utf-8')))
|
||||||
|
|
||||||
state = self.json_from_file(self.test_state_path)
|
state = self.json_from_file(self.test_state_path)
|
||||||
ansible_playbook = self.working_dir.join('1234_playbook.yaml')
|
ansible_playbook = self.working_dir.join('1234_playbook.yaml')
|
||||||
|
@ -248,7 +248,7 @@ class HookAnsibleTest(common.RunScriptTest):
|
||||||
'deploy_stdout': 'ansible failed',
|
'deploy_stdout': 'ansible failed',
|
||||||
'deploy_stderr': 'bad thing happened',
|
'deploy_stderr': 'bad thing happened',
|
||||||
'deploy_status_code': 4,
|
'deploy_status_code': 4,
|
||||||
}, json.loads(stdout))
|
}, json.loads(stdout.decode('utf-8')))
|
||||||
|
|
||||||
state = self.json_from_file(self.test_state_path)
|
state = self.json_from_file(self.test_state_path)
|
||||||
ansible_playbook = self.working_dir.join('1234_playbook.yaml')
|
ansible_playbook = self.working_dir.join('1234_playbook.yaml')
|
||||||
|
|
|
@ -64,7 +64,7 @@ class HookCfnInitTest(common.RunScriptTest):
|
||||||
'deploy_stdout': 'cfn-init success',
|
'deploy_stdout': 'cfn-init success',
|
||||||
'deploy_stderr': 'thing happened',
|
'deploy_stderr': 'thing happened',
|
||||||
'deploy_status_code': 0
|
'deploy_status_code': 0
|
||||||
}, json.loads(stdout))
|
}, json.loads(stdout.decode('utf-8')))
|
||||||
|
|
||||||
# assert last_metadata was written with cfn-init metadata
|
# assert last_metadata was written with cfn-init metadata
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
|
@ -92,7 +92,7 @@ class HookCfnInitTest(common.RunScriptTest):
|
||||||
'deploy_stdout': '',
|
'deploy_stdout': '',
|
||||||
'deploy_stderr': 'bad thing happened',
|
'deploy_stderr': 'bad thing happened',
|
||||||
'deploy_status_code': 1
|
'deploy_status_code': 1
|
||||||
}, json.loads(stdout))
|
}, json.loads(stdout.decode('utf-8')))
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
{'AWS::CloudFormation::Init': {'foo': 'bar'}},
|
{'AWS::CloudFormation::Init': {'foo': 'bar'}},
|
||||||
|
|
|
@ -13,10 +13,11 @@
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
import imp
|
import imp
|
||||||
|
import io
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import mock
|
import mock
|
||||||
import StringIO
|
import six
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from tests import common
|
from tests import common
|
||||||
|
@ -58,8 +59,12 @@ class HookChefTest(common.RunScriptTest):
|
||||||
__file__,
|
__file__,
|
||||||
'..',
|
'..',
|
||||||
'heat-config-chef/install.d/hook-chef.py')
|
'heat-config-chef/install.d/hook-chef.py')
|
||||||
sys.stdin = StringIO.StringIO()
|
if six.PY2:
|
||||||
sys.stdout = StringIO.StringIO()
|
sys.stdin = io.BytesIO()
|
||||||
|
sys.stdout = io.BytesIO()
|
||||||
|
else:
|
||||||
|
sys.stdin = io.StringIO()
|
||||||
|
sys.stdout = io.StringIO()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
super(HookChefTest, self).tearDown()
|
super(HookChefTest, self).tearDown()
|
||||||
|
@ -77,7 +82,7 @@ class HookChefTest(common.RunScriptTest):
|
||||||
data = copy.deepcopy(self.data)
|
data = copy.deepcopy(self.data)
|
||||||
data['config'] = '["recipe[apache]"]'
|
data['config'] = '["recipe[apache]"]'
|
||||||
hook_chef = self.get_module()
|
hook_chef = self.get_module()
|
||||||
sys.stdin.write(json.dumps(data))
|
json.dump(data, sys.stdin)
|
||||||
sys.stdin.seek(0)
|
sys.stdin.seek(0)
|
||||||
mock_subproc = mock.Mock()
|
mock_subproc = mock.Mock()
|
||||||
mock_popen.return_value = mock_subproc
|
mock_popen.return_value = mock_subproc
|
||||||
|
|
|
@ -172,7 +172,7 @@ class HookDockerCmdTest(common.RunScriptTest):
|
||||||
'Creating web...\n'
|
'Creating web...\n'
|
||||||
'one.txt\ntwo.txt\nthree.txt',
|
'one.txt\ntwo.txt\nthree.txt',
|
||||||
'deploy_status_code': 0
|
'deploy_status_code': 0
|
||||||
}, json.loads(stdout))
|
}, json.loads(stdout.decode('utf-8')))
|
||||||
|
|
||||||
state = list(self.json_from_files(self.test_state_path, 9))
|
state = list(self.json_from_files(self.test_state_path, 9))
|
||||||
self.assertEqual([
|
self.assertEqual([
|
||||||
|
@ -308,7 +308,7 @@ class HookDockerCmdTest(common.RunScriptTest):
|
||||||
'deploy_stdout': '',
|
'deploy_stdout': '',
|
||||||
'deploy_stderr': 'Warning: custom exit code',
|
'deploy_stderr': 'Warning: custom exit code',
|
||||||
'deploy_status_code': 0
|
'deploy_status_code': 0
|
||||||
}, json.loads(stdout))
|
}, json.loads(stdout.decode('utf-8')))
|
||||||
|
|
||||||
state = list(self.json_from_files(self.test_state_path, 5))
|
state = list(self.json_from_files(self.test_state_path, 5))
|
||||||
self.assertEqual([
|
self.assertEqual([
|
||||||
|
@ -398,7 +398,7 @@ class HookDockerCmdTest(common.RunScriptTest):
|
||||||
'Creating web...\n'
|
'Creating web...\n'
|
||||||
'No such file or directory',
|
'No such file or directory',
|
||||||
'deploy_status_code': 2
|
'deploy_status_code': 2
|
||||||
}, json.loads(stdout))
|
}, json.loads(stdout.decode('utf-8')))
|
||||||
|
|
||||||
state = list(self.json_from_files(self.test_state_path, 9))
|
state = list(self.json_from_files(self.test_state_path, 9))
|
||||||
self.assertEqual([
|
self.assertEqual([
|
||||||
|
@ -552,7 +552,7 @@ class HookDockerCmdTest(common.RunScriptTest):
|
||||||
'Creating web...\n'
|
'Creating web...\n'
|
||||||
'one.txt\ntwo.txt\nthree.txt',
|
'one.txt\ntwo.txt\nthree.txt',
|
||||||
'deploy_status_code': 0
|
'deploy_status_code': 0
|
||||||
}, json.loads(stdout))
|
}, json.loads(stdout.decode('utf-8')))
|
||||||
|
|
||||||
state = list(self.json_from_files(self.test_state_path, 11))
|
state = list(self.json_from_files(self.test_state_path, 11))
|
||||||
db_container_name = state[4]['args'][4]
|
db_container_name = state[4]['args'][4]
|
||||||
|
@ -691,7 +691,8 @@ class HookDockerCmdTest(common.RunScriptTest):
|
||||||
}])
|
}])
|
||||||
})
|
})
|
||||||
conf_dir = self.useFixture(fixtures.TempDir()).join()
|
conf_dir = self.useFixture(fixtures.TempDir()).join()
|
||||||
with tempfile.NamedTemporaryFile(dir=conf_dir, delete=False) as f:
|
with tempfile.NamedTemporaryFile(dir=conf_dir, delete=False,
|
||||||
|
mode='w') as f:
|
||||||
f.write(json.dumps([self.data]))
|
f.write(json.dumps([self.data]))
|
||||||
f.flush()
|
f.flush()
|
||||||
self.env['HEAT_SHELL_CONFIG'] = f.name
|
self.env['HEAT_SHELL_CONFIG'] = f.name
|
||||||
|
@ -740,7 +741,8 @@ class HookDockerCmdTest(common.RunScriptTest):
|
||||||
})
|
})
|
||||||
|
|
||||||
# run again with empty config data
|
# run again with empty config data
|
||||||
with tempfile.NamedTemporaryFile(dir=conf_dir, delete=False) as f:
|
with tempfile.NamedTemporaryFile(dir=conf_dir, delete=False,
|
||||||
|
mode='w') as f:
|
||||||
f.write(json.dumps([]))
|
f.write(json.dumps([]))
|
||||||
f.flush()
|
f.flush()
|
||||||
self.env['HEAT_SHELL_CONFIG'] = f.name
|
self.env['HEAT_SHELL_CONFIG'] = f.name
|
||||||
|
@ -811,7 +813,8 @@ class HookDockerCmdTest(common.RunScriptTest):
|
||||||
}])
|
}])
|
||||||
})
|
})
|
||||||
conf_dir = self.useFixture(fixtures.TempDir()).join()
|
conf_dir = self.useFixture(fixtures.TempDir()).join()
|
||||||
with tempfile.NamedTemporaryFile(dir=conf_dir, delete=False) as f:
|
with tempfile.NamedTemporaryFile(dir=conf_dir, delete=False,
|
||||||
|
mode='w') as f:
|
||||||
f.write(json.dumps([self.data]))
|
f.write(json.dumps([self.data]))
|
||||||
f.flush()
|
f.flush()
|
||||||
self.env['HEAT_SHELL_CONFIG'] = f.name
|
self.env['HEAT_SHELL_CONFIG'] = f.name
|
||||||
|
@ -862,7 +865,8 @@ class HookDockerCmdTest(common.RunScriptTest):
|
||||||
new_data = copy.deepcopy(self.data)
|
new_data = copy.deepcopy(self.data)
|
||||||
new_data['config']['web']['image'] = 'yyy'
|
new_data['config']['web']['image'] = 'yyy'
|
||||||
new_data['id'] = 'def456'
|
new_data['id'] = 'def456'
|
||||||
with tempfile.NamedTemporaryFile(dir=conf_dir, delete=False) as f:
|
with tempfile.NamedTemporaryFile(dir=conf_dir, delete=False,
|
||||||
|
mode='w') as f:
|
||||||
f.write(json.dumps([new_data]))
|
f.write(json.dumps([new_data]))
|
||||||
f.flush()
|
f.flush()
|
||||||
self.env['HEAT_SHELL_CONFIG'] = f.name
|
self.env['HEAT_SHELL_CONFIG'] = f.name
|
||||||
|
@ -933,7 +937,8 @@ class HookDockerCmdTest(common.RunScriptTest):
|
||||||
}])
|
}])
|
||||||
})
|
})
|
||||||
conf_dir = self.useFixture(fixtures.TempDir()).join()
|
conf_dir = self.useFixture(fixtures.TempDir()).join()
|
||||||
with tempfile.NamedTemporaryFile(dir=conf_dir, delete=False) as f:
|
with tempfile.NamedTemporaryFile(dir=conf_dir, delete=False,
|
||||||
|
mode='w') as f:
|
||||||
f.write(json.dumps([self.data]))
|
f.write(json.dumps([self.data]))
|
||||||
f.flush()
|
f.flush()
|
||||||
self.env['HEAT_SHELL_CONFIG'] = f.name
|
self.env['HEAT_SHELL_CONFIG'] = f.name
|
||||||
|
|
|
@ -107,7 +107,7 @@ class HookDockerComposeTest(common.RunScriptTest):
|
||||||
'deploy_stdout': '',
|
'deploy_stdout': '',
|
||||||
'deploy_stderr': 'Creating abcdef001_db_1...',
|
'deploy_stderr': 'Creating abcdef001_db_1...',
|
||||||
'deploy_status_code': 0
|
'deploy_status_code': 0
|
||||||
}, json.loads(stdout))
|
}, json.loads(stdout.decode('utf-8')))
|
||||||
|
|
||||||
state = self.json_from_file(self.test_state_path)
|
state = self.json_from_file(self.test_state_path)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
|
@ -135,7 +135,7 @@ class HookDockerComposeTest(common.RunScriptTest):
|
||||||
'deploy_stdout': '',
|
'deploy_stdout': '',
|
||||||
'deploy_stderr': 'env_file_not found...',
|
'deploy_stderr': 'env_file_not found...',
|
||||||
'deploy_status_code': 1
|
'deploy_status_code': 1
|
||||||
}, json.loads(stdout))
|
}, json.loads(stdout.decode('utf-8')))
|
||||||
|
|
||||||
state = self.json_from_file(self.test_state_path)
|
state = self.json_from_file(self.test_state_path)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
|
@ -163,7 +163,7 @@ class HookDockerComposeTest(common.RunScriptTest):
|
||||||
'deploy_stdout': '',
|
'deploy_stdout': '',
|
||||||
'deploy_stderr': 'Error: image library/xxx:latest not found',
|
'deploy_stderr': 'Error: image library/xxx:latest not found',
|
||||||
'deploy_status_code': 1
|
'deploy_status_code': 1
|
||||||
}, json.loads(stdout))
|
}, json.loads(stdout.decode('utf-8')))
|
||||||
|
|
||||||
state = self.json_from_file(self.test_state_path)
|
state = self.json_from_file(self.test_state_path)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
|
|
|
@ -93,7 +93,7 @@ class HookPuppetTest(common.RunScriptTest):
|
||||||
'deploy_status_code': 0,
|
'deploy_status_code': 0,
|
||||||
'first_output': 'output 1',
|
'first_output': 'output 1',
|
||||||
'second_output': 'output 2',
|
'second_output': 'output 2',
|
||||||
}, json.loads(stdout))
|
}, json.loads(stdout.decode('utf-8')))
|
||||||
|
|
||||||
state = self.json_from_file(self.test_state_path)
|
state = self.json_from_file(self.test_state_path)
|
||||||
puppet_script = self.working_dir.join('1234.pp')
|
puppet_script = self.working_dir.join('1234.pp')
|
||||||
|
@ -200,7 +200,7 @@ class HookPuppetTest(common.RunScriptTest):
|
||||||
'deploy_stdout': 'puppet failed',
|
'deploy_stdout': 'puppet failed',
|
||||||
'deploy_stderr': 'bad thing happened',
|
'deploy_stderr': 'bad thing happened',
|
||||||
'deploy_status_code': 4,
|
'deploy_status_code': 4,
|
||||||
}, json.loads(stdout))
|
}, json.loads(stdout.decode('utf-8')))
|
||||||
|
|
||||||
state = self.json_from_file(self.test_state_path)
|
state = self.json_from_file(self.test_state_path)
|
||||||
puppet_script = self.working_dir.join('1234.pp')
|
puppet_script = self.working_dir.join('1234.pp')
|
||||||
|
@ -256,7 +256,7 @@ class HookPuppetTest(common.RunScriptTest):
|
||||||
'deploy_status_code': 0,
|
'deploy_status_code': 0,
|
||||||
'first_output': 'output 1',
|
'first_output': 'output 1',
|
||||||
'second_output': 'output 2',
|
'second_output': 'output 2',
|
||||||
}, json.loads(stdout))
|
}, json.loads(stdout.decode('utf-8')))
|
||||||
|
|
||||||
state = self.json_from_file(self.test_state_path)
|
state = self.json_from_file(self.test_state_path)
|
||||||
puppet_script = self.working_dir.join('1234.pp')
|
puppet_script = self.working_dir.join('1234.pp')
|
||||||
|
|
|
@ -97,9 +97,9 @@ class HookSaltTest(common.RunScriptTest):
|
||||||
self.assertIsNone(ret['deploy_stderr'])
|
self.assertIsNone(ret['deploy_stderr'])
|
||||||
self.assertIsNotNone(ret['deploy_stdout'])
|
self.assertIsNotNone(ret['deploy_stdout'])
|
||||||
resp = yaml.safe_load(ret['deploy_stdout'])
|
resp = yaml.safe_load(ret['deploy_stdout'])
|
||||||
self.assertTrue(resp.values()[0]['result'])
|
self.assertTrue(list(resp.values())[0]['result'])
|
||||||
self.assertEqual({'bar': 'foo', 'foo': 'bar'},
|
self.assertEqual({'bar': 'foo', 'foo': 'bar'},
|
||||||
resp.values()[0]['changes'])
|
list(resp.values())[0]['changes'])
|
||||||
|
|
||||||
def test_hook_salt_failed(self):
|
def test_hook_salt_failed(self):
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ class HookSaltTest(common.RunScriptTest):
|
||||||
self.assertEqual(0, returncode)
|
self.assertEqual(0, returncode)
|
||||||
self.assertIsNotNone(stderr)
|
self.assertIsNotNone(stderr)
|
||||||
self.assertIsNotNone(stdout)
|
self.assertIsNotNone(stdout)
|
||||||
jsonout = json.loads(stdout)
|
jsonout = json.loads(stdout.decode('utf-8'))
|
||||||
self.assertIsNone(jsonout.get("deploy_stdout"),
|
self.assertIsNone(jsonout.get("deploy_stdout"),
|
||||||
jsonout.get("deploy_stdout"))
|
jsonout.get("deploy_stdout"))
|
||||||
self.assertEqual(2, jsonout.get("deploy_status_code"))
|
self.assertEqual(2, jsonout.get("deploy_status_code"))
|
||||||
|
@ -128,8 +128,8 @@ class HookSaltTest(common.RunScriptTest):
|
||||||
self.assertEqual(0, returncode, stderr)
|
self.assertEqual(0, returncode, stderr)
|
||||||
self.assertIsNotNone(stdout)
|
self.assertIsNotNone(stdout)
|
||||||
self.assertIsNotNone(stderr)
|
self.assertIsNotNone(stderr)
|
||||||
ret = json.loads(stdout)
|
ret = json.loads(stdout.decode('utf-8'))
|
||||||
self.assertIsNone(ret['deploy_stdout'])
|
self.assertIsNone(ret['deploy_stdout'])
|
||||||
self.assertIsNotNone(ret['deploy_stderr'])
|
self.assertIsNotNone(ret['deploy_stderr'])
|
||||||
resp = yaml.safe_load(ret['deploy_stderr']).values()[0]
|
resp = list(yaml.safe_load(ret['deploy_stderr']).values())[0]
|
||||||
self.assertFalse(resp['result'])
|
self.assertFalse(resp['result'])
|
||||||
|
|
|
@ -84,7 +84,7 @@ class HookScriptTest(common.RunScriptTest):
|
||||||
'deploy_status_code': 0,
|
'deploy_status_code': 0,
|
||||||
'first_output': 'output 1',
|
'first_output': 'output 1',
|
||||||
'second_output': 'output 2',
|
'second_output': 'output 2',
|
||||||
}, json.loads(stdout))
|
}, json.loads(stdout.decode('utf-8')))
|
||||||
|
|
||||||
state = self.json_from_file(self.test_state_path)
|
state = self.json_from_file(self.test_state_path)
|
||||||
script = self.working_dir.join('1234')
|
script = self.working_dir.join('1234')
|
||||||
|
@ -116,7 +116,7 @@ class HookScriptTest(common.RunScriptTest):
|
||||||
'deploy_stdout': 'script failed',
|
'deploy_stdout': 'script failed',
|
||||||
'deploy_stderr': 'bad thing happened',
|
'deploy_stderr': 'bad thing happened',
|
||||||
'deploy_status_code': 1,
|
'deploy_status_code': 1,
|
||||||
}, json.loads(stdout))
|
}, json.loads(stdout.decode('utf-8')))
|
||||||
|
|
||||||
state = self.json_from_file(self.test_state_path)
|
state = self.json_from_file(self.test_state_path)
|
||||||
script = self.working_dir.join('1234')
|
script = self.working_dir.join('1234')
|
||||||
|
|
3
tox.ini
3
tox.ini
|
@ -1,9 +1,10 @@
|
||||||
[tox]
|
[tox]
|
||||||
envlist = py27,pep8
|
envlist = py27,py35,pep8
|
||||||
minversion = 1.6
|
minversion = 1.6
|
||||||
skipsdist = True
|
skipsdist = True
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
|
whitelist_externals = bash
|
||||||
setenv = VIRTUAL_ENV={envdir}
|
setenv = VIRTUAL_ENV={envdir}
|
||||||
deps = -r{toxinidir}/requirements.txt
|
deps = -r{toxinidir}/requirements.txt
|
||||||
-r{toxinidir}/test-requirements.txt
|
-r{toxinidir}/test-requirements.txt
|
||||||
|
|
Loading…
Reference in New Issue