diff options
author | Devaev Maxim <[email protected]> | 2019-02-10 19:10:38 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2019-02-10 19:10:38 +0300 |
commit | c8cdcaf51259388a2a476337e78e9bd7fbec8fcb (patch) | |
tree | cbaf82ef7d20b0809528cd0f722273ea8e8a8210 | |
parent | d2a6fa78c7a48b094f4d5a76a601da183d39dec8 (diff) |
improved testenv
-rw-r--r-- | .dockerignore | 3 | ||||
-rw-r--r-- | Makefile | 66 |
2 files changed, 38 insertions, 31 deletions
diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..3aeb85cc --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +/testenv/.tox/ +/testenv/.mypy_cache/ +/.git/ @@ -2,18 +2,7 @@ TESTENV_IMAGE ?= kvmd-testenv TESTENV_HID ?= /dev/ttyS10 TESTENV_VIDEO ?= /dev/video0 TESTENV_LOOP ?= /dev/loop7 -TESTENV_CMD ?= /bin/bash -c " \ - (socat PTY,link=$(TESTENV_HID) PTY,link=/dev/ttyS11 &) \ - && cp -r /usr/share/kvmd/configs.default/nginx/* /etc/nginx \ - && cp /usr/share/kvmd/configs.default/kvmd/*.yaml /etc/kvmd \ - && cp /usr/share/kvmd/configs.default/kvmd/htpasswd /etc/kvmd \ - && cp /testenv/kvmd.yaml /etc/kvmd \ - && nginx -c /etc/nginx/nginx.conf \ - && ln -s $(TESTENV_VIDEO) /dev/kvmd-video \ - && (losetup -d /dev/kvmd-msd || true) \ - && losetup /dev/kvmd-msd /root/loop.img \ - && python -m kvmd.apps.kvmd \ - " +TESTENV_CMD ?= /bin/bash # ===== @@ -27,29 +16,16 @@ tox: _testenv -it $(TESTENV_IMAGE) bash -c "cd kvmd && tox -c testenv/tox.ini" -run: _testenv - sudo modprobe loop - - docker run --rm \ - --volume `pwd`/kvmd:/kvmd:ro \ - --volume `pwd`/web:/usr/share/kvmd/web:ro \ - --volume `pwd`/extras:/usr/share/kvmd/extras:ro \ - --volume `pwd`/configs:/usr/share/kvmd/configs.default:ro \ - --volume `pwd`/testenv:/testenv:ro \ - --device $(TESTENV_LOOP):/dev/kvmd-msd \ - --device $(TESTENV_VIDEO):$(TESTENV_VIDEO) \ - --publish 8080:80/tcp \ - --publish 8081:8081/tcp \ - --publish 8082:8082/tcp \ - -it $(TESTENV_IMAGE) $(TESTENV_CMD) - - docker run --rm --device=$(TESTENV_LOOP):/dev/kvmd-msd -it $(TESTENV_IMAGE) losetup -d /dev/kvmd-msd - - +run: + make _run TESTENV_CMD="python -m kvmd.apps.kvmd" run-no-cache: - make run TESTENV_OPTS=--no-cache + make _run TESTENV_CMD="python -m kvmd.apps.kvmd" TESTENV_OPTS=--no-cache shell: - make run TESTENV_CMD=/bin/bash + make _run +shell-no-cache: + make _run TESTENV_OPTS=--no-cache regen: @@ -89,3 +65,31 @@ clean-all: _testenv clean _testenv: docker build $(TESTENV_OPTS) --rm --tag $(TESTENV_IMAGE) -f testenv/Dockerfile . + + +_run: _testenv + sudo modprobe loop + - docker run --rm \ + --volume `pwd`/kvmd:/kvmd:ro \ + --volume `pwd`/web:/usr/share/kvmd/web:ro \ + --volume `pwd`/extras:/usr/share/kvmd/extras:ro \ + --volume `pwd`/configs:/usr/share/kvmd/configs.default:ro \ + --volume `pwd`/testenv:/testenv:ro \ + --device $(TESTENV_LOOP):/dev/kvmd-msd \ + --device $(TESTENV_VIDEO):$(TESTENV_VIDEO) \ + --publish 8080:80/tcp \ + --publish 8081:8081/tcp \ + --publish 8082:8082/tcp \ + -it $(TESTENV_IMAGE) /bin/bash -c " \ + (socat PTY,link=$(TESTENV_HID) PTY,link=/dev/ttyS11 &) \ + && cp -r /usr/share/kvmd/configs.default/nginx/* /etc/nginx \ + && cp /usr/share/kvmd/configs.default/kvmd/*.yaml /etc/kvmd \ + && cp /usr/share/kvmd/configs.default/kvmd/htpasswd /etc/kvmd \ + && cp /testenv/kvmd.yaml /etc/kvmd \ + && nginx -c /etc/nginx/nginx.conf \ + && ln -s $(TESTENV_VIDEO) /dev/kvmd-video \ + && (losetup -d /dev/kvmd-msd || true) \ + && losetup /dev/kvmd-msd /root/loop.img \ + && $(TESTENV_CMD) \ + " + - docker run --rm --device=$(TESTENV_LOOP):/dev/kvmd-msd -it $(TESTENV_IMAGE) losetup -d /dev/kvmd-msd |