-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor clickhouse admin integration tests (#7017)
## Overview This commit changes the way the clickhouse clusters are spun up for clickhouse-admin integration tests. Instead of multiple clusters being spun up for every test, now we start up a single cluster via nextest's "setup scripts" functionality. This way, we no longer need to manually hard code so many ports per test. ## Caveats Sadly, we still have to hardcode some ports, but at least this way it's only a set of ports, and we won't need to add more every time we want to test something new. In order to get the teardown function working, I had to limit the tests to run on a single thread. They're a bit slower than before, but nothing too terrible. Setting up the cluster, running the tests and tearing down takes ~7s. The time to run the tests themselves is ~3s
- Loading branch information
Showing
12 changed files
with
286 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[package] | ||
name = "clickhouse-admin-test-utils" | ||
version = "0.1.0" | ||
edition = "2021" | ||
license = "MPL-2.0" | ||
|
||
[lints] | ||
workspace = true | ||
|
||
[dependencies] | ||
camino.workspace = true | ||
clickhouse-admin-types.workspace = true | ||
clickward.workspace = true | ||
dropshot.workspace = true | ||
|
||
omicron-workspace-hack.workspace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
//! Integration testing facilities for clickhouse-admin | ||
|
||
use camino::Utf8PathBuf; | ||
use clickhouse_admin_types::OXIMETER_CLUSTER; | ||
use clickward::{BasePorts, Deployment, DeploymentConfig}; | ||
use dropshot::test_util::{log_prefix_for_test, LogContext}; | ||
use dropshot::{ConfigLogging, ConfigLoggingLevel}; | ||
|
||
pub const DEFAULT_CLICKHOUSE_ADMIN_BASE_PORTS: BasePorts = BasePorts { | ||
keeper: 29000, | ||
raft: 29100, | ||
clickhouse_tcp: 29200, | ||
clickhouse_http: 29300, | ||
clickhouse_interserver_http: 29400, | ||
}; | ||
|
||
pub fn default_clickhouse_cluster_test_deployment( | ||
path: Utf8PathBuf, | ||
) -> Deployment { | ||
let config = DeploymentConfig { | ||
path, | ||
base_ports: DEFAULT_CLICKHOUSE_ADMIN_BASE_PORTS, | ||
cluster_name: OXIMETER_CLUSTER.to_string(), | ||
}; | ||
|
||
Deployment::new(config) | ||
} | ||
|
||
pub fn default_clickhouse_log_ctx_and_path() -> (LogContext, Utf8PathBuf) { | ||
let logctx = LogContext::new( | ||
"clickhouse_cluster", | ||
&ConfigLogging::StderrTerminal { level: ConfigLoggingLevel::Info }, | ||
); | ||
|
||
let (parent_dir, _prefix) = log_prefix_for_test("clickhouse_cluster"); | ||
let path = parent_dir.join("clickward_test"); | ||
|
||
(logctx, path) | ||
} |
Oops, something went wrong.