Skip to content

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

Open
PranjaliBhardwaj wants to merge 1 commit into
microcks:masterfrom
PranjaliBhardwaj:testing
Open

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

Conversation

@PranjaliBhardwaj
Copy link
Copy Markdown

@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>
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