sqlness_runner/cmd.rs
1// Copyright 2023 Greptime Team
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15pub(crate) mod bare;
16pub(crate) mod compat;
17pub(crate) mod compat_case;
18pub(crate) mod kube;
19
20use std::path::PathBuf;
21
22use bare::BareCommand;
23use clap::Parser;
24use compat::CompatCommand;
25use kube::KubeCommand;
26
27#[derive(Parser)]
28#[clap(author, version, about, long_about = None)]
29pub struct Command {
30 #[clap(subcommand)]
31 pub subcmd: SubCommand,
32}
33
34#[derive(Parser)]
35pub enum SubCommand {
36 Bare(BareCommand),
37 Compat(CompatCommand),
38 Kube(KubeCommand),
39}
40
41#[derive(Debug, Parser)]
42pub struct SqlnessConfig {
43 /// Directory of test cases
44 #[clap(short, long)]
45 pub case_dir: Option<PathBuf>,
46
47 /// Fail this run as soon as one case fails if true
48 #[arg(short, long, default_value = "false")]
49 pub fail_fast: bool,
50
51 /// Environment Configuration File
52 #[clap(short, long, default_value = "config.toml")]
53 pub env_config_file: String,
54
55 /// Name of test cases to run. Accept as a regexp.
56 #[clap(short, long, default_value = ".*")]
57 pub test_filter: String,
58}