Fix remaining py3 tests
Some tests were manipulating bytes/strings incorrectly, this fixes them. Change-Id: Ib5c109c580f542a9d793fa1a32a7857773afa765
This commit is contained in:
parent
f11031f57f
commit
a1ad716f10
@ -14,6 +14,7 @@ import json
|
|||||||
import os
|
import os
|
||||||
import requests
|
import requests
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import time
|
import time
|
||||||
import yaml
|
import yaml
|
||||||
@ -211,26 +212,28 @@ queue_id = %(queue_id)s
|
|||||||
config = metadata['os-collect-config']['zaqar']
|
config = metadata['os-collect-config']['zaqar']
|
||||||
conf_content = self.conf_template % config
|
conf_content = self.conf_template % config
|
||||||
fd, temp_path = tempfile.mkstemp()
|
fd, temp_path = tempfile.mkstemp()
|
||||||
os.write(fd, conf_content)
|
os.write(fd, conf_content.encode('utf-8'))
|
||||||
os.close(fd)
|
os.close(fd)
|
||||||
cmd = ['os-collect-config', '--one-time',
|
cmd = ['os-collect-config', '--one-time',
|
||||||
'--config-file=%s' % temp_path, 'zaqar']
|
'--config-file=%s' % temp_path, 'zaqar']
|
||||||
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
||||||
stdout_value = proc.communicate()[0]
|
stdout_value = proc.communicate()[0]
|
||||||
data = json.loads(stdout_value)
|
data = json.loads(stdout_value.decode('utf-8'))
|
||||||
self.assertEqual(config, data['zaqar']['os-collect-config']['zaqar'])
|
self.assertEqual(config, data['zaqar']['os-collect-config']['zaqar'])
|
||||||
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
||||||
stdout_value = proc.communicate()[0]
|
stdout_value = proc.communicate()[0]
|
||||||
data = json.loads(stdout_value)
|
data = json.loads(stdout_value.decode('utf-8'))
|
||||||
|
|
||||||
fd, temp_path = tempfile.mkstemp()
|
fd, temp_path = tempfile.mkstemp()
|
||||||
os.write(fd, json.dumps(data['zaqar']['deployments'][0]))
|
os.write(fd,
|
||||||
|
json.dumps(data['zaqar']['deployments'][0]).encode('utf-8'))
|
||||||
os.close(fd)
|
os.close(fd)
|
||||||
cmd = ['python', self.conf.heat_config_notify_script, temp_path]
|
cmd = [sys.executable, self.conf.heat_config_notify_script, temp_path]
|
||||||
proc = subprocess.Popen(cmd,
|
proc = subprocess.Popen(cmd,
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
stdin=subprocess.PIPE)
|
stdin=subprocess.PIPE)
|
||||||
proc.communicate(json.dumps({'deploy_stdout': 'here!'}))
|
proc.communicate(
|
||||||
|
json.dumps({'deploy_stdout': 'here!'}).encode('utf-8'))
|
||||||
self._wait_for_stack_status(stack_identifier, 'CREATE_COMPLETE')
|
self._wait_for_stack_status(stack_identifier, 'CREATE_COMPLETE')
|
||||||
stack = self.client.stacks.get(stack_identifier)
|
stack = self.client.stacks.get(stack_identifier)
|
||||||
self.assertEqual('here!', stack.outputs[0]['output_value'])
|
self.assertEqual('here!', stack.outputs[0]['output_value'])
|
||||||
|
Loading…
Reference in New Issue
Block a user