You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let opentelemetry_context1 = OpenTelemetryContext::from_str("{\"traceparent\":\"00-b9ce70eaad5a86ef6b9fa4db00589e86-8e2d99c5e5ed66e4-01\",\"tracestate\":\"\"}").unwrap();
249
-
let start1 = Utc::now();
250
-
let host_journey1 = Journey::new(opentelemetry_context1.clone(),None, start1);
let opentelemetry_context2 = OpenTelemetryContext::from_str("{\"traceparent\":\"00-b9ce70eaad5a86ef6b9fa4db00589e86-8e2d99c5e5ed66e4-02\",\"tracestate\":\"\"}").unwrap();
271
-
let start2 = start1.add(Duration::from_secs(1000));
let actual = repository.get_host_journey(start2).await?;
287
-
assert_eq!(actual,Some(host_journey2.clone()));
288
-
assert_eq!(
289
-
host_journey2.previous_opentelemetry_context(),
290
-
Some(host_journey1.opentelemetry_context())
291
-
);
244
+
let repository:Arc<dynJourneysRepository> =
245
+
Arc::new(JourneysSqlxDatabase::new(db));
246
+
247
+
// create and store a the first host journey
248
+
let opentelemetry_context1 = OpenTelemetryContext::from_str("{\"traceparent\":\"00-b9ce70eaad5a86ef6b9fa4db00589e86-8e2d99c5e5ed66e4-01\",\"tracestate\":\"\"}").unwrap();
249
+
let start1 = Utc::now();
250
+
let host_journey1 = Journey::new(opentelemetry_context1.clone(),None, start1);
let opentelemetry_context2 = OpenTelemetryContext::from_str("{\"traceparent\":\"00-b9ce70eaad5a86ef6b9fa4db00589e86-8e2d99c5e5ed66e4-02\",\"tracestate\":\"\"}").unwrap();
271
+
let start2 = start1.add(Duration::from_secs(1000));
let opentelemetry_context1 = OpenTelemetryContext::from_str("{\"traceparent\":\"00-b9ce70eaad5a86ef6b9fa4db00589e86-8e2d99c5e5ed66e4-01\",\"tracestate\":\"\"}").unwrap();
let opentelemetry_context2 = OpenTelemetryContext::from_str("{\"traceparent\":\"00-b9ce70eaad5a86ef6b9fa4db00589e86-8e2d99c5e5ed66e4-02\",\"tracestate\":\"\"}").unwrap();
336
-
let start2 = start1.add(Duration::from_secs(1000));
337
-
let project_journey2 = ProjectJourney::new(
338
-
"project_id",
339
-
opentelemetry_context2.clone(),
340
-
Some(opentelemetry_context1),
341
-
start2,
342
-
);
343
-
repository
344
-
.store_project_journey(project_journey2.clone())
345
-
.await?;
346
-
347
-
// retrieve the journey based on the time
348
-
// right before the journey 2 start -> Some(journey1)
349
-
// equal or after the journey 2 start -> Some(journey2)
let opentelemetry_context1 = OpenTelemetryContext::from_str("{\"traceparent\":\"00-b9ce70eaad5a86ef6b9fa4db00589e86-8e2d99c5e5ed66e4-01\",\"tracestate\":\"\"}").unwrap();
let opentelemetry_context2 = OpenTelemetryContext::from_str("{\"traceparent\":\"00-b9ce70eaad5a86ef6b9fa4db00589e86-8e2d99c5e5ed66e4-02\",\"tracestate\":\"\"}").unwrap();
336
+
let start2 = start1.add(Duration::from_secs(1000));
337
+
let project_journey2 = ProjectJourney::new(
338
+
"project_id",
339
+
opentelemetry_context2.clone(),
340
+
Some(opentelemetry_context1),
341
+
start2,
342
+
);
343
+
repository
344
+
.store_project_journey(project_journey2.clone())
345
+
.await?;
346
+
347
+
// retrieve the journey based on the time
348
+
// right before the journey 2 start -> Some(journey1)
349
+
// equal or after the journey 2 start -> Some(journey2)
0 commit comments