Skip to content

Draft: Resolve "Find way to test Snowplow event tracking without creating new thread"

What does this MR do?

Create an rspec hook to help test snowplow events. This hook will be applied to all tests annotated with snowplow. It does two things:

  1. Enable the application setting for snowplow.
  2. Replace the AsyncEmitter with Emitter. We want to avoid AsyncEmitter because it does some work in a separate thread, and we want any failures to occur in the same thread as the test.

Instead of stubbing Gitlab::Tracking, we want to ensure that tests execute this code. The SnowplowTracker library does type checks for parameters passed to it, and we want these type errors to surface in the tests, rather than at runtime.

Related to #238552 (closed)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Closes #238552 (closed)

Edited by Alishan Ladhani

Merge request reports