-
Notifications
You must be signed in to change notification settings - Fork 328
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: introduce unstable fuzz create table test (#3788)
* feat: implement unstable_fuzz_create_table_standalone * chore: use drop database * docs: update docs * chore: add ci config * chore: add feature gate * fix: fix clippy * chore: update ci * Apply suggestions from code review * feat: reduce num * Apply suggestions from code review * chore: apply suggestions from CR * Apply suggestions from code review * chore: reduce `wait_timeout` in health check * Update .env.example * refactor: use `init_greptime_connections_via_env` * refactor: use `init_greptime_connections_via_env` --------- Co-authored-by: tison <[email protected]>
- Loading branch information
Showing
20 changed files
with
846 additions
and
20 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
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
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,23 @@ | ||
mode = 'standalone' | ||
enable_memory_catalog = false | ||
require_lease_before_startup = true | ||
|
||
[wal] | ||
provider = "raft_engine" | ||
file_size = '1GB' | ||
purge_interval = '10m' | ||
purge_threshold = '10GB' | ||
read_batch_size = 128 | ||
sync_write = false | ||
|
||
[storage] | ||
type = 'File' | ||
data_home = '{data_home}' | ||
|
||
[grpc_options] | ||
addr = '127.0.0.1:4001' | ||
runtime_size = 8 | ||
|
||
[procedure] | ||
max_retry_times = 3 | ||
retry_delay = "500ms" |
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,58 @@ | ||
// Copyright 2023 Greptime Team | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
use std::path::PathBuf; | ||
|
||
use common_telemetry::tracing::info; | ||
use serde::Serialize; | ||
use snafu::ResultExt; | ||
use tinytemplate::TinyTemplate; | ||
use tokio::fs::File; | ||
use tokio::io::AsyncWriteExt; | ||
|
||
use crate::error; | ||
use crate::error::Result; | ||
|
||
/// Get the path of config dir `tests-fuzz/conf`. | ||
pub fn get_conf_path() -> PathBuf { | ||
let mut root_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); | ||
root_path.push("conf"); | ||
root_path | ||
} | ||
|
||
/// Returns rendered config file. | ||
pub fn render_config_file<C: Serialize>(template_path: &str, context: &C) -> String { | ||
let mut tt = TinyTemplate::new(); | ||
let template = std::fs::read_to_string(template_path).unwrap(); | ||
tt.add_template(template_path, &template).unwrap(); | ||
tt.render(template_path, context).unwrap() | ||
} | ||
|
||
// Writes config file to `output_path`. | ||
pub async fn write_config_file<C: Serialize>( | ||
template_path: &str, | ||
context: &C, | ||
output_path: &str, | ||
) -> Result<()> { | ||
info!("template_path: {template_path}, output_path: {output_path}"); | ||
let content = render_config_file(template_path, context); | ||
let mut config_file = File::create(output_path) | ||
.await | ||
.context(error::CreateFileSnafu { path: output_path })?; | ||
config_file | ||
.write_all(content.as_bytes()) | ||
.await | ||
.context(error::WriteFileSnafu { path: output_path })?; | ||
Ok(()) | ||
} |
Oops, something went wrong.