Skip to content

4d: Integration testing — Sentry SDK → TrapFall end-to-end #251

Description

@ajianaz

Parent: #234 · Blocked by: #250

Scope

End-to-end integration test: Rungu/CIRA → Sentry SDK → TrapFall. Verify events arrive correctly and display in dashboard.

Test Matrix

Test SDK Config Expected TrapFall Result
Error capture SentryHttpLayer only Event in project with correct message, stacktrace, context
Panic capture panic!() in handler Event with mechanism: panic, thread name, stacktrace
Tracing bridge tracing::error!("msg") Event with logger integration, message
HTTP context GET /api/test → 500 Event with request URL, method, status code, headers
User context Authenticated request Event with user.id, user.email tags
DSN disabled SENTRY_DSN="" No events sent, no errors logged
Transaction NOT sent Default config Zero transaction envelopes (Phase 1)

Test Infrastructure

#[cfg(test)]
mod integration {
    use trapfall_test::TrapfallServer;
    
    fn start_trapfall() -> TrapfallServer {
        TrapfallServer::new()
            .with_project("test-proj")
            .start()
    }
    
    #[tokio::test]
    async fn test_error_captured() {
        let tf = start_trapfall();
        let dsn = tf.project_dsn("test-proj");
        
        let _guard = sentry::init(sentry::ClientOptions {
            dsn: Some(dsn.parse().unwrap()),
            ..Default::default()
        });
        
        // Simulate Axum error
        sentry::capture_message("test error", sentry::Level::Error);
        
        // Flush
        sentry::flush(some_timeout);
        
        // Assert: event exists in TrapFall
        let events = tf.get_events("test-proj").await;
        assert_eq!(events.len(), 1);
        assert_eq!(events[0].message, "test error");
    }
}

Tasks

  • Create trapfall-test helper crate (start TrapFall in-test, expose DSN, query events)
  • Test: error event arrives with correct fields
  • Test: panic event arrives with mechanism + stacktrace
  • Test: HTTP context (URL, method, status) attached
  • Test: DSN disabled → no network calls, no errors
  • Test: user context (id, email, ip) forwarded
  • CI: add integration test step to GitHub Actions (depends on TrapFall running)
  • Document: test coverage expectations (minimum 80% for SDK integration)

Effort: ~2 hours

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestscope:sdkSentry SDK integration in client apps (Rungu/CIRA)type:envelopeSentry envelope item type expansion

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions