Skip to content

Commit ad08f14

Browse files
jordanhunt22Convex, Inc.
authored andcommitted
[Conductor] Delete the backend crate (#35569)
GitOrigin-RevId: a4aa5c1f903c35d71f5e382cf8c416babf872d57
1 parent 22efae4 commit ad08f14

File tree

5 files changed

+59
-1
lines changed

5 files changed

+59
-1
lines changed

crates/clusters/Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,11 @@ clap = { workspace = true }
1111
common = { path = "../../crates/common" }
1212
url = { workspace = true }
1313

14+
[features]
15+
testing = ["common/testing"]
16+
1417
[lints]
1518
workspace = true
19+
20+
[dev-dependencies]
21+
common = { path = "../../crates/common", features = ["testing"] }

crates/clusters/src/db_driver_tag.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ pub enum DbDriverTag {
99
PostgresAwsIam(PersistenceVersion),
1010
MySql(PersistenceVersion),
1111
MySqlAwsIam(PersistenceVersion),
12+
#[cfg(any(test, feature = "testing"))]
13+
TestPersistence,
1214
}
1315

1416
impl clap::ValueEnum for DbDriverTag {
@@ -19,6 +21,8 @@ impl clap::ValueEnum for DbDriverTag {
1921
DbDriverTag::MySqlAwsIam(PersistenceVersion::V5),
2022
DbDriverTag::Postgres(PersistenceVersion::V5),
2123
DbDriverTag::PostgresAwsIam(PersistenceVersion::V5),
24+
#[cfg(any(test, feature = "testing"))]
25+
DbDriverTag::TestPersistence,
2226
]
2327
}
2428

@@ -34,7 +38,13 @@ impl DbDriverTag {
3438
| Self::PostgresAwsIam(version)
3539
| Self::MySql(version)
3640
| Self::MySqlAwsIam(version) => Ok(*version),
37-
Self::Sqlite => anyhow::bail!("sqlite has no persistence version"),
41+
Self::Sqlite => {
42+
anyhow::bail!("sqlite has no persistence version")
43+
},
44+
#[cfg(any(test, feature = "testing"))]
45+
Self::TestPersistence => {
46+
anyhow::bail!("test persistence has no persistence version")
47+
},
3848
}
3949
}
4050

@@ -45,6 +55,8 @@ impl DbDriverTag {
4555
DbDriverTag::PostgresAwsIam(PersistenceVersion::V5) => "postgres-v5-aws-iam",
4656
DbDriverTag::MySql(PersistenceVersion::V5) => "mysql-v5",
4757
DbDriverTag::MySqlAwsIam(PersistenceVersion::V5) => "mysql-v5-aws-iam",
58+
#[cfg(any(test, feature = "testing"))]
59+
DbDriverTag::TestPersistence => "test-persistence",
4860
}
4961
}
5062
}
@@ -59,6 +71,8 @@ impl FromStr for DbDriverTag {
5971
"postgres-v5-aws-iam" => Ok(DbDriverTag::PostgresAwsIam(PersistenceVersion::V5)),
6072
"mysql-v5" => Ok(DbDriverTag::MySql(PersistenceVersion::V5)),
6173
"mysql-v5-aws-iam" => Ok(DbDriverTag::MySqlAwsIam(PersistenceVersion::V5)),
74+
#[cfg(any(test, feature = "testing"))]
75+
"test-persistence" => Ok(DbDriverTag::TestPersistence),
6276
_ => anyhow::bail!("unrecognized db_driver {s}"),
6377
}
6478
}

crates/clusters/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ pub fn persistence_args_from_cluster_url(
7373
.append_pair("verify_ca", "false");
7474
},
7575
DbDriverTag::Sqlite => anyhow::bail!("no url for sqlite"),
76+
#[cfg(any(test, feature = "testing"))]
77+
DbDriverTag::TestPersistence => {
78+
anyhow::bail!("no url for test persistence")
79+
},
7680
};
7781
Ok(PersistenceArgs {
7882
url: cluster_url,

crates/local_backend/Cargo.toml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ vector = { path = "../vector" }
7373
[dev-dependencies]
7474
application = { path = "../application", features = ["testing"] }
7575
authentication = { path = "../authentication", features = ["testing"] }
76+
clusters = { path = "../clusters", features = ["testing"] }
7677
common = { path = "../common", features = ["testing"] }
7778
convex_macro = { path = "../convex_macro" }
7879
database = { path = "../database", features = ["testing"] }
@@ -101,5 +102,32 @@ vector = { path = "../vector", features = ["testing"] }
101102
anyhow = { workspace = true }
102103
vergen = { workspace = true, features = ["git", "gitcl"] }
103104

105+
[features]
106+
testing = [
107+
"common/testing",
108+
"clusters/testing",
109+
"database/testing",
110+
"errors/testing",
111+
"function_runner/testing",
112+
"isolate/testing",
113+
"keybroker/testing",
114+
"metrics/testing",
115+
"model/testing",
116+
"mysql/testing",
117+
"postgres/testing",
118+
"runtime/testing",
119+
"search/testing",
120+
"storage/testing",
121+
"udf/testing",
122+
"usage_tracking/testing",
123+
"value/testing",
124+
"vector/testing",
125+
"application/testing",
126+
"authentication/testing",
127+
"events/testing",
128+
"node_executor/testing",
129+
"sync/testing",
130+
]
131+
104132
[lints]
105133
workspace = true

crates/local_backend/src/persistence.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ pub async fn connect_persistence(
7979
tracing::info!("Connected to MySQL database: {} ", args.db_name);
8080
persistence
8181
},
82+
#[cfg(any(test, feature = "testing"))]
83+
DbDriverTag::TestPersistence => {
84+
let persistence = Arc::new(common::testing::TestPersistence::new());
85+
tracing::info!("Connected to TestPersistence");
86+
persistence
87+
},
8288
};
8389
Ok(persistence)
8490
}

0 commit comments

Comments
 (0)