Skip to content

Commit

Permalink
Merge pull request #18 from Yelp/PAASTA-1472
Browse files Browse the repository at this point in the history
Fix more tests to work on a non yelp dev box
  • Loading branch information
solarkennedy committed Nov 4, 2015
2 parents 120767b + ac4cda2 commit 8c041f4
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 9 deletions.
2 changes: 1 addition & 1 deletion general_itests/fake_simple_service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM docker-dev.yelpcorp.com/trusty_yelp
FROM ubuntu:trusty
2 changes: 1 addition & 1 deletion general_itests/paasta_execute_docker_command.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ Feature: paasta_execute_docker_command can find and run commands inside a docker
Given a running docker container with task id foo
When we paasta_execute_docker_command a command with exit code 0 in container with task id foo
And we paasta_execute_docker_command a command with exit code 0 in container with task id foo
Then the docker container has 1 exec instances
Then the docker container has at most 1 exec instances
13 changes: 10 additions & 3 deletions general_itests/steps/paasta_execute_docker_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def create_docker_container(context, task_id):
pass
container = docker_client.create_container(
name=container_name,
image='docker-dev.yelpcorp.com/trusty_yelp:latest',
image='ubuntu:trusty',
command='/bin/sleep infinity',
environment={'MESOS_TASK_ID': task_id},
)
Expand All @@ -57,8 +57,15 @@ def paasta_execute_docker_command_result(context, code):
assert int(code) == int(context.return_code)


@then(u'the docker container has {num} exec instances')
@then(u'the docker container has at most {num} exec instances')
def check_container_exec_instances(context, num):
"""Modern docker versions remove ExecIDs after they finished, but older
docker versions leave ExecIDs behind. This test is for assering that
the ExecIDs are cleaned up one way or another"""
container_info = context.docker_client.inspect_container(context.running_container_id)
if container_info['ExecIDs'] is None:
execs = []
else:
execs = container_info['ExecIDs']
print 'Container info:\n%s' % container_info
assert len(container_info['ExecIDs']) == int(num)
assert len(execs) <= int(num)
2 changes: 1 addition & 1 deletion paasta_itests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ marathon:
command: 'marathon --zk zk://zookeeper:2181/marathon --master zk://zookeeper:2181/mesos-testcluster --no-logger'

paastatools:
build: ../yelp_package/dockerfiles/lucid/
build: ../yelp_package/dockerfiles/trusty/
links:
- marathon
- mesosmaster
Expand Down
12 changes: 10 additions & 2 deletions paasta_tools/monitoring_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
Everything in here is private, and you shouldn't worry about it.
"""
import json
import logging
import os

import service_configuration_lib
Expand All @@ -30,6 +31,9 @@
from utils import load_system_paasta_config


log = logging.getLogger('__main__')


def get_team(overrides, service, soa_dir=service_configuration_lib.DEFAULT_SOA_DIR):
return __get_monitoring_config_value('team', overrides, service, soa_dir)

Expand Down Expand Up @@ -134,8 +138,12 @@ def get_sensu_team_data(team):


def _load_sensu_team_data():
with open('/etc/sensu/team_data.json') as f:
team_data = json.load(f)
try:
with open('/etc/sensu/team_data.json') as f:
team_data = json.load(f)
except IOError:
log.warning("No Sensu Team data (/etc/sensu/team_data.json) available. Using empty defaults")
team_data = {}
return team_data


Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ setenv =
DOCKER_COMPOSE_PROJECT_NAME = paastatools_inside_container
changedir=paasta_itests/
deps =
{[testenv]deps}
behave
mock
-r/work/requirements.txt
commands =
behave {posargs}

Expand Down
2 changes: 2 additions & 0 deletions yelp_package/dockerfiles/trusty/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ RUN apt-get update && apt-get -y install dpkg-dev python-tox python-setuptools \
RUN curl http://ppa.launchpad.net/dh-virtualenv/daily/ubuntu/pool/main/d/dh-virtualenv/dh-virtualenv_0.10-0~80~ubuntu14.04.1_all.deb --output dh-virtualenv_0.10-0~80~ubuntu14.04.1_all.deb && \
dpkg -i dh-virtualenv_0.10-0~80~ubuntu14.04.1_all.deb && rm dh-virtualenv_0.10-0~80~ubuntu14.04.1_all.deb

ENV HOME /work
ENV PWD /work
WORKDIR /work

0 comments on commit 8c041f4

Please sign in to comment.