Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit tests #34

Merged
merged 32 commits into from
Aug 12, 2024
Merged

Unit tests #34

merged 32 commits into from
Aug 12, 2024

Conversation

crbelaus
Copy link
Contributor

@crbelaus crbelaus commented Aug 6, 2024

Adds unit tests for:

  • ErrorTracker.
    • report/3
      • with a runtime exception
      • with a bad arithmetic error
      • with an unknown function error
      • with a throw
      • with an exit
    • resolve/1
    • unresolve/1
  • Telemetry
    • verifies that events are emitted

Tests can run either on PostgreSQL or SQLite3. This is determined by the DB env var so:

  • DB=postgres mix test runs the tests on PostgreSQL
  • DB=sqlite mix test runs the tests on SQLite3

The CI has been also updated to run tests on both databases.


I've also unified the configuration under the config/ folder. And the dev/test migrations under priv/repo/.

Previously we had some configuration in the root folder and other in config/. Regarding the migrations the priv/repo/ folder is not included when publishing the package but is used in dev/test.

@crbelaus crbelaus self-assigned this Aug 6, 2024
@odarriba odarriba mentioned this pull request Aug 7, 2024
@crbelaus crbelaus modified the milestone: v0.2.0 Aug 7, 2024
@crbelaus crbelaus added the enhancement New feature or request label Aug 7, 2024
@crbelaus crbelaus marked this pull request as ready for review August 7, 2024 17:10
@@ -1,8 +1,102 @@
defmodule ErrorTrackerTest do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that we have Telemetry in main, can we test that events are emitted too?

I saw some references on how to do it on here: https://github.com/dashbitco/broadway/blob/main/test/broadway_test.exs#L311

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a new test case for telemetry events! 🚀

@crbelaus crbelaus mentioned this pull request Aug 8, 2024
Copy link
Contributor

@odarriba odarriba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@odarriba odarriba merged commit dd76462 into main Aug 12, 2024
3 checks passed
@odarriba odarriba deleted the unit-tests branch August 12, 2024 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants