Skip to content

Conversation

@inf17101
Copy link
Contributor

@inf17101 inf17101 commented Jan 23, 2026

Issues: #450

The PR introduces the following changes:

  • --detailed (-d) event CLI flag for the cli to enable the output of the initial state response when subscribing to events
  • removes the boolean flags in the receive_next_event function
  • removes duplicated code for subscribing to the events with the CLI (now: reuse of get_complete_state)
  • removes unsafe code in event unit tests
  • refactors unit tests to also assert not only that events are received but also that event output is called
  • changed an existing swdd to include the new cli detailed flag
  • adds an stest for the new cli flag
  • renaming of an stest keyword to subscribe to events

Definition of Done

The PR shall be merged only if all items mentioned in CONTRIBUTING.md have been followed. In case an item is not applicable as described, please provide a short explanation in the description.

@inf17101 inf17101 mentioned this pull request Jan 23, 2026
20 tasks
@inf17101 inf17101 added the enhancement New feature or request. Issue will appear in the change log "Features" label Jan 23, 2026
Status: approved

The Ankaios CLI shall provide a function to get real-time state change events from the Ankaios server with a field mask as argument for filtering events to specific parts of the state.
The Ankaios CLI shall provide a function to get real-time state change events from the Ankaios server with the following arguments:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Shall we increase the swdd id of this requirement?

Copy link
Contributor

Choose a reason for hiding this comment

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

As we not only made the requirement more specific, but changed how we understand it (the part with the details is added), I would increase the SwDD ID.

#[arg(short = 'o', value_enum, default_value_t = OutputFormat::Yaml)]
output_format: OutputFormat,
/// Specify if the first complete state response shall be included in the output
#[arg(short = 'd', long = "detailed", default_value_t = false)]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can discuss about a better argument name with pleasure. I tried to avoid introducing a flag for already known intention.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe "--include-current" and "-c"? I think it describes the argument better. The name "detailed" implies it return more information all the time, not only at the beginning.

@christoph-hamm christoph-hamm self-requested a review January 26, 2026 13:35
Comment on lines +47 to +64
# [stest->swdd~cli-provides-get-events-command~1]
Test Ankaios CLI get events with initial complete state output
[Documentation] Subscribe to events and output initial complete state response
[Setup] Setup Ankaios

# Preconditions
Given Podman has deleted all existing containers
And Ankaios server is started with manifest "${CONFIGS_DIR}/nginx.yaml"
And Ankaios server is available
And Ankaios agent is started with name "agent_A"
# Actions
When user starts the CLI to subscribe to events with detailed mode enabled with format "yaml" and field mask "desiredState.workloads" in background
And the user waits "1" seconds
# Asserts
Then the event output shall contain workload "nginx"
And the event output shall be valid yaml format
And the event output shall contain only desiredState workloads
[Teardown] Clean up Ankaios
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be better if this test is more similar to "Test Ankaios CLI get events with field mask filter", updating the state after subscribing to the events. Then we could test if getting the initial state and getting events work on the same time.

Status: approved

The Ankaios CLI shall provide a function to get real-time state change events from the Ankaios server with a field mask as argument for filtering events to specific parts of the state.
The Ankaios CLI shall provide a function to get real-time state change events from the Ankaios server with the following arguments:
Copy link
Contributor

Choose a reason for hiding this comment

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

As we not only made the requirement more specific, but changed how we understand it (the part with the details is added), I would increase the SwDD ID.

#[arg(short = 'o', value_enum, default_value_t = OutputFormat::Yaml)]
output_format: OutputFormat,
/// Specify if the first complete state response shall be included in the output
#[arg(short = 'd', long = "detailed", default_value_t = false)]
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe "--include-current" and "-c"? I think it describes the argument better. The name "detailed" implies it return more information all the time, not only at the beginning.

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

Labels

enhancement New feature or request. Issue will appear in the change log "Features" ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants