Skip to content

Commit da774ee

Browse files
committed
Add integration test for new config variables
1 parent aa442c0 commit da774ee

File tree

4 files changed

+120
-1
lines changed

4 files changed

+120
-1
lines changed

src/environmentd/BUILD.bazel

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,72 @@ rust_test(
284284
),
285285
)
286286

287+
rust_test(
288+
name = "mz_environmentd_bootstrap_builtin_clusters_tests",
289+
size = "large",
290+
srcs = ["tests/bootstrap_builtin_clusters.rs"],
291+
aliases = aliases(
292+
normal = True,
293+
normal_dev = True,
294+
proc_macro = True,
295+
proc_macro_dev = True,
296+
),
297+
compile_data = [],
298+
crate_features = [],
299+
crate_name = "bootstrap_builtin_clusters",
300+
data = [],
301+
env = {},
302+
proc_macro_deps = [] + all_crate_deps(
303+
proc_macro = True,
304+
proc_macro_dev = True,
305+
),
306+
rustc_env = {},
307+
rustc_flags = [],
308+
version = "0.133.0-dev.0",
309+
deps = [
310+
"//src/adapter:mz_adapter",
311+
"//src/adapter-types:mz_adapter_types",
312+
"//src/alloc:mz_alloc",
313+
"//src/alloc-default:mz_alloc_default",
314+
"//src/aws-secrets-controller:mz_aws_secrets_controller",
315+
"//src/build-info:mz_build_info",
316+
"//src/catalog:mz_catalog",
317+
"//src/cloud-resources:mz_cloud_resources",
318+
"//src/controller:mz_controller",
319+
"//src/dyncfgs:mz_dyncfgs",
320+
"//src/environmentd:mz_environmentd",
321+
"//src/frontegg-auth:mz_frontegg_auth",
322+
"//src/frontegg-mock:mz_frontegg_mock",
323+
"//src/http-util:mz_http_util",
324+
"//src/interchange:mz_interchange",
325+
"//src/metrics:mz_metrics",
326+
"//src/orchestrator:mz_orchestrator",
327+
"//src/orchestrator-kubernetes:mz_orchestrator_kubernetes",
328+
"//src/orchestrator-process:mz_orchestrator_process",
329+
"//src/orchestrator-tracing:mz_orchestrator_tracing",
330+
"//src/orchestratord:mz_orchestratord",
331+
"//src/ore:mz_ore",
332+
"//src/persist-client:mz_persist_client",
333+
"//src/pgrepr:mz_pgrepr",
334+
"//src/pgtest:mz_pgtest",
335+
"//src/pgwire:mz_pgwire",
336+
"//src/pgwire-common:mz_pgwire_common",
337+
"//src/prof-http:mz_prof_http",
338+
"//src/repr:mz_repr",
339+
"//src/secrets:mz_secrets",
340+
"//src/segment:mz_segment",
341+
"//src/server-core:mz_server_core",
342+
"//src/service:mz_service",
343+
"//src/sql:mz_sql",
344+
"//src/sql-parser:mz_sql_parser",
345+
"//src/storage-types:mz_storage_types",
346+
"//src/tracing:mz_tracing",
347+
] + all_crate_deps(
348+
normal = True,
349+
normal_dev = True,
350+
),
351+
)
352+
287353
rust_test(
288354
name = "mz_environmentd_cli_tests",
289355
size = "large",

src/environmentd/src/test_util.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,16 @@ impl TestHarness {
279279
self.builtin_system_cluster_config.size = builtin_system_cluster_replica_size;
280280
self
281281
}
282+
283+
pub fn with_builtin_system_cluster_replication_factor(
284+
mut self,
285+
builtin_system_cluster_replication_factor: u32,
286+
) -> Self {
287+
self.builtin_system_cluster_config.replication_factor =
288+
builtin_system_cluster_replication_factor;
289+
self
290+
}
291+
282292
pub fn with_builtin_catalog_server_cluster_replica_size(
283293
mut self,
284294
builtin_catalog_server_cluster_replica_size: String,
@@ -287,7 +297,6 @@ impl TestHarness {
287297
builtin_catalog_server_cluster_replica_size;
288298
self
289299
}
290-
// TODO: Add with_builtin_probe_cluster_replica_size
291300

292301
pub fn with_propagate_crashes(mut self, propagate_crashes: bool) -> Self {
293302
self.propagate_crashes = propagate_crashes;
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Copyright Materialize, Inc. and contributors. All rights reserved.
2+
//G
3+
// Use of this software is governed by the Business Source License
4+
// included in the LICENSE file.
5+
//
6+
// As of the Change Date specified in that file, in accordance with
7+
// the Business Source License, use of this software will be governed
8+
// by the Apache License, Version 2.0.
9+
10+
//! Integration tests for builtin clusters on bootstrap.
11+
12+
use mz_environmentd::test_util::{self};
13+
14+
// Test that a cluster with a replication factor of 0 should not create any replicas.
15+
#[mz_ore::test]
16+
fn test_zero_replication_factor_no_replicas() {
17+
let server = test_util::TestHarness::default()
18+
.with_builtin_system_cluster_replication_factor(0)
19+
.start_blocking();
20+
21+
let mut client = server.connect(postgres::NoTls).unwrap();
22+
let system_cluster = client
23+
.query_one(
24+
r#"
25+
SELECT c.id, c.name, c.replication_factor::integer, COUNT(cr.id)::integer as replica_count
26+
FROM mz_clusters c
27+
LEFT JOIN mz_cluster_replicas cr ON c.id = cr.cluster_id
28+
WHERE c.name = 'mz_system'
29+
GROUP BY c.id, c.name, c.replication_factor
30+
"#,
31+
&[],
32+
)
33+
.unwrap();
34+
35+
let replication_factor: i32 = system_cluster.get(2);
36+
let replica_count: i32 = system_cluster.get(3);
37+
assert_eq!(replication_factor, 0);
38+
assert_eq!(replica_count, 0);
39+
}

src/sqllogictest/BUILD.bazel

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ rust_library(
2929
rustc_flags = [],
3030
version = "0.0.1",
3131
deps = [
32+
"//src/adapter-types:mz_adapter_types",
3233
"//src/build-info:mz_build_info",
3334
"//src/catalog:mz_catalog",
3435
"//src/controller:mz_controller",
@@ -73,6 +74,7 @@ rust_test(
7374
rustc_flags = [],
7475
version = "0.0.1",
7576
deps = [
77+
"//src/adapter-types:mz_adapter_types",
7678
"//src/build-info:mz_build_info",
7779
"//src/catalog:mz_catalog",
7880
"//src/controller:mz_controller",
@@ -102,6 +104,7 @@ rust_doc_test(
102104
name = "mz_sqllogictest_doc_test",
103105
crate = ":mz_sqllogictest",
104106
deps = [
107+
"//src/adapter-types:mz_adapter_types",
105108
"//src/build-info:mz_build_info",
106109
"//src/catalog:mz_catalog",
107110
"//src/controller:mz_controller",
@@ -151,6 +154,7 @@ rust_test(
151154
version = "0.0.1",
152155
deps = [
153156
":mz_sqllogictest",
157+
"//src/adapter-types:mz_adapter_types",
154158
"//src/build-info:mz_build_info",
155159
"//src/catalog:mz_catalog",
156160
"//src/controller:mz_controller",
@@ -194,6 +198,7 @@ rust_binary(
194198
version = "0.0.1",
195199
deps = [
196200
":mz_sqllogictest",
201+
"//src/adapter-types:mz_adapter_types",
197202
"//src/build-info:mz_build_info",
198203
"//src/catalog:mz_catalog",
199204
"//src/controller:mz_controller",

0 commit comments

Comments
 (0)