Skip to content

Add CI workflow and Makefile target for unit tests#861

Open
ChughShilpa wants to merge 1 commit into
opendatahub-io:mainfrom
ChughShilpa:unitTest
Open

Add CI workflow and Makefile target for unit tests#861
ChughShilpa wants to merge 1 commit into
opendatahub-io:mainfrom
ChughShilpa:unitTest

Conversation

@ChughShilpa
Copy link
Copy Markdown
Contributor

@ChughShilpa ChughShilpa commented May 30, 2026

Description

  • Add .github/workflows/go-unit-test.yml that runs go test ./tests/common/support/... on PRs and pushes to main
  • Add make unit-test Makefile target for local convenience

Why

The support package has 13 unit test files that validate shared helpers (fake clients, resource builders, environment getters, etc.). A regression here could silently break assumptions across all e2e test suites.

How Has This Been Tested?

  • go test ./tests/common/support/... passed locally
    • Verify workflow triggers on a PR that touches Go files

Merge criteria:

  • The commits are squashed in a cohesive manner and have meaningful messages.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work

Summary by CodeRabbit

  • Chores
    • Added automated unit testing workflow triggered on Go file changes.
    • Added make target for running unit tests for support packages.

The support package (tests/common/support) has 13 unit test files
that validate shared test helpers using fake Kubernetes clients.
These were not being run in CI. Add a GitHub Actions workflow
and a `make unit-test` target to cover them.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ChughShilpa ChughShilpa requested a review from sutaakar May 30, 2026 12:39
@openshift-ci openshift-ci Bot requested review from Fiona-Waters and efazal May 30, 2026 12:39
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 30, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign kramaranya for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 30, 2026

📝 Walkthrough

Walkthrough

This PR introduces automated unit testing for support packages. A new GitHub Actions workflow (.github/workflows/go-unit-test.yml) is added that triggers on pushes and pull requests affecting Go files or module files, checks out the repository, configures Go using go.mod, and runs go test ./tests/common/support/... with read-only permissions. A corresponding Makefile target unit-test is also added to allow local execution of the same test suite.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main changes: adding a CI workflow (.github/workflows/go-unit-test.yml) and a Makefile target (unit-test), both for running unit tests.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/go-unit-test.yml:
- Line 22: Replace tag-based action references with full commit SHAs: locate the
workflow steps that use actions via tag refs (e.g., the uses entry
"actions/checkout@v4" and any other "uses: ...@vX" like the one on line 24) and
update them to pin to the corresponding full commit SHA for that action
repository; ensure every uses: entry in the file references a commit SHA instead
of a tag and verify the SHAs match the trusted release commits for
actions/checkout and any other third-party actions.
- Line 22: The checkout step currently uses actions/checkout@v4 without
disabling credential persistence; update the checkout invocation (the step using
actions/checkout@v4) to include persist-credentials: false so the GITHUB_TOKEN
is not written to .git/config and cannot be reused by subsequent steps or
actions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: f5a3b5af-1697-4031-9739-678e8cf31dcb

📥 Commits

Reviewing files that changed from the base of the PR and between 96867f4 and c5d1928.

📒 Files selected for processing (2)
  • .github/workflows/go-unit-test.yml
  • Makefile

Comment thread .github/workflows/go-unit-test.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant