Skip to content

Commit 4dc3c59

Browse files
authored
Merge pull request #32228 from def-/pr-terraform-again
terraform test: Add some interesting td files
2 parents 6c21e0f + b686a30 commit 4dc3c59

File tree

8 files changed

+464
-332
lines changed

8 files changed

+464
-332
lines changed

ci/nightly/pipeline.template.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,6 +1209,8 @@ steps:
12091209
- ./ci/plugins/mzcompose:
12101210
composition: terraform
12111211
run: aws-temporary
1212+
# Cleanup runs in pre-exit hook
1213+
args: [--no-cleanup]
12121214
branches: "main v*.* lts-v* *aws* *tf* *terraform* *helm* *self-managed* *orchestratord*"
12131215

12141216
- id: terraform-aws-upgrade
@@ -1225,6 +1227,8 @@ steps:
12251227
- ./ci/plugins/mzcompose:
12261228
composition: terraform
12271229
run: aws-upgrade
1230+
# Cleanup runs in pre-exit hook
1231+
args: [--no-cleanup]
12281232
branches: "main v*.* lts-v* *aws* *tf* *terraform* *helm* *self-managed* *orchestratord*"
12291233

12301234
- id: terraform-gcp
@@ -1240,6 +1244,8 @@ steps:
12401244
- ./ci/plugins/mzcompose:
12411245
composition: terraform
12421246
run: gcp-temporary
1247+
# Cleanup runs in pre-exit hook
1248+
args: [--no-cleanup]
12431249
branches: "main v*.* lts-v* *gcp* *tf* *terraform* *helm* *self-managed* *orchestratord*"
12441250

12451251
- id: terraform-azure
@@ -1255,6 +1261,8 @@ steps:
12551261
- ./ci/plugins/mzcompose:
12561262
composition: terraform
12571263
run: azure-temporary
1264+
# Cleanup runs in pre-exit hook
1265+
args: [--no-cleanup]
12581266
branches: "main v*.* lts-v* *azure* *tf* *terraform* *helm* *self-managed* *orchestratord*"
12591267

12601268
- group: "Output consistency"

ci/plugins/mzcompose/hooks/pre-exit

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,6 @@ if [ -n "${CI_COVERAGE_ENABLED:-}" ] && [ -z "${BUILDKITE_MZCOMPOSE_PLUGIN_SKIP_
134134
fi
135135
fi
136136

137-
if [[ "$BUILDKITE_LABEL" =~ Terraform\ .* ]]; then
138-
ci_unimportant_heading "terraform: Destroying leftover state in case job was cancelled or timed out..."
139-
bin/ci-builder run stable terraform -chdir=test/terraform/aws-temporary destroy || true
140-
bin/ci-builder run stable terraform -chdir=test/terraform/gcp-temporary destroy || true
141-
PATH="$PWD/test/terraform/azure-temporary/venv/bin:$PATH" VIRTUAL_ENV="$PWD/test/terraform/azure-temporary/venv" bin/ci-builder run stable terraform -chdir=test/terraform/azure-temporary destroy || true
142-
fi
143-
rm -rf ~/.kube # Remove potential state from E2E Terraform tests
144-
145137
ci_unimportant_heading ":docker: Cleaning up after mzcompose"
146138

147139
# docker-compose kill may fail attempting to kill containers
@@ -156,12 +148,14 @@ fi
156148
ci_collapsed_heading ":docker: Purging all existing docker containers and volumes, regardless of origin"
157149
docker ps --all --quiet | xargs --no-run-if-empty docker rm --force --volumes
158150

159-
if [[ "$BUILDKITE_LABEL" =~ Terraform\ .* ]]; then
160-
ci_unimportant_heading "terraform: Destroying leftover state in case job was cancelled or timed out..."
161-
bin/ci-builder run stable terraform -chdir=test/terraform/aws-temporary destroy || true
162-
bin/ci-builder run stable terraform -chdir=test/terraform/aws-upgrade destroy || true
163-
bin/ci-builder run stable terraform -chdir=test/terraform/gcp-temporary destroy || true
164-
bin/ci-builder run stable terraform -chdir=test/terraform/azure-temporary destroy || true
151+
if [ "$BUILDKITE_STEP_KEY" = "terraform-aws" ]; then
152+
run run aws-temporary --no-setup --no-test --no-run-mz-debug || CI_ANNOTATE_ERRORS_RESULT=1
153+
elif [ "$BUILDKITE_STEP_KEY" = "terraform-aws-upgrade" ]; then
154+
run run aws-upgrade --no-setup --no-test --no-run-mz-debug || CI_ANNOTATE_ERRORS_RESULT=1
155+
elif [ "$BUILDKITE_STEP_KEY" = "terraform-gcp" ]; then
156+
run run gcp-temporary --no-setup --no-test --no-run-mz-debug || CI_ANNOTATE_ERRORS_RESULT=1
157+
elif [ "$BUILDKITE_STEP_KEY" = "terraform-azure" ]; then
158+
run run azure-temporary --no-setup --no-test --no-run-mz-debug || CI_ANNOTATE_ERRORS_RESULT=1
165159
fi
166160
rm -rf ~/.kube # Remove potential state from E2E Terraform tests
167161

misc/python/materialize/mzcompose/services/testdrive.py

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def __init__(
6464
stop_grace_period: str = "120s",
6565
cluster_replica_size: dict[str, dict[str, Any]] | None = None,
6666
network_mode: str | None = None,
67+
set_persist_urls: bool = True,
6768
) -> None:
6869
depends_graph: dict[str, ServiceDependency] = {}
6970

@@ -161,27 +162,30 @@ def __init__(
161162
f"--fivetran-destination-files-path={fivetran_destination_files_path}"
162163
)
163164

164-
if external_blob_store:
165-
blob_store = "azurite" if blob_store_is_azure else "minio"
166-
address = blob_store if external_blob_store == True else external_blob_store
167-
persist_blob_url = (
168-
azure_blob_uri(address)
169-
if blob_store_is_azure
170-
else minio_blob_uri(address)
171-
)
172-
entrypoint.append(f"--persist-blob-url={persist_blob_url}")
173-
else:
174-
entrypoint.append("--persist-blob-url=file:///mzdata/persist/blob")
175-
176-
if external_metadata_store:
177-
depends_graph[metadata_store] = {"condition": "service_healthy"}
178-
entrypoint.append(
179-
"--persist-consensus-url=postgres://root@cockroach:26257?options=--search_path=consensus"
180-
)
181-
else:
182-
entrypoint.append(
183-
f"--persist-consensus-url=postgres://root@{mz_service}:26257?options=--search_path=consensus"
184-
)
165+
if set_persist_urls:
166+
if external_blob_store:
167+
blob_store = "azurite" if blob_store_is_azure else "minio"
168+
address = (
169+
blob_store if external_blob_store == True else external_blob_store
170+
)
171+
persist_blob_url = (
172+
azure_blob_uri(address)
173+
if blob_store_is_azure
174+
else minio_blob_uri(address)
175+
)
176+
entrypoint.append(f"--persist-blob-url={persist_blob_url}")
177+
else:
178+
entrypoint.append("--persist-blob-url=file:///mzdata/persist/blob")
179+
180+
if external_metadata_store:
181+
depends_graph[metadata_store] = {"condition": "service_healthy"}
182+
entrypoint.append(
183+
"--persist-consensus-url=postgres://root@cockroach:26257?options=--search_path=consensus"
184+
)
185+
else:
186+
entrypoint.append(
187+
f"--persist-consensus-url=postgres://root@{mz_service}:26257?options=--search_path=consensus"
188+
)
185189

186190
entrypoint.extend(entrypoint_extra)
187191

src/testdrive/src/action.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ impl Run for PosCommand {
776776
consistency::skip_consistency_checks(builtin, state)
777777
}
778778
"check-shard-tombstone" => {
779-
consistency::run_check_shard_tombstoned(builtin, state).await
779+
consistency::run_check_shard_tombstone(builtin, state).await
780780
}
781781
"fivetran-destination" => {
782782
fivetran::run_destination_command(builtin, state).await

src/testdrive/src/action/consistency.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@ pub async fn run_consistency_checks(state: &State) -> Result<ControlFlow, anyhow
9494
/// Checks if a shard in Persist has been tombstoned.
9595
///
9696
/// TODO(parkmycar): Run this as part of the consistency checks, instead of as a specific command.
97-
pub async fn run_check_shard_tombstoned(
97+
pub async fn run_check_shard_tombstone(
9898
mut cmd: BuiltinCommand,
9999
state: &State,
100100
) -> Result<ControlFlow, anyhow::Error> {
101101
let shard_id = cmd.args.string("shard-id")?;
102-
check_shard_tombstoned(state, &shard_id).await?;
102+
check_shard_tombstone(state, &shard_id).await?;
103103
Ok(ControlFlow::Continue)
104104
}
105105

@@ -237,8 +237,8 @@ async fn check_catalog_state(state: &State) -> Result<(), anyhow::Error> {
237237
}
238238

239239
/// Checks if the provided `shard_id` is a tombstone, returning an error if it's not.
240-
async fn check_shard_tombstoned(state: &State, shard_id: &str) -> Result<(), anyhow::Error> {
241-
println!("$ check-shard-tombstoned {shard_id}");
240+
async fn check_shard_tombstone(state: &State, shard_id: &str) -> Result<(), anyhow::Error> {
241+
println!("$ check-shard-tombstone {shard_id}");
242242

243243
let (Some(consensus_uri), Some(blob_uri)) =
244244
(&state.persist_consensus_url, &state.persist_blob_url)

0 commit comments

Comments
 (0)