Skip to content

Commit

Permalink
Get test running to finish
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanCoding committed Oct 7, 2020
1 parent 37bb420 commit 22be6c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
4 changes: 2 additions & 2 deletions ansible_runner/streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,10 @@ def event_callback(self, event_data):
def artifacts_callback(self, artifacts_data):
buf = io.BytesIO(artifacts_data)
with zipfile.ZipFile(buf, 'r') as archive:
archive.extractall(path=self.config.artifact_dir)
archive.extractall(path=self.artifact_dir)

if self.artifacts_handler is not None:
self.artifacts_handler(self.config.artifact_dir)
self.artifacts_handler(self.artifact_dir)

def run(self):
job_events_path = os.path.join(self.artifact_dir, 'job_events')
Expand Down
11 changes: 2 additions & 9 deletions test/integration/test_transmit_worker_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@
from ansible_runner.streaming import Transmitter, Worker, Processor


def peek_contents(buffer):
pos = buffer.tell()
content = buffer.read()
buffer.seek(pos)
return content


def test_remote_job_interface(tmpdir, test_data_dir):
worker_dir = str(tmpdir.mkdir('for_worker'))
process_dir = str(tmpdir.mkdir('for_process'))
Expand All @@ -35,7 +28,7 @@ def test_remote_job_interface(tmpdir, test_data_dir):

outgoing_buffer.seek(0) # rewind so we can start reading

sent = peek_contents(outgoing_buffer)
sent = outgoing_buffer.getvalue()
assert sent # should not be blank at least
assert b'zipfile' in sent

Expand All @@ -58,4 +51,4 @@ def test_remote_job_interface(tmpdir, test_data_dir):
)
processor.run()

assert os.listdir(process_dir) == ['project', 'artifacts'], outgoing_buffer.getvalue()
assert set(os.listdir(process_dir)) == set(['artifacts']), outgoing_buffer.getvalue()

0 comments on commit 22be6c0

Please sign in to comment.