Skip to content

Conversation

@thaJeztah
Copy link
Member

cli/command/context: add test-utility to create multiple contexts

cli/command/context: test inspecting context with custom metadata

The CLI does not currently expose options to add custom metadata to
contexts, but contexts support them.

  • update test-utilities to allow setting custom metadata
  • update the inspect test to verify that custom metadata is included
    when inspecting a context.

cli/command/context: list: add test for JSON output

- A picture of a cute animal (not mandatory but encouraged)

thaJeztah added 3 commits May 31, 2024 10:31
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The CLI does not currently expose options to add custom metadata to
contexts, but contexts support them.

- update test-utilities to allow setting custom metadata
- update the inspect test to verify that custom metadata is included
  when inspecting a context.
- update the import/export tests to verify that custom metadata
  is preserved.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.34%. Comparing base (8ed44f9) to head (40a1da8).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5097      +/-   ##
==========================================
- Coverage   61.36%   61.34%   -0.03%     
==========================================
  Files         298      295       -3     
  Lines       20706    20702       -4     
==========================================
- Hits        12707    12700       -7     
- Misses       7099     7100       +1     
- Partials      900      902       +2     

@@ -0,0 +1,5 @@
{"Current":false,"Description":"description of context1","DockerEndpoint":"https://someswarmserver.example.com","Error":"","Name":"context1"}
Copy link
Contributor

Choose a reason for hiding this comment

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

Given the TestListJSON test above, shouldn't context1-2-3 contain the additional Type: metadata?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not currently, no; the JSON output in list format doesn't output the "raw" metadata, and doesn't include custom fields currently.

Should it include these? Maybe, maybe not (at least inspect shows them), but it's currently expected for them to not be here.

@thaJeztah thaJeztah requested a review from laurazard May 31, 2024 09:54
Copy link
Collaborator

@laurazard laurazard left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the patch

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants