Skip to content

Commit 8ba04a3

Browse files
authored
Bug 1988766 - move viaduct-dev into it's own crate (#6951)
I was hoping we could just use a feature for this, but it didn't work out in practice since it meant that we needed to vet the dependencies as `safe-to-deploy`, which is more stringent than `safe-to-run`. These deps are already vetted as `safe-to-run` in moz-central.
1 parent 235ea58 commit 8ba04a3

File tree

23 files changed

+86
-60
lines changed

23 files changed

+86
-60
lines changed

Cargo.lock

Lines changed: 19 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ members = [
4646
"components/support/text-table",
4747
"components/support/tracing",
4848
"components/support/types",
49+
"components/support/viaduct-dev",
50+
"components/support/viaduct-hyper",
4951
"components/support/viaduct-reqwest",
5052
"components/sync_manager",
5153
"components/sync15",

components/ads-client/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ serde_json = "1"
1111
url = "2"
1212
uniffi = { version = "0.29.0" }
1313
uuid = { version = "1.3", features = ["v4"] }
14-
viaduct = { path = "../viaduct", features = ["backend-dev"] }
14+
viaduct = { path = "../viaduct" }
1515
error-support = { path = "../support/error" }
1616
thiserror = "2"
1717

1818
[dev-dependencies]
1919
mockito = { version = "0.31", default-features = false}
2020
mockall = "0.12"
21+
viaduct-dev = { path = "../support/viaduct-dev" }
2122

2223
[build-dependencies]
2324
uniffi = { version = "0.29.0", features = ["build"] }

components/ads-client/src/instrument.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ mod tests {
7878

7979
#[test]
8080
fn test_emit_telemetry_emits_telemetry_for_mappable_error() {
81-
viaduct::init_backend_dev();
81+
viaduct_dev::init_backend_dev();
8282
set_telemetry_endpoint(format!("{}{}", mockito::server_url(), "/v1/log"));
8383
let mock = mock("GET", "/v1/log")
8484
.match_query(mockito::Matcher::UrlEncoded(
@@ -104,7 +104,7 @@ mod tests {
104104

105105
#[test]
106106
fn test_emit_telemetry_event_on_ok_does_nothing() {
107-
viaduct::init_backend_dev();
107+
viaduct_dev::init_backend_dev();
108108
set_telemetry_endpoint(format!("{}{}", mockito::server_url(), "/v1/log"));
109109

110110
let mock = mock("GET", "/v1/log").with_status(200).expect(0).create();

components/ads-client/src/mars.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ mod tests {
170170

171171
#[test]
172172
fn test_record_impression_with_valid_url_should_succeed() {
173-
viaduct::init_backend_dev();
173+
viaduct_dev::init_backend_dev();
174174
let _m = mock("GET", "/impression_callback_url")
175175
.with_status(200)
176176
.create();
@@ -182,7 +182,7 @@ mod tests {
182182

183183
#[test]
184184
fn test_record_click_with_valid_url_should_succeed() {
185-
viaduct::init_backend_dev();
185+
viaduct_dev::init_backend_dev();
186186
let _m = mock("GET", "/click_callback_url").with_status(200).create();
187187

188188
let client = create_test_client(mockito::server_url());
@@ -193,7 +193,7 @@ mod tests {
193193

194194
#[test]
195195
fn test_report_ad_with_valid_url_should_succeed() {
196-
viaduct::init_backend_dev();
196+
viaduct_dev::init_backend_dev();
197197
let _m = mock("GET", "/report_ad_callback_url")
198198
.with_status(200)
199199
.create();
@@ -206,7 +206,7 @@ mod tests {
206206

207207
#[test]
208208
fn test_fetch_ads_success() {
209-
viaduct::init_backend_dev();
209+
viaduct_dev::init_backend_dev();
210210
let expected_response = get_example_happy_ad_response();
211211

212212
let _m = mock("POST", "/ads")

components/context_id/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ viaduct = { path = "../viaduct" }
2222

2323
[dev-dependencies]
2424
mockito = { version = "0.31", default-features = false}
25-
viaduct = { path = "../viaduct", features = ["backend-dev"] }
25+
viaduct-dev = { path = "../support/viaduct-dev" }

components/context_id/src/mars.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ mod tests {
5151

5252
#[test]
5353
fn test_delete() {
54-
viaduct::init_backend_dev();
54+
viaduct_dev::init_backend_dev();
5555

5656
let expected_context_id = "some-fake-context-id";
5757
let expected_body = format!(r#"{{"context_id":"{}"}}"#, expected_context_id);

components/fxa-client/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ nss = { path = "../support/rc_crypto/nss" }
3333
uniffi = { version = "0.29.0", features = ["build"] }
3434

3535
[dev-dependencies]
36-
viaduct = { path = "../viaduct", features=["backend-dev"]}
36+
viaduct-dev = { path = "../support/viaduct-dev"}
3737
mockall = "0.12"
3838
mockito = { version = "0.31", default-features = false}
3939

components/fxa-client/src/internal/http_client.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,7 @@ mod tests {
10431043

10441044
#[test]
10451045
fn test_backoff() {
1046-
viaduct::init_backend_dev();
1046+
viaduct_dev::init_backend_dev();
10471047
let m = mock("POST", "/v1/account/devices/invoke_command")
10481048
.with_status(429)
10491049
.with_header("Content-Type", "application/json")
@@ -1090,7 +1090,7 @@ mod tests {
10901090

10911091
#[test]
10921092
fn test_backoff_then_ok() {
1093-
viaduct::init_backend_dev();
1093+
viaduct_dev::init_backend_dev();
10941094
let m = mock("POST", "/v1/account/devices/invoke_command")
10951095
.with_status(429)
10961096
.with_header("Content-Type", "application/json")
@@ -1140,7 +1140,7 @@ mod tests {
11401140

11411141
#[test]
11421142
fn test_backoff_per_path() {
1143-
viaduct::init_backend_dev();
1143+
viaduct_dev::init_backend_dev();
11441144
let m1 = mock("POST", "/v1/account/devices/invoke_command")
11451145
.with_status(429)
11461146
.with_header("Content-Type", "application/json")

components/push/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ mockito = { version = "0.31", default-features = false }
3131
hex = "0.4"
3232
tempfile = "3.1.0"
3333
mockall = "0.12"
34-
viaduct = { path = "../viaduct", features = ["backend-dev"]}
34+
viaduct-dev = { path = "../support/viaduct-dev" }
3535
nss = { path = "../support/rc_crypto/nss" }

0 commit comments

Comments
 (0)