Commit 3eddcac2 authored by Furkan Mustafa's avatar Furkan Mustafa

Merge branch '320-move-daemon-start-from-dockerfile-to-docker-compose' into 'dev-0.0.9'

Resolve "Remove base image's Beiran daemon start command"

Closes #320

See merge request !61
parents d6988f5e ea075f45
......@@ -228,11 +228,11 @@ test:basic-behavior:
fi
done
- CONTAINER=$(docker-compose ps -q beiran1)
- docker exec ${CONTAINER} python -m beiran node info
- docker exec ${CONTAINER} python -m beiran node list
- docker exec ${CONTAINER} python -m beiran docker image list --all
- docker exec ${CONTAINER} beiran node info
- docker exec ${CONTAINER} beiran node list
- docker exec ${CONTAINER} beiran docker image list --all
# TODO: Check if output has expected images
- docker exec ${CONTAINER} python -m beiran docker layer list --all
- docker exec ${CONTAINER} beiran docker layer list --all
# TODO: Check if output has expected layers!?
test:api:
......@@ -264,7 +264,7 @@ test:api:
- tar c $(find test/rest_api -name "*.yaml") | docker exec -i ${CONTAINER} tar xv -C /opt
# we make beiran download an image from origin, and cache the layers in
# beiran's own cache folder, so we can test it in api
- docker exec ${CONTAINER} python -m beiran docker image pull --wait hello-world@sha256:0add3ace90ecb4adbf7777e9aacf18357296e799f81cabc9fde470971e499788
- docker exec ${CONTAINER} beiran docker image pull --wait hello-world@sha256:0add3ace90ecb4adbf7777e9aacf18357296e799f81cabc9fde470971e499788
- docker exec ${CONTAINER} pyresttest --url http://localhost:8888 --test /opt/test/rest_api/beirand.yaml
test:bats:
......
......@@ -26,11 +26,7 @@ WORKDIR /opt/beiran_interface_k8s
RUN python setup.py install
WORKDIR /opt/beiran
RUN echo 'alias beiran="python -m beiran.cli"\nalias beirand="python -m beiran.daemon"\n' > /root/.bashrc
ENV PYTHONPATH=/opt/beiran:/opt/beiran/plugins:/opt/beiran_package_docker:/opt/beiran_interface_k8s
ENV PYTHONPATH=/opt/beiran:/opt/beiran_package_docker:/opt/beiran_interface_k8s
VOLUME /var/lib/beiran
VOLUME /etc/beiran
CMD [ "python3", "-m", "beiran.daemon" ]
......@@ -22,6 +22,7 @@ services:
volumes_from:
- pod1
network_mode: "service:pod1"
command: ["beiran", "node", "start"]
pod2: *pod_tpl
docker2:
......
......@@ -16,5 +16,3 @@ ADD .pylintrc /opt/pylintrc
ADD test/rest_api/*.yaml /opt/
WORKDIR /opt
ENTRYPOINT [""]
#!/usr/bin/env bats
@test "pulling an image from another node (with '--no-progress' option) exits peacefully" {
run python -m beiran docker image pull alpine --no-progress
run beiran docker image pull alpine --no-progress
[ "$status" -eq 0 ]
}
@test "pulling a non-existing image (with '--no-progress' option) exits with error code" {
run python -m beiran docker image pull a_non_existent_image --no-progress
run beiran docker image pull a_non_existent_image --no-progress
[ "$status" -eq 1 ]
}
@test "pulling an image with docker image manifest v2 schema 1 from origin exists peacefully" {
run python -m beiran docker image pull alpine:2.7
run beiran docker image pull alpine:2.7
[ "$status" -eq 0 ]
}
\ No newline at end of file
#!/usr/bin/env bats
@test "pulling an image from another node (with '--wait' and '--no-progress' options) exits peacefully" {
run python -m beiran docker image pull alpine --wait --no-progress
run beiran docker image pull alpine --wait --no-progress
[ "$status" -eq 0 ]
}
@test "pulling a non-existing image (with '--wait' and '--no-progress' options) exits with error code" {
run python -m beiran docker image pull a_non_existent_image --wait --no-progress
run beiran docker image pull a_non_existent_image --wait --no-progress
[ "$status" -eq 1 ]
}
#!/usr/bin/env bats
@test "pulling an image from another node exits peacefully" {
run python -m beiran docker image pull alpine
run beiran docker image pull alpine
[ "$status" -eq 0 ]
}
@test "pulling a non-existing image exits with error code" {
run python -m beiran docker image pull a_non_existent_image
run beiran docker image pull a_non_existent_image
[ "$status" -eq 1 ]
}
#!/usr/bin/env bats
@test "pulling an image from a specific node (with '--from' option) exits peacefully" {
current_node_uuid="$(python -m beiran.cli node info | tail -1 | awk '{print $2}' | cut -d "#" -f 2)"
another_node_uuid="$(python -m beiran.cli node list | cut -d ' ' -f1 | grep -x '[_[:alnum:]]\{32\}' | sed '1q;d')"
current_node_uuid="$(beiran node info | tail -1 | awk '{print $2}' | cut -d "#" -f 2)"
another_node_uuid="$(beiran node list | cut -d ' ' -f1 | grep -x '[_[:alnum:]]\{32\}' | sed '1q;d')"
if [ "$current_node_uuid" -eq "$another_node_uuid" ]
then
another_node_uuid="$(python -m beiran.cli node list | cut -d ' ' -f1 | grep -x '[_[:alnum:]]\{32\}' | sed '2q;d')"
another_node_uuid="$(beiran node list | cut -d ' ' -f1 | grep -x '[_[:alnum:]]\{32\}' | sed '2q;d')"
fi
run python -m beiran docker image pull alpine --from $another_node_uuid
run beiran docker image pull alpine --from $another_node_uuid
[ "$status" -eq 0 ]
}
@test "pulling a non-existing image from a specific node (with '--from' option) exits with error code" {
current_node_uuid="$(python -m beiran.cli node info | tail -1 | awk '{print $2}' | cut -d "#" -f 2)"
another_node_uuid="$(python -m beiran.cli node list | cut -d ' ' -f1 | grep -x '[_[:alnum:]]\{32\}' | sed '1q;d')"
current_node_uuid="$(beiran node info | tail -1 | awk '{print $2}' | cut -d "#" -f 2)"
another_node_uuid="$(beiran node list | cut -d ' ' -f1 | grep -x '[_[:alnum:]]\{32\}' | sed '1q;d')"
if [ "$current_node_uuid" -eq "$another_node_uuid" ]
then
another_node_uuid="$(python -m beiran.cli node list | cut -d ' ' -f1 | grep -x '[_[:alnum:]]\{32\}' | sed '2q;d')"
another_node_uuid="$(beiran node list | cut -d ' ' -f1 | grep -x '[_[:alnum:]]\{32\}' | sed '2q;d')"
fi
run python -m beiran docker image pull a_non_existent_image --from $another_node_uuid
run beiran docker image pull a_non_existent_image --from $another_node_uuid
[ "$status" -eq 1 ]
}
\ No newline at end of file
#!/usr/bin/env bats
@test "pulling an image from another node (with '--whole-image-only' option) exits peacefully" {
run python -m beiran docker image pull alpine --whole-image-only
run beiran docker image pull alpine --whole-image-only
[ "$status" -eq 0 ]
}
@test "pulling a non-existing image (with '--whole-image-only' option) exits with error code" {
run python -m beiran docker image pull a_non_existent_image --whole-image-only
run beiran docker image pull a_non_existent_image --whole-image-only
[ "$status" -eq 1 ]
}
@test "pulling an image from a specific node (with '--whole-image-only' and '--from' options) exits peacefully" {
current_node_uuid="$(python -m beiran.cli node info | tail -1 | awk '{print $2}' | cut -d "#" -f 2)"
another_node_uuid="$(python -m beiran.cli node list | cut -d ' ' -f1 | grep -x '[_[:alnum:]]\{32\}' | sed '1q;d')"
current_node_uuid="$(beiran node info | tail -1 | awk '{print $2}' | cut -d "#" -f 2)"
another_node_uuid="$(beiran node list | cut -d ' ' -f1 | grep -x '[_[:alnum:]]\{32\}' | sed '1q;d')"
if [ "$current_node_uuid" == "$another_node_uuid" ]
then
another_node_uuid="$(python -m beiran.cli node list | cut -d ' ' -f1 | grep -x '[_[:alnum:]]\{32\}' | sed '2q;d')"
another_node_uuid="$(beiran node list | cut -d ' ' -f1 | grep -x '[_[:alnum:]]\{32\}' | sed '2q;d')"
fi
run python -m beiran docker image pull alpine --whole-image-only --from $another_node_uuid
run beiran docker image pull alpine --whole-image-only --from $another_node_uuid
[ "$status" -eq 0 ]
}
@test "pulling a non-existing image from a specific node (with '--whole-image-only' and '--from' options) exits with error code" {
current_node_uuid="$(python -m beiran.cli node info | tail -1 | awk '{print $2}' | cut -d "#" -f 2)"
another_node_uuid="$(python -m beiran.cli node list | cut -d ' ' -f1 | grep -x '[_[:alnum:]]\{32\}' | sed '1q;d')"
current_node_uuid="$(beiran node info | tail -1 | awk '{print $2}' | cut -d "#" -f 2)"
another_node_uuid="$(beiran node list | cut -d ' ' -f1 | grep -x '[_[:alnum:]]\{32\}' | sed '1q;d')"
if [ "$current_node_uuid" == "$another_node_uuid" ]
then
another_node_uuid="$(python -m beiran.cli node list | cut -d ' ' -f1 | grep -x '[_[:alnum:]]\{32\}' | sed '2q;d')"
another_node_uuid="$(beiran node list | cut -d ' ' -f1 | grep -x '[_[:alnum:]]\{32\}' | sed '2q;d')"
fi
run python -m beiran docker image pull a_non_existent_image --whole-image-only --from $another_node_uuid
run beiran docker image pull a_non_existent_image --whole-image-only --from $another_node_uuid
[ "$status" -eq 1 ]
}
@test "pulling an image with docker image manifest v2 schema 1 from another node exists peacefully" {
run python -m beiran docker image pull alpine:2.7
run beiran docker image pull alpine:2.7
[ "$status" -eq 0 ]
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment