Skip to content

test(scripts): add bats coverage for ublue-motd and profile.d scripts - #628

Merged
castrojo merged 1 commit into
mainfrom
feat/test-ublue-motd
Jun 11, 2026
Merged

test(scripts): add bats coverage for ublue-motd and profile.d scripts#628
castrojo merged 1 commit into
mainfrom
feat/test-ublue-motd

Conversation

@castrojo

Copy link
Copy Markdown
Contributor

Summary

Adds tests/test_ublue_motd.bats covering ublue-motd and its profile.d companion scripts, which run in every interactive shell session.

Test cases

ublue-motd

  • Template file existence check (graceful handling when template missing)
  • envsubst expansion behavior
  • tput terminal detection (non-tty path)
  • glow rendering when glow is present vs absent
  • Normal output path with fixture template

ublue-motd.sh profile.d

  • $HOME/.config/no-show-user-motd opt-out toggle — motd is suppressed when file exists
  • Normal invocation path (opt-out file absent)

umotd.sh profile.d

  • Unconditional umotd invocation

CI changes

  • Adds shellcheck entries for motd scripts (if extensionless)
  • Adds Run bats (ublue-motd) step

Notes

unit-tests.yml is also modified by other test PRs from this sprint. Changes are additive; minor rebases may be needed.

Closes #590

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@castrojo, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 58 minutes and 58 seconds. Learn how PR review limits work.

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3e2a7f53-0d58-40de-be57-c8f0b2584a75

📥 Commits

Reviewing files that changed from the base of the PR and between a717784 and 9c8fb0b.

📒 Files selected for processing (3)
  • .github/workflows/unit-tests.yml
  • system_files/shared/usr/bin/ublue-motd
  • tests/test_ublue_motd.bats
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/test-ublue-motd

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Closes #590

Assisted-by: Claude Sonnet 4.6 via GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@hanthor hanthor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This was generated by AI during triage.

Verdict: LGTM 🟢

Excellent test coverage for ublue-motd and profile.d scripts. The mock logging approach (envsubst.stdin, glow.args, glow.stdin, tput.args) makes assertions precise and debuggable. Good edge-case coverage (missing template, missing glow, opt-out, non-tty). Clean quoting fix in source.

@castrojo
castrojo merged commit a9057c6 into main Jun 11, 2026
8 checks passed
@castrojo
castrojo deleted the feat/test-ublue-motd branch June 11, 2026 11:31
@castrojo castrojo added 4-review A pull request is awaiting review. and removed area/bling labels Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4-review A pull request is awaiting review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] ublue-motd and umotd profile.d scripts lack unit test coverage

2 participants