ci: add sqlness job (#835)

* ci: add sqlness job

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* update sqlness to official release

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* filter out backtrace

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* fix error display

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* close once_cell feature gate

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
This commit is contained in:
Ruihang Xia
2023-01-10 15:12:20 +08:00
committed by GitHub
parent ea753b9ac0
commit 1305924423
7 changed files with 77 additions and 50 deletions

View File

@@ -10,5 +10,5 @@ client = { path = "../../src/client" }
common-base = { path = "../../src/common/base" }
common-grpc = { path = "../../src/common/grpc" }
common-query = { path = "../../src/common/query" }
sqlness = { git = "https://github.com/ceresdb/sqlness.git" }
sqlness = "0.1"
tokio.workspace = true

View File

@@ -14,13 +14,14 @@
use std::fmt::Display;
use std::fs::OpenOptions;
use std::path::Path;
use std::process::Stdio;
use std::time::Duration;
use async_trait::async_trait;
use client::{Client, Database as DB, Error as ClientError};
use common_query::Output;
use sqlness::{Database, Environment};
use sqlness::{Database, EnvController};
use tokio::process::{Child, Command};
use crate::util;
@@ -31,10 +32,10 @@ const SERVER_LOG_FILE: &str = "/tmp/greptime-sqlness.log";
pub struct Env {}
#[async_trait]
impl Environment for Env {
impl EnvController for Env {
type DB = GreptimeDB;
async fn start(&self, mode: &str, _config: Option<String>) -> Self::DB {
async fn start(&self, mode: &str, _config: Option<&Path>) -> Self::DB {
match mode {
"standalone" => Self::start_standalone().await,
"distributed" => Self::start_distributed().await,
@@ -139,7 +140,7 @@ impl Display for ResultDisplayer {
}
Output::Stream(_) => unreachable!(),
},
Err(e) => write!(f, "Failed to execute, error: {e:?}"),
Err(e) => write!(f, "{e}"),
}
}
}