diff --git a/Makefile b/Makefile index 5294db9a..632d7066 100644 --- a/Makefile +++ b/Makefile @@ -46,6 +46,13 @@ swagger-install: # Install swag @test -f $(BINPATH)/swag || GOOS=linux GOARCH=amd64 go install github.com/swaggo/swag/cmd/swag@latest +azurite-start: + azurite & \ + echo $$! > ~/.azurite.pid + +azurite-stop: + kill `cat ~/.azurite.pid` + swagger: swagger-install # Generate swagger docs @PATH=$(BINPATH)/:$(PATH) swag init --markdownFiles docs @@ -160,10 +167,22 @@ docker-deb: ## Build debian packages in docker container @docker run -it --rm -v ${PWD}:/work/src aptly-dev /work/src/system/docker-wrapper dpkg DEBARCH=amd64 docker-unit-test: ## Run unit tests in docker container - @docker run -it --rm -v ${PWD}:/work/src aptly-dev /work/src/system/docker-wrapper test + @docker run -it --rm -v ${PWD}:/work/src aptly-dev /work/src/system/docker-wrapper \ + azurite-start \ + AZURE_STORAGE_ENDPOINT=http://127.0.0.1:10000/devstoreaccount1 \ + AZURE_STORAGE_ACCOUNT=devstoreaccount1 \ + AZURE_STORAGE_ACCESS_KEY="Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==" \ + test \ + azurite-stop docker-system-test: ## Run system tests in docker container (add TEST=t04_mirror or TEST=UpdateMirror26Test to run only specific tests) - @docker run -it --rm -v ${PWD}:/work/src aptly-dev /work/src/system/docker-wrapper system-test TEST=$(TEST) + @docker run -it --rm -v ${PWD}:/work/src aptly-dev /work/src/system/docker-wrapper \ + azurite-start \ + AZURE_STORAGE_ENDPOINT=http://127.0.0.1:10000/devstoreaccount1 \ + AZURE_STORAGE_ACCOUNT=devstoreaccount1 \ + AZURE_STORAGE_ACCESS_KEY="Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==" \ + system-test TEST=$(TEST) \ + azurite-stop docker-serve: ## Run development server (auto recompiling) on http://localhost:3142 @docker run -it --rm -p 3142:3142 -v ${PWD}:/work/src aptly-dev /work/src/system/docker-wrapper serve || true diff --git a/system/Dockerfile b/system/Dockerfile index b2da26e3..f2435244 100644 --- a/system/Dockerfile +++ b/system/Dockerfile @@ -6,7 +6,7 @@ RUN apt-get update -y && apt-get install -y --no-install-recommends curl gnupg b golang/bookworm-backports golang-go/bookworm-backports golang-doc/bookworm-backports golang-src/bookworm-backports \ make git python3 python3-requests-unixsocket python3-termcolor python3-swiftclient python3-boto python3-azure-storage \ g++ python3-etcd3 python3-plyvel graphviz devscripts sudo dh-golang binutils-i686-linux-gnu binutils-aarch64-linux-gnu \ - binutils-arm-linux-gnueabihf bash-completion zip ruby3.1-dev lintian \ + binutils-arm-linux-gnueabihf bash-completion zip ruby3.1-dev lintian npm \ libc6-dev-i386-cross libc6-dev-armhf-cross libc6-dev-arm64-cross \ gcc-i686-linux-gnu gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu && \ apt-get clean && rm -rf /var/lib/apt/lists/* @@ -18,6 +18,7 @@ RUN mkdir /work WORKDIR /work/src RUN chown aptly /work +# install test dependencies RUN cd /var/lib/aptly; git clone https://github.com/aptly-dev/aptly-fixture-db.git RUN cd /var/lib/aptly; git clone https://github.com/aptly-dev/aptly-fixture-pool.git RUN cd /var/lib/aptly; curl -O http://repo.aptly.info/system-tests/etcd.db.xz && xz -d etcd.db.xz @@ -25,3 +26,4 @@ RUN echo "aptly ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/aptly ADD system/t13_etcd/install-etcd.sh /src/ RUN /src/install-etcd.sh RUN rm -rf /src +RUN npm install -g azurite