Skip to content

Commit

Permalink
chore(tests): Avoid sharing target with host system for integration t…
Browse files Browse the repository at this point in the history
…ests (vectordotdev#12977)

This was causing issues as the integration tests run as `root` in Docker
and polluted the target directory of the host system so that subsequent
`cargo` operations on the host would fail due to file permissions.

I briefly went down the path of trying to continue to share the
directory and set the uid/gid appropriately but this turned out to be
non-trivial. I think having a separate volume shared by the integration
tests for `target/` seems sensible.

Also sped up the building of the integration container a bit by
installing the prebuilt `cargo nextest` binary rather than building it.

Signed-off-by: Jesse Szwedko <[email protected]>
  • Loading branch information
jszwedko authored Jun 3, 2022
1 parent 45fe005 commit d88b414
Show file tree
Hide file tree
Showing 29 changed files with 58 additions and 4 deletions.
1 change: 0 additions & 1 deletion .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ jobs:
env:
SPLUNK_VERSION: 7.3.9
- test: 'splunk'
- test: 'shutdown'
steps:
- uses: actions/checkout@v3
- run: make ci-sweep
Expand Down
3 changes: 2 additions & 1 deletion scripts/integration/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ FROM docker.io/rust:${RUST_VERSION}-slim-bullseye
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
cmake \
curl \
g++ \
libclang1-9 \
libsasl2-dev \
Expand All @@ -13,4 +14,4 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*

RUN rustup run "${RUST_VERSION}" cargo install cargo-nextest --version 0.9.8
RUN curl -LsSf https://get.nexte.st/0.9/linux | tar zxf - -C /usr/local/bin
2 changes: 2 additions & 0 deletions scripts/integration/docker-compose.aws.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,14 @@ services:
- backend
volumes:
- ${PWD}:/code
- target:/code/target
- cargogit:/usr/local/cargo/git
- cargoregistry:/usr/local/cargo/registry

networks:
backend: {}

volumes:
target: {}
cargogit: {}
cargoregistry: {}
2 changes: 2 additions & 0 deletions scripts/integration/docker-compose.azure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ services:
- local-azure-blob
volumes:
- ${PWD}:/code
- target:/code/target
- cargogit:/usr/local/cargo/git
- cargoregistry:/usr/local/cargo/registry

volumes:
target: {}
cargogit: {}
cargoregistry: {}
2 changes: 2 additions & 0 deletions scripts/integration/docker-compose.clickhouse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ services:
- clickhouse
volumes:
- ${PWD}:/code
- target:/code/target
- cargogit:/usr/local/cargo/git
- cargoregistry:/usr/local/cargo/registry

volumes:
target: {}
cargogit: {}
cargoregistry: {}
2 changes: 2 additions & 0 deletions scripts/integration/docker-compose.datadog-agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,14 @@ services:
- datadog-trace-agent
volumes:
- ${PWD}:/code
- target:/code/target
- cargogit:/usr/local/cargo/git
- cargoregistry:/usr/local/cargo/registry

networks:
backend: {}

volumes:
target: {}
cargogit: {}
cargoregistry: {}
2 changes: 2 additions & 0 deletions scripts/integration/docker-compose.datadog-logs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ services:
- TEST_DATADOG_API_KEY
volumes:
- ${PWD}:/code
- target:/code/target
- cargogit:/usr/local/cargo/git
- cargoregistry:/usr/local/cargo/registry

volumes:
target: {}
cargogit: {}
cargoregistry: {}
2 changes: 2 additions & 0 deletions scripts/integration/docker-compose.datadog-metrics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ services:
- TEST_DATADOG_API_KEY
volumes:
- ${PWD}:/code
- target:/code/target
- cargogit:/usr/local/cargo/git
- cargoregistry:/usr/local/cargo/registry

volumes:
target: {}
cargogit: {}
cargoregistry: {}
2 changes: 2 additions & 0 deletions scripts/integration/docker-compose.datadog-traces.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ services:
- TEST_DATADOG_API_KEY
volumes:
- ${PWD}:/code
- target:/code/target
- cargogit:/usr/local/cargo/git
- cargoregistry:/usr/local/cargo/registry

volumes:
target: {}
cargogit: {}
cargoregistry: {}
2 changes: 2 additions & 0 deletions scripts/integration/docker-compose.dnstap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ services:
- RUST_BACKTRACE=1
volumes:
- ${PWD}:/code
- target:/code/target
- /var/run/docker.sock:/var/run/docker.sock
- cargogit:/usr/local/cargo/git
- cargoregistry:/usr/local/cargo/registry
- dnstap-sockets:/run/bind/socket

volumes:
target: {}
cargogit: {}
cargoregistry: {}
dnstap-sockets: {}
2 changes: 2 additions & 0 deletions scripts/integration/docker-compose.docker-logs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ services:
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ${PWD}:/code
- target:/code/target
- cargogit:/usr/local/cargo/git
- cargoregistry:/usr/local/cargo/registry

volumes:
target: {}
cargogit: {}
cargoregistry: {}
2 changes: 2 additions & 0 deletions scripts/integration/docker-compose.elasticsearch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,14 @@ services:
- backend
volumes:
- ${PWD}:/code
- target:/code/target
- cargogit:/usr/local/cargo/git
- cargoregistry:/usr/local/cargo/registry

networks:
backend: {}

volumes:
target: {}
cargogit: {}
cargoregistry: {}
2 changes: 2 additions & 0 deletions scripts/integration/docker-compose.eventstoredb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ services:
- eventstoredb
volumes:
- ${PWD}:/code
- target:/code/target
- cargogit:/usr/local/cargo/git
- cargoregistry:/usr/local/cargo/registry

volumes:
target: {}
cargogit: {}
cargoregistry: {}
2 changes: 2 additions & 0 deletions scripts/integration/docker-compose.fluent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ services:
- "--nocapture"
volumes:
- ${PWD}:/code
- target:/code/target
- /var/run/docker.sock:/var/run/docker.sock
- /tmp:/tmp
- cargogit:/usr/local/cargo/git
- cargoregistry:/usr/local/cargo/registry

volumes:
target: {}
cargogit: {}
cargoregistry: {}
2 changes: 2 additions & 0 deletions scripts/integration/docker-compose.gcp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ services:
- gcloud-pubsub
volumes:
- ${PWD}:/code
- target:/code/target
- cargogit:/usr/local/cargo/git
- cargoregistry:/usr/local/cargo/registry

volumes:
target: {}
cargogit: {}
cargoregistry: {}
6 changes: 4 additions & 2 deletions scripts/integration/docker-compose.humio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ services:
- humio
volumes:
- ${PWD}:/code
- cargogit:/usr/local/cargo/git
- cargoregistry:/usr/local/cargo/registry
- target:/code/target
- cargogit:/cargo/git
- cargoregistry:/cargo/registry

volumes:
target: {}
cargogit: {}
cargoregistry: {}
2 changes: 2 additions & 0 deletions scripts/integration/docker-compose.influxdb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ services:
- INFLUXDB_V2_ADDRESS=http://influxdb-v2:8086
volumes:
- ${PWD}:/code
- target:/code/target
- cargogit:/usr/local/cargo/git
- cargoregistry:/usr/local/cargo/registry

volumes:
target: {}
cargogit: {}
cargoregistry: {}
2 changes: 2 additions & 0 deletions scripts/integration/docker-compose.kafka.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ services:
- KAFKA_HOST=kafka
volumes:
- ${PWD}:/code
- target:/code/target
- cargogit:/usr/local/cargo/git
- cargoregistry:/usr/local/cargo/registry

volumes:
target: {}
cargogit: {}
cargoregistry: {}
2 changes: 2 additions & 0 deletions scripts/integration/docker-compose.logstash.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@ services:
network_mode: host
volumes:
- ${PWD}:/code
- target:/code/target
- cargogit:/usr/local/cargo/git
- cargoregistry:/usr/local/cargo/registry

volumes:
target: {}
cargogit: {}
cargoregistry: {}
2 changes: 2 additions & 0 deletions scripts/integration/docker-compose.loki.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ services:
- LOKI_ADDRESS=http://loki:3100
volumes:
- ${PWD}:/code
- target:/code/target
- cargogit:/usr/local/cargo/git
- cargoregistry:/usr/local/cargo/registry

networks:
backend: {}

volumes:
target: {}
cargogit: {}
cargoregistry: {}
2 changes: 2 additions & 0 deletions scripts/integration/docker-compose.mongodb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,14 @@ services:
- backend
volumes:
- ${PWD}:/code
- target:/code/target
- cargogit:/usr/local/cargo/git
- cargoregistry:/usr/local/cargo/registry

networks:
backend: {}

volumes:
target: {}
cargogit: {}
cargoregistry: {}
2 changes: 2 additions & 0 deletions scripts/integration/docker-compose.nats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,14 @@ services:
- backend
volumes:
- ${PWD}:/code
- target:/code/target
- cargogit:/usr/local/cargo/git
- cargoregistry:/usr/local/cargo/registry

networks:
backend: {}

volumes:
target: {}
cargogit: {}
cargoregistry: {}
2 changes: 2 additions & 0 deletions scripts/integration/docker-compose.nginx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ services:
- public
volumes:
- ${PWD}:/code
- target:/code/target
- cargogit:/usr/local/cargo/git
- cargoregistry:/usr/local/cargo/registry

Expand All @@ -58,5 +59,6 @@ networks:
proxy: {}

volumes:
target: {}
cargogit: {}
cargoregistry: {}
2 changes: 2 additions & 0 deletions scripts/integration/docker-compose.postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@ services:
- PG_HOST=postgres
volumes:
- ${PWD}:/code
- target:/code/target
- cargogit:/usr/local/cargo/git
- cargoregistry:/usr/local/cargo/registry
- socket:/socket

volumes:
target: {}
cargogit: {}
cargoregistry: {}
socket: {}
2 changes: 2 additions & 0 deletions scripts/integration/docker-compose.prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ services:
- prometheus
volumes:
- ${PWD}:/code
- target:/code/target
- cargogit:/usr/local/cargo/git
- cargoregistry:/usr/local/cargo/registry

volumes:
target: {}
cargogit: {}
cargoregistry: {}
2 changes: 2 additions & 0 deletions scripts/integration/docker-compose.pulsar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ services:
- PULSAR_ADDRESS=pulsar://pulsar:6650
volumes:
- ${PWD}:/code
- target:/code/target
- cargogit:/usr/local/cargo/git
- cargoregistry:/usr/local/cargo/registry

volumes:
target: {}
cargogit: {}
cargoregistry: {}
2 changes: 2 additions & 0 deletions scripts/integration/docker-compose.redis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ services:
- backend
volumes:
- ${PWD}:/code
- target:/code/target
- cargogit:/usr/local/cargo/git
- cargoregistry:/usr/local/cargo/registry

networks:
backend: {}

volumes:
target: {}
cargogit: {}
cargoregistry: {}
2 changes: 2 additions & 0 deletions scripts/integration/docker-compose.shutdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@ services:
- KAFKA_HOST=kafka
volumes:
- ${PWD}:/code
- target:/code/target
- /var/run/docker.sock:/var/run/docker.sock:ro
- cargogit:/usr/local/cargo/git
- cargoregistry:/usr/local/cargo/registry

volumes:
target: {}
cargogit: {}
cargoregistry: {}
2 changes: 2 additions & 0 deletions scripts/integration/docker-compose.splunk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ services:
- SPLUNK_API_ADDRESS=https://splunk-hec:8089
volumes:
- ${PWD}:/code
- target:/code/target
- cargogit:/usr/local/cargo/git
- cargoregistry:/usr/local/cargo/registry

volumes:
target: {}
cargogit: {}
cargoregistry: {}

0 comments on commit d88b414

Please sign in to comment.