Skip to content

Commit

Permalink
Makefile test-in-container now use minikube, kubernetes version compa…
Browse files Browse the repository at this point in the history
…tible with python client, remove pytest xfail from k8s tests
  • Loading branch information
rpitonak committed Jul 6, 2018
1 parent 180b5ed commit 249f905
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
7 changes: 2 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,10 @@ test: build-test-container test-in-container test-doc-examples
centos-ci-test: install-test-requirements build-test-container test-in-container

test-in-container:
@# use it like this: `make test-in-container TEST_TARGET=tests/integration/test_utils.py`k
docker run --net=host --rm -v /dev:/dev:ro -v /var/lib/docker:/var/lib/docker:ro --security-opt label=disable --cap-add SYS_ADMIN -e KUBECONFIG=/var/lib/origin/openshift.local.config/master/admin.kubeconfig -v /var/lib/origin/openshift.local.config/master/admin.kubeconfig:/var/lib/origin/openshift.local.config/master/admin.kubeconfig -ti -v /var/run/docker.sock:/var/run/docker.sock -v $(CURDIR):/src -v $(CURDIR)/pytest-container.ini:/src/pytest.ini $(TEST_IMAGE_NAME) /bin/bash -c "oc login 127.0.0.1:8443 -u system:admin --config=/var/lib/origin/openshift.local.config/master/admin.kubeconfig --insecure-skip-tls-verify && make exec-test TEST_TARGET=$(TEST_TARGET)"

test-k8s-minikube: build-test-container
@# use it like this: `make test-in-container TEST_TARGET=tests/integration/test_utils.py`
$(eval kubedir := $(shell mktemp -d /tmp/tmp.conu-kube-XXXXX))
sed -e s#"${HOME}"#/root#g ${HOME}/.kube/config > $(kubedir)/config
docker run --net=host --rm -v /dev:/dev:ro -v /var/lib/docker:/var/lib/docker:ro --security-opt label=disable --cap-add SYS_ADMIN -ti -v /var/run/docker.sock:/var/run/docker.sock -v $(CURDIR):/src -v $(CURDIR)/pytest-container.ini:/src/pytest.ini -v ${HOME}/.minikube:/root/.minikube -v $(kubedir):/root/.kube $(TEST_IMAGE_NAME) make exec-test TEST_TARGET=tests/integration/test_k8s.py
docker run --net=host --rm -v /dev:/dev:ro -v /var/lib/docker:/var/lib/docker:ro --security-opt label=disable --cap-add SYS_ADMIN -ti -v /var/run/docker.sock:/var/run/docker.sock -v $(CURDIR):/src -v $(CURDIR)/pytest-container.ini:/src/pytest.ini -v ${HOME}/.minikube:/root/.minikube -v $(kubedir):/root/.kube $(TEST_IMAGE_NAME) make exec-test

test-in-vm:
vagrant up --provision
Expand Down
4 changes: 2 additions & 2 deletions test-requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fi
setenforce 0
systemctl start docker
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x minikube
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.10.0/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.10.0/bin/linux/amd64/kubectl && chmod +x kubectl && mv kubectl /usr/local/bin/


export MINIKUBE_WANTUPDATENOTIFICATION=false
Expand All @@ -26,4 +26,4 @@ mkdir -p $HOME/.kube
touch $HOME/.kube/config

export KUBECONFIG=$HOME/.kube/config
./minikube start --vm-driver=none --extra-config=apiserver.admission-control="" --extra-config=kubelet.cgroup-driver=systemd
./minikube start --vm-driver=none --extra-config=apiserver.admission-control="" --extra-config=kubelet.cgroup-driver=systemd --kubernetes-version=v1.10.0
6 changes: 0 additions & 6 deletions tests/integration/test_k8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
Tests for Kubernetes backend
"""

import pytest

from conu import DockerBackend
from conu.backend.k8s.backend import K8sBackend
from conu.backend.k8s.pod import PodPhase
Expand All @@ -32,7 +30,6 @@
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)


@pytest.mark.xfail
def test_pod():
with K8sBackend() as k8s_backend:

Expand All @@ -52,7 +49,6 @@ def test_pod():
k8s_backend.delete_namespace(namespace)


@pytest.mark.xfail
def test_database_deployment():
with K8sBackend() as k8s_backend:

Expand Down Expand Up @@ -90,7 +86,6 @@ def test_database_deployment():
k8s_backend.delete_namespace(namespace)


@pytest.mark.xfail
def test_list_pods():
with K8sBackend() as k8s_backend:

Expand Down Expand Up @@ -127,7 +122,6 @@ def test_list_services():
k8s_backend.delete_namespace(namespace)


@pytest.mark.xfail
def test_list_deployments():
with K8sBackend() as k8s_backend:

Expand Down

0 comments on commit 249f905

Please sign in to comment.