diff --git a/.travis.yml b/.travis.yml index 6e71156..9632b79 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index a4b2702..e8d5ba0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/talker_agent/Dockerfile b/talker_agent/Dockerfile index a93aa7e..027048c 100644 --- a/talker_agent/Dockerfile +++ b/talker_agent/Dockerfile @@ -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 diff --git a/talker_agent/talker.py b/talker_agent/talker.py index 580e1da..189376b 100644 --- a/talker_agent/talker.py +++ b/talker_agent/talker.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/local/bin/python3 """ @@ -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 diff --git a/tests/integration/test_sanity.py b/tests/integration/test_sanity.py index 112939d..7378c2c 100644 --- a/tests/integration/test_sanity.py +++ b/tests/integration/test_sanity.py @@ -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 @@ -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()