Skip to main content

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 datanode_overlay;
19pub(crate) mod kube;
20
21use std::path::PathBuf;
22
23use bare::BareCommand;
24use clap::Parser;
25use compat::CompatCommand;
26use kube::KubeCommand;
27
28#[derive(Parser)]
29#[clap(author, version, about, long_about = None)]
30pub struct Command {
31    #[clap(subcommand)]
32    pub subcmd: SubCommand,
33}
34
35#[derive(Parser)]
36pub enum SubCommand {
37    Bare(BareCommand),
38    Compat(CompatCommand),
39    Kube(KubeCommand),
40}
41
42#[derive(Debug, Parser)]
43pub struct SqlnessConfig {
44    /// Directory of test cases
45    #[clap(short, long)]
46    pub case_dir: Option<PathBuf>,
47
48    /// Fail this run as soon as one case fails if true
49    #[arg(short, long, default_value = "false")]
50    pub fail_fast: bool,
51
52    /// Environment Configuration File
53    #[clap(short, long, default_value = "config.toml")]
54    pub env_config_file: String,
55
56    /// Name of test cases to run. Accept as a regexp.
57    #[clap(short, long, default_value = ".*")]
58    pub test_filter: String,
59}