Skip to content

Commit

Permalink
Add acceptance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joschi committed Jan 26, 2025
1 parent 51684b8 commit 29a4679
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .data/Dockerfile.minimal
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM scratch
COPY README.md /README.md
Binary file added .data/test-estargz-image.tar
Binary file not shown.
Binary file added .data/test-gzip-image.tar
Binary file not shown.
Binary file added .data/test-oci-estargz-image.tar
Binary file not shown.
Binary file added .data/test-oci-gzip-image.tar
Binary file not shown.
Binary file added .data/test-oci-uncompressed-image.tar
Binary file not shown.
Binary file added .data/test-oci-zstd-image.tar
Binary file not shown.
Binary file added .data/test-uncompressed-image.tar
Binary file not shown.
Binary file added .data/test-zstd-image.tar
Binary file not shown.
43 changes: 39 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,34 @@ bootstrap: bootstrap-go bootstrap-tools ## Download and install all go dependenc

.PHONY: generate-test-data
generate-test-data:
docker build -t dive-test:latest -f .data/Dockerfile.test-image . && docker image save -o .data/test-docker-image.tar dive-test:latest && echo 'Exported test data!'
docker build -t dive-test:latest -f .data/Dockerfile.test-image . && \
docker image save -o .data/test-docker-image.tar dive-test:latest && \
echo 'Exported test data!'

.PHONY: generate-compressed-test-images
generate-compressed-test-images:
for alg in uncompressed gzip estargz zstd; do \
for exporter in docker image; do \
docker buildx build \
-f .data/Dockerfile.minimal \
--tag test-dive-$${exporter}:$${alg} \
--output type=$${exporter},force-compression=true,compression=$${alg} . ; \
done ; \
done && \
echo 'Exported test data!'

.PHONY: generate-compressed-test-data
generate-compressed-test-data:
for alg in uncompressed gzip estargz zstd; \
do \
docker buildx build \
-f .data/Dockerfile.minimal \
--output type=tar,dest=.data/test-$${alg}-image.tar,force-compression=true,compression=$${alg} . ; \
docker buildx build \
-f .data/Dockerfile.minimal \
--output type=oci,dest=.data/test-oci-$${alg}-image.tar,force-compression=true,compression=$${alg} . ; \
done && \
echo 'Exported test data!'


## Static analysis targets #################################
Expand Down Expand Up @@ -227,12 +254,20 @@ ci-test-rpm-package-install:
"

.PHONY: ci-test-linux-run
ci-test-linux-run:
ci-test-linux-run: generate-compressed-test-images
ls -la $(SNAPSHOT_DIR)
ls -la $(SNAPSHOT_DIR)/dive_linux_amd64_v1
chmod 755 $(SNAPSHOT_DIR)/dive_linux_amd64_v1/dive && \
$(SNAPSHOT_DIR)/dive_linux_amd64_v1/dive '${TEST_IMAGE}' --ci && \
$(SNAPSHOT_DIR)/dive_linux_amd64_v1/dive --source docker-archive .data/test-kaniko-image.tar --ci --ci-config .data/.dive-ci
$(SNAPSHOT_DIR)/dive_linux_amd64_v1/dive '${TEST_IMAGE}' --ci && \
$(SNAPSHOT_DIR)/dive_linux_amd64_v1/dive --source docker-archive .data/test-kaniko-image.tar --ci --ci-config .data/.dive-ci
for alg in uncompressed gzip estargz zstd; \
do \
for exporter in docker image; \
do \
$(SNAPSHOT_DIR)/dive_linux_amd64_v1/dive "test-dive-$${exporter}:$${alg}" --ci && \
done; \
$(SNAPSHOT_DIR)/dive_linux_amd64_v1/dive --source docker-archive .data/test-oci-$${alg}-image.tar --ci --ci-config .data/.dive-ci; \
done

# we're not attempting to test docker, just our ability to run on these systems. This avoids setting up docker in CI.
.PHONY: ci-test-mac-run
Expand Down

0 comments on commit 29a4679

Please sign in to comment.