Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Commit

Permalink
fix: cleaning tests (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
obdulia-losantos authored Sep 13, 2021
1 parent c8ab4c3 commit 768ae0d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 27 deletions.
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@ ENTRYPOINT ["/code/entrypoint.sh"]

COPY ./requirements.txt /code/requirements.txt

ENV VENV_DIR=/var/run/aether/venv
ENV PATH="$VENV_DIR/bin:$PATH"

RUN apt-get update -qq > /dev/null && \
apt-get -qq \
--yes \
--allow-downgrades \
--allow-remove-essential \
--allow-change-held-packages \
install gcc > /dev/null && \
mkdir -p $VENV_DIR && \
python3 -m venv $VENV_DIR && \
pip install -q --upgrade pip && \
pip install -q -r requirements.txt

Expand Down
14 changes: 7 additions & 7 deletions aet/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def to_json(self):
doc='''
GET / POST
Retrieve an instance of this type.
Requires argument {id}
Requires argument {id}.
'''
),
'CREATE': MethodDesc(
Expand All @@ -76,33 +76,33 @@ def to_json(self):
doc='''
POST (json)
Create a new instance of this type.
Requires the Resource Definition for the new instance as json body
Requires the Resource Definition for the new instance as json body.
'''
),
'DELETE': MethodDesc(
method='delete',
signature='id:str',
doc='''
GET / POST
Delete and instance of this type
Requires argument {id}
Delete an instance of this type.
Requires argument {id}.
'''
),
'LIST': MethodDesc(
method='list',
signature='()',
doc='''
GET
List existing instance of this type
List existing instance of this type.
'''
),
'VALIDATE': MethodDesc(
method='validate',
signature='json_body: ResourceDefinition',
doc='''
POST
Validate a ResourceDefinition against the type schema
Requires the Resource Definition for the new instance as json body
Validate a ResourceDefinition against the type schema.
Requires the Resource Definition for the instance as json body.
'''
)
}
Expand Down
15 changes: 2 additions & 13 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@ services:
# ---------------------------------

zookeeper-test:
image: confluentinc/cp-zookeeper:5.5.3
image: confluentinc/cp-zookeeper:latest
environment:
ZOOKEEPER_CLIENT_PORT: 32181
ZOOKEEPER_TICK_TIME: 2000
extra_hosts:
- moby:127.0.0.1

kafka-test:
image: confluentinc/cp-kafka:5.5.3
image: confluentinc/cp-kafka:latest
links:
- zookeeper-test
environment:
Expand All @@ -24,15 +22,6 @@ services:
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka-test:29092
ADVERTISED_HOST_NAME: kafka-test
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_URL: ${KAFKA_URL}
SECURITY.PROTOCOL: ${KAFKA_SECURITY}
SASL.MECHANISM: PLAIN
SASL.USERNAME: ${KAFKA_CONSUMER_USER}
SASL.PASSWORD: ${KAFKA_CONSUMER_PASSWORD}
ports:
- 29092:29092
extra_hosts:
- moby:127.0.0.1

redis-test:
image: redis:alpine
Expand Down
14 changes: 7 additions & 7 deletions scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,30 @@ set -Eeuo pipefail

function kill_all () {
echo "_________________________________________________ Killing Containers"
docker-compose down -v
docker-compose down -v > /dev/null
}

trap 'kill_all' EXIT

MODE=test
SCAFFOLD=True
SCAFFOLD=t

if [[ "${1:-}" == "integration" ]]; then
MODE=test_integration
SCAFFOLD=True
SCAFFOLD=t

elif [[ "${1:-}" == "unit" ]]; then
MODE=test_unit
SCAFFOLD=False
SCAFFOLD=f

elif [[ "${1:-}" == "lint" ]]; then
MODE=test_lint
SCAFFOLD=False
SCAFFOLD=f
fi

kill_all
if [[ $SCAFFOLD == True ]]
then

if [[ $SCAFFOLD == t ]]; then
echo "_________________________________________________ Starting Kafka"
docker-compose up -d zookeeper-test kafka-test
fi
Expand Down

0 comments on commit 768ae0d

Please sign in to comment.