Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

talker.agent: run agent with python3 #57

Merged
merged 3 commits into from
Nov 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ matrix:
env:
- TEST_SUITE="tests/uts/test_client.py"
- stage: agent unit tests
python: 2.7
python: 3.5
env:
- TEST_SUITE="tests/uts/test_agent.py"
- stage: integration tests
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Changed
- upgrade agent to run with python3

## [1.8.6] - 2019-11-05
### Added
Expand Down
2 changes: 1 addition & 1 deletion talker_agent/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:2.7-slim-buster
FROM python:3.5-slim-buster

#args from docker-compose.yaml
ARG TALKER_AGENT_VERSION
Expand Down
4 changes: 2 additions & 2 deletions talker_agent/talker.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/local/bin/python3


"""
Expand Down Expand Up @@ -304,7 +304,7 @@ def start(self):
time.sleep(random.random() * 2)
continue

self.stderr.chunks.append(e.strerror)
self.stderr.chunks.append(e.strerror.encode('utf-8'))
self.set_result(e.errno)
self.finalize()
return
Expand Down
7 changes: 6 additions & 1 deletion tests/integration/test_sanity.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import unittest

from talker_agent.talker import Config
from talker.errors import CommandAbortedByOverflow
from talker.errors import CommandAbortedByOverflow, CommandExecutionError
from tests.utils import get_talker_client, get_retcode, get_stdout


Expand Down Expand Up @@ -38,3 +38,8 @@ def test_max_output_per_channel_set(self):
if expected_ret == 0:
res = get_stdout(self.client.redis, cmd.job_id)
self.assertEqual(res, val)

def test_bad_command(self):
cmd = self.client.run(self.host_id, 'foo')
with self.assertRaises(CommandExecutionError):
cmd.result()