Skip to content

Commit 0a9724e

Browse files
committed
Fix and refactor tests
1 parent 1e4d9ae commit 0a9724e

File tree

6 files changed

+225
-152
lines changed

6 files changed

+225
-152
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mobile_config/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ task-manager = { path = "../task_manager" }
6060
tls-init = { path = "../tls_init" }
6161

6262
[dev-dependencies]
63+
derive_builder = "0.20"
6364
rand = { workspace = true }
6465
tokio-stream = { workspace = true, features = ["net"] }
6566
tempfile = "3"

mobile_config/src/gateway/metadata_db.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ impl MobileHotspotInfo {
140140
None
141141
},
142142
location_asserts: self.num_location_asserts.map(|n| n as u32),
143+
owner: None, // TODO
144+
hash_v2: None,
143145
}))
144146
}
145147
}

mobile_config/tests/integrations/gateway_db.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,5 +201,7 @@ fn gw(address: PublicKeyBinary, gateway_type: GatewayType, t: chrono::DateTime<U
201201
location: Some(123),
202202
location_changed_at: None,
203203
location_asserts: Some(5),
204+
owner: None,
205+
hash_v2: None,
204206
}
205207
}

mobile_config/tests/integrations/gateway_service.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ async fn gateway_stream_info_v1(pool: PgPool) -> anyhow::Result<()> {
127127
location: Some(loc1),
128128
location_changed_at: Some(now),
129129
location_asserts: Some(1),
130+
owner: None,
131+
hash_v2: None,
130132
};
131133
gateway1.insert(&pool).await?;
132134

@@ -144,6 +146,8 @@ async fn gateway_stream_info_v1(pool: PgPool) -> anyhow::Result<()> {
144146
location: Some(loc2),
145147
location_changed_at: Some(now_plus_10),
146148
location_asserts: Some(1),
149+
owner: None,
150+
hash_v2: None,
147151
};
148152
gateway2.insert(&pool).await?;
149153

@@ -192,6 +196,8 @@ async fn gateway_stream_info_v2_by_type(pool: PgPool) -> anyhow::Result<()> {
192196
location: Some(loc1),
193197
location_changed_at: Some(now),
194198
location_asserts: Some(1),
199+
owner: None,
200+
hash_v2: None,
195201
};
196202
gateway1.insert(&pool).await?;
197203

@@ -209,6 +215,8 @@ async fn gateway_stream_info_v2_by_type(pool: PgPool) -> anyhow::Result<()> {
209215
location: Some(loc2),
210216
location_changed_at: Some(now_plus_10),
211217
location_asserts: Some(1),
218+
owner: None,
219+
hash_v2: None,
212220
};
213221
gateway2.insert(&pool).await?;
214222

@@ -263,6 +271,8 @@ async fn gateway_stream_info_v2(pool: PgPool) -> anyhow::Result<()> {
263271
location: Some(loc1),
264272
location_changed_at: Some(inserted_at),
265273
location_asserts: Some(1),
274+
owner: None,
275+
hash_v2: None,
266276
};
267277
gateway1.insert(&pool).await?;
268278

@@ -280,6 +290,8 @@ async fn gateway_stream_info_v2(pool: PgPool) -> anyhow::Result<()> {
280290
location: Some(loc2),
281291
location_changed_at: Some(inserted_at),
282292
location_asserts: Some(1),
293+
owner: None,
294+
hash_v2: None,
283295
};
284296
gateway2.insert(&pool).await?;
285297

@@ -297,6 +309,8 @@ async fn gateway_stream_info_v2(pool: PgPool) -> anyhow::Result<()> {
297309
location: Some(loc3),
298310
location_changed_at: Some(inserted_at),
299311
location_asserts: Some(1),
312+
owner: None,
313+
hash_v2: None,
300314
};
301315
gateway3.insert(&pool).await?;
302316

@@ -314,6 +328,8 @@ async fn gateway_stream_info_v2(pool: PgPool) -> anyhow::Result<()> {
314328
location: Some(loc4),
315329
location_changed_at: Some(created_at),
316330
location_asserts: Some(1),
331+
owner: None,
332+
hash_v2: None,
317333
};
318334
gateway4.insert(&pool).await?;
319335

@@ -415,6 +431,8 @@ async fn gateway_info_batch_v1(pool: PgPool) -> anyhow::Result<()> {
415431
location: Some(loc1),
416432
location_changed_at: Some(inserted_at),
417433
location_asserts: Some(1),
434+
owner: None,
435+
hash_v2: None,
418436
};
419437
gateway1.insert(&pool).await?;
420438

@@ -432,6 +450,8 @@ async fn gateway_info_batch_v1(pool: PgPool) -> anyhow::Result<()> {
432450
location: Some(loc2),
433451
location_changed_at: Some(created_at),
434452
location_asserts: Some(1),
453+
owner: None,
454+
hash_v2: None,
435455
};
436456
gateway2.insert(&pool).await?;
437457

@@ -501,6 +521,8 @@ async fn gateway_info_batch_v2(pool: PgPool) -> anyhow::Result<()> {
501521
location: Some(loc1),
502522
location_changed_at: Some(inserted_at),
503523
location_asserts: Some(1),
524+
owner: None,
525+
hash_v2: None,
504526
};
505527
gateway1.insert(&pool).await?;
506528

@@ -518,6 +540,8 @@ async fn gateway_info_batch_v2(pool: PgPool) -> anyhow::Result<()> {
518540
location: Some(loc2),
519541
location_changed_at: Some(created_at),
520542
location_asserts: Some(1),
543+
owner: None,
544+
hash_v2: None,
521545
};
522546
gateway2.insert(&pool).await?;
523547

@@ -610,6 +634,8 @@ async fn gateway_info_batch_v2_updated_at_check(pool: PgPool) -> anyhow::Result<
610634
location: Some(loc1),
611635
location_changed_at: Some(refreshed_at),
612636
location_asserts: Some(1),
637+
owner: None,
638+
hash_v2: None,
613639
};
614640
gateway1.insert(&pool).await?;
615641

@@ -627,6 +653,8 @@ async fn gateway_info_batch_v2_updated_at_check(pool: PgPool) -> anyhow::Result<
627653
location: Some(loc2),
628654
location_changed_at: Some(created_at),
629655
location_asserts: Some(1),
656+
owner: None,
657+
hash_v2: None,
630658
};
631659
gateway2.insert(&pool).await?;
632660

@@ -644,6 +672,8 @@ async fn gateway_info_batch_v2_updated_at_check(pool: PgPool) -> anyhow::Result<
644672
location: Some(loc3),
645673
location_changed_at: Some(inserted_at),
646674
location_asserts: Some(1),
675+
owner: None,
676+
hash_v2: None,
647677
};
648678
gateway3.insert(&pool).await?;
649679

@@ -661,6 +691,8 @@ async fn gateway_info_batch_v2_updated_at_check(pool: PgPool) -> anyhow::Result<
661691
location: Some(loc4),
662692
location_changed_at: Some(created_at),
663693
location_asserts: Some(1),
694+
owner: None,
695+
hash_v2: None,
664696
};
665697
gateway4.insert(&pool).await?;
666698

@@ -740,6 +772,8 @@ async fn gateway_info_v2(pool: PgPool) -> anyhow::Result<()> {
740772
location: Some(loc1),
741773
location_changed_at: Some(refreshed_at),
742774
location_asserts: Some(1),
775+
owner: None,
776+
hash_v2: None,
743777
};
744778
gateway1.insert(&pool).await?;
745779

@@ -757,6 +791,8 @@ async fn gateway_info_v2(pool: PgPool) -> anyhow::Result<()> {
757791
location: Some(loc2),
758792
location_changed_at: Some(created_at),
759793
location_asserts: Some(1),
794+
owner: None,
795+
hash_v2: None,
760796
};
761797
gateway2.insert(&pool).await?;
762798

@@ -837,6 +873,8 @@ async fn gateway_info_at_timestamp(pool: PgPool) -> anyhow::Result<()> {
837873
location: Some(loc_original),
838874
location_changed_at: Some(refreshed_at),
839875
location_asserts: Some(1),
876+
owner: None,
877+
hash_v2: None,
840878
};
841879
gateway_original.insert(&pool).await?;
842880

@@ -862,6 +900,8 @@ async fn gateway_info_at_timestamp(pool: PgPool) -> anyhow::Result<()> {
862900
location: Some(loc_recent),
863901
location_changed_at: Some(created_at),
864902
location_asserts: Some(1),
903+
owner: None,
904+
hash_v2: None,
865905
};
866906
gateway_recent.insert(&pool).await?;
867907

0 commit comments

Comments
 (0)