Skip to content

Commit b5388be

Browse files
logictest: Add and plumb ParsingPreset CLI flag
Follow-up to 9714 to allow running certain tests with the ParsingPreset CLI/env var. Change-Id: I3896f2ee53e594b0955b5056fa67eeb7a2ed95f7 Reviewed-on: https://gerrit.readyset.name/c/readyset/+/9729 Tested-by: Buildkite CI Reviewed-by: Michael Zink <michael.z@readyset.io>
1 parent 1501a18 commit b5388be

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

.buildkite/pipeline.public-common.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,7 @@ steps:
224224
- 'cargo --locked run --bin readyset-logictest -- verify logictests/replicated/psql --database-type postgresql --replication-url postgresql://postgres:noria@postgres/noria'
225225
- 'cargo --locked run --bin readyset-logictest -- verify logictests/replicated/postgis --database-type postgresql --replication-url postgresql://postgres:noria@postgres/noria'
226226
- 'cargo --locked run --bin readyset-logictest -- verify logictests/replicated/mysql --database-type mysql --replication-url mysql://root:noria@mysql/noria'
227-
# TODO: Re-enable once --parsing-preset flag is implemented for logictests
228-
# - 'cargo --locked run --bin readyset-logictest --features readyset-sql-parsing/sqlparser -- verify logictests/sqlparser'
227+
- 'cargo --locked run --bin readyset-logictest -- verify logictests/sqlparser --parsing-preset=only-sqlparser'
229228
timeout_in_minutes: 60
230229
plugins:
231230
- docker-compose#${DOCKER_COMPOSE_PLUGIN_VERSION}:

readyset-logictest/src/main.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use proptest::strategy::Strategy;
2121
use proptest::test_runner::{self, TestCaseError, TestError, TestRng, TestRunner};
2222
use query_generator::{QueryOperationArgs, QuerySeed};
2323
use readyset_client::consensus::AuthorityType;
24+
use readyset_sql_parsing::ParsingPreset;
2425
use readyset_tracing::init_test_logging;
2526
use serde_json::json;
2627
use tokio::sync::Mutex;
@@ -262,6 +263,15 @@ struct Verify {
262263
#[arg(long)]
263264
replication_url: Option<String>,
264265

266+
#[arg(
267+
long,
268+
env = "PARSING_PRESET",
269+
value_enum,
270+
default_value = "both-prefer-nom",
271+
hide = true
272+
)]
273+
parsing_preset: ParsingPreset,
274+
265275
/// Type of database to use for the adapter.
266276
///
267277
/// Ignored if --database-url is passed, must match the database type of --replication-url if
@@ -540,6 +550,7 @@ impl From<&Verify> for RunOptions {
540550
database_type: verify.database_type,
541551
enable_reuse: verify.enable_reuse,
542552
upstream_database_url: verify.database_url().cloned(),
553+
parsing_preset: verify.parsing_preset,
543554
replication_url: verify.replication_url.clone(),
544555
time: verify.time,
545556
verbose: verify.verbose,

readyset-logictest/src/runner.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ use readyset_psql::{PostgreSqlQueryHandler, PostgreSqlUpstream};
3030
use readyset_server::{Builder, LocalAuthority, ReuseConfigType};
3131
use readyset_sql::ast::Relation;
3232
use readyset_sql::Dialect;
33+
use readyset_sql_parsing::ParsingPreset;
3334
use readyset_util::retry_with_exponential_backoff;
3435
use readyset_util::shared_cache::SharedCache;
3536
use readyset_util::shutdown::ShutdownSender;
@@ -90,6 +91,7 @@ pub struct RunOptions {
9091
pub database_type: DatabaseType,
9192
pub upstream_database_url: Option<DatabaseURL>,
9293
pub replication_url: Option<String>,
94+
pub parsing_preset: ParsingPreset,
9395
pub enable_reuse: bool,
9496
pub time: bool,
9597
pub verbose: bool,
@@ -103,6 +105,7 @@ impl Default for RunOptions {
103105
time: false,
104106
replication_url: None,
105107
database_type: DatabaseType::MySQL,
108+
parsing_preset: ParsingPreset::for_tests(),
106109
verbose: false,
107110
}
108111
}
@@ -540,6 +543,7 @@ impl TestScript {
540543
builder.set_straddled_joins(true);
541544
builder.set_post_lookup(true);
542545
builder.set_topk(false); // TODO: fails on generated tests
546+
builder.set_parsing_preset(run_opts.parsing_preset);
543547

544548
if run_opts.enable_reuse {
545549
builder.set_reuse(Some(ReuseConfigType::Finkelstein))
@@ -603,6 +607,7 @@ impl TestScript {
603607

604608
let adapter_rewrite_params = rh.adapter_rewrite_params().await.unwrap();
605609
let adapter_start_time = SystemTime::now();
610+
let parsing_preset = run_opts.parsing_preset;
606611

607612
let task = tokio::spawn(async move {
608613
let (s, _) = listener.accept().await.unwrap();
@@ -661,6 +666,7 @@ impl TestScript {
661666
BackendBuilder::new()
662667
.require_authentication(false)
663668
.dialect($dialect)
669+
.parsing_preset(parsing_preset)
664670
.build::<_, $handler>(
665671
noria,
666672
upstream,

0 commit comments

Comments
 (0)