Skip to content

test: increase test coverage for activity package formatters#419

Open
mwbrooks wants to merge 3 commits intomainfrom
mwbrooks-test-coverage-6
Open

test: increase test coverage for activity package formatters#419
mwbrooks wants to merge 3 commits intomainfrom
mwbrooks-test-coverage-6

Conversation

@mwbrooks
Copy link
Member

@mwbrooks mwbrooks commented Mar 19, 2026

Changelog

  • N/A

Summary

This pull request increases the test coverage of internal/pkg/platform/activity:

  • Add unit tests for all activity log formatting helper functions
  • Brings coverage for individual *ToString functions from 0% to 100%

The tests are separated into 2 PRs to keep things easier to review. While this is +534 lines, there are a lot of []string{} slices that expand across multiple lines.

Requirements

@mwbrooks mwbrooks added this to the Next Release milestone Mar 19, 2026
@mwbrooks mwbrooks self-assigned this Mar 19, 2026
@mwbrooks mwbrooks added code health M-T: Test improvements and anything that improves code health semver:patch Use on pull requests to describe the release version increment labels Mar 19, 2026
@codecov
Copy link

codecov bot commented Mar 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.18%. Comparing base (8b31c6a) to head (ae9affd).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #419      +/-   ##
==========================================
+ Coverage   68.62%   69.18%   +0.56%     
==========================================
  Files         218      218              
  Lines       18162    18162              
==========================================
+ Hits        12464    12566     +102     
+ Misses       4538     4434     -104     
- Partials     1160     1162       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Add tests for all activity log formatting functions including
prettifyActivity event type routing, external auth, function
execution, trigger, workflow, and datastore toString helpers.
@mwbrooks mwbrooks force-pushed the mwbrooks-test-coverage-6 branch from 3c7b76c to 57f433f Compare March 19, 2026 18:50
Copy link
Member Author

@mwbrooks mwbrooks left a comment

Choose a reason for hiding this comment

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

Comments for the kind ones!

Created: 1686939542000000,
}
result := externalAuthMissingSelectedAuthToString(activity)
assert.Contains(t, result, "Missing mapped token for workflow 'wf_abc'")
Copy link
Member Author

Choose a reason for hiding this comment

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

note: Don't love the hardcoded string here, but matching a partial also didn't feel right in this situation.

Copy link
Member

Choose a reason for hiding this comment

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

@mwbrooks I think this is a solid check to keep! 📠

The complete log format might be interesting to match if it's templated, but I don't know if this is needed before merge?

logTemplate = "%s [%s] [%s] (Trace=%s) %s"

@mwbrooks mwbrooks marked this pull request as ready for review March 19, 2026 20:43
@mwbrooks mwbrooks requested a review from a team as a code owner March 19, 2026 20:43
@mwbrooks mwbrooks changed the title test: increase test coverage for internal/pkg/platform/activity test: increase test coverage for activity package formatters Mar 19, 2026
Copy link
Member

@zimeg zimeg left a comment

Choose a reason for hiding this comment

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

@mwbrooks Another nice changeset! Thanks for the constant improvements 👾 ✨

These focused function tests remind me of the zig programming language pattern where tests can be inlined after logic? Interesting to think about!

Whenever's right let's merge this 🚢

Created: 1686939542000000,
}
result := externalAuthMissingSelectedAuthToString(activity)
assert.Contains(t, result, "Missing mapped token for workflow 'wf_abc'")
Copy link
Member

Choose a reason for hiding this comment

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

@mwbrooks I think this is a solid check to keep! 📠

The complete log format might be interesting to match if it's templated, but I don't know if this is needed before merge?

logTemplate = "%s [%s] [%s] (Trace=%s) %s"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code health M-T: Test improvements and anything that improves code health semver:patch Use on pull requests to describe the release version increment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants