Skip to content

Conversation

@balanza
Copy link
Member

@balanza balanza commented Nov 20, 2025

In HANA cluster, allow secondary nodes to be started only when the primary is already online (and vice versa)

@balanza balanza added the env Create an ephimeral environment for the pr branch label Nov 20, 2025
@github-actions
Copy link

The preview environment for this pull request is ready at 3914.prenv.trento.suse.com.

Copy link
Member

@nelsonkopliku nelsonkopliku left a comment

Choose a reason for hiding this comment

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

Hey @balanza thanks a lot!

Besides the inline comments what I am wondering is whether we can have some policy specific tests in the policy test and possibly simplify controller tests.

I am aware, though, that test arrangement would be actually very similar if not the same and what would change is the assertion.

Comment on lines 515 to 529
assert %{
assigns: %{
cluster: %{
hosts: [host_data]
}
}
} = posted_conn

assert %{
id: ^host_id,
database_instances: ^database_instances,
application_instances: ^application_instances,
cluster_id: ^cluster_id
} = host_data
Copy link
Member

Choose a reason for hiding this comment

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

question: this assertion should be true for all the operations available on a cluster host, correct?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes.

Ideally, we might want to separate tests for any operation from tests specific to an operation, like in #3890.

I didn't have the spark to make this refactoring this time

@balanza
Copy link
Member Author

balanza commented Nov 20, 2025

I am aware, though, that test arrangement would be actually very similar if not the same and what would change is the assertion.

Very same, but with more mocks :)

Copy link
Member

@nelsonkopliku nelsonkopliku left a comment

Choose a reason for hiding this comment

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

Hey @balanza thanks again!

I left a few more minor comments/questions, but in general I think we're there.

As long as @abravosuse has tested the latest changes in this PR and we have his green light as well, then let merge.


I am realizing that we might need to look for ways to improve testing different layers without having to actually duplicate test arrangement, but this is for another time.

@balanza
Copy link
Member Author

balanza commented Nov 21, 2025

thought: besides how we arrange the condition, I am thinking about a case where database_instances is an empty list and thus host_running_primary? is false.

In this case all_sr_instances_with_state? would return true, even on empty list.

you could verify it by looking at should successfully perform #{operation} when the user has #{operation}:cluster ability >test which passes. But the question is: should it pass in that case?

Same thoughts applicable to the inverse function.

After reviewing the scenarios, we decided that:

  • we do not consider clusters that are never been discovered as online
  • for HANA clusters, we can start nodes only if at least one primary database is registered
  • for ASCS/ERS clusters, we do not need further checks

Copy link
Contributor

@abravosuse abravosuse left a comment

Choose a reason for hiding this comment

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

Based on the tests performed against different HANA clusters, it LGTM. See https://jira.suse.com/browse/TRNT-4044 for details.

@balanza balanza force-pushed the refine-cluster-startstop-policy branch from fc1e8a6 to 3373fb2 Compare November 21, 2025 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

env Create an ephimeral environment for the pr branch

Development

Successfully merging this pull request may close these issues.

4 participants