Skip to content

refactor: use struct for test request and fix CLI typo#389

Merged
Harsh4902 merged 1 commit into
microcks:masterfrom
PranjaliBhardwaj:testing
May 16, 2026
Merged

refactor: use struct for test request and fix CLI typo#389
Harsh4902 merged 1 commit into
microcks:masterfrom
PranjaliBhardwaj:testing

Conversation

@PranjaliBhardwaj
Copy link
Copy Markdown
Contributor

@PranjaliBhardwaj PranjaliBhardwaj commented May 15, 2026

Description

Looking through pkg/connectors and it still appeared that CreateTestResult was manually creating the test result using string concatenation to build the JSON. It was a bit of a chore to read and I'm not sure why we needed to add more fields later on, but I replaced it with a proper testRequest struct and json.Marshal.

I used json.We don't need to convert those optional "flags" (like filteredOperations) to JSON because they are already JSON strings from the CLI. Don't worry, I'm not about to unmarshal them and then put them back in the payload, but this way we are able to use omitempty properly.

Also found a typo in the main entry point: NewCommad -> NewCommand. I can't tell if it was by design or not, but I could not find it in any other place than main.go, so I just fixed it.

Related issue(s) : #388

Implementation Summary
Introduced a new struct called internal testRequest into microcks_client.go.
Replaced manual concatenation of strings in CreateTestResult with json.Marshal.
Changed the name of NewCommad to NewCommand in file cmd/cmd.go and main.go.
How I tested this
Rebuilt locally to ensure that the rename didn't cause any problems.
Tested JSON output for omitempty, which seems to work for secretName.
No new test case created for this because it is largely a refactoring of existing behavior, but the existing client tests appear happy.

@github-actions
Copy link
Copy Markdown

👋 @PranjaliBhardwaj

Welcome to the Microcks community! 💖

Thanks and congrats 🎉 for opening your first pull request here! Be sure to follow the pull request template or please update it accordingly.

Hope you have a great time there!

Signed-off-by: Pranjali Bhardwaj <pranjalisharma6543@gmail.com>
Copy link
Copy Markdown
Member

@Harsh4902 Harsh4902 left a comment

Choose a reason for hiding this comment

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

LGTM

@Harsh4902 Harsh4902 merged commit 838325e into microcks:master May 16, 2026
5 checks passed
@github-actions
Copy link
Copy Markdown

🎉 @PranjaliBhardwaj

You are now a Microcks community contributor! 💖

Thanks and congrats 🚀 on merging your first pull request! We are delighted and very proud of you! 👏

📢 If you're using Microcks in your organization, please add your company name to this list. 🙏 It really helps the project to gain momentum and credibility. It's a small contribution back to the project with a big impact.

If you need to know why and how to add yourself to the list, please read the blog post "Join the Microcks Adopters list and Empower the vibrant open source Community 🙌"

Kudos and please keep going, we need you 🙌

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.

2 participants