-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve join logic to handle unreachable nodes (#560)
--------- Co-authored-by: Mateo Florido <32885896+mateoflorido@users.noreply.github.com> Co-authored-by: Louise K. Schmidtgen <louise.schmidtgen@canonical.com>
- Loading branch information
1 parent
4e15dae
commit f7167b5
Showing
2 changed files
with
41 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# | ||
# Copyright 2024 Canonical, Ltd. | ||
# | ||
from typing import List | ||
|
||
import pytest | ||
from test_util import harness, util | ||
|
||
|
||
@pytest.mark.node_count(3) | ||
def test_wrong_token_race(instances: List[harness.Instance]): | ||
cluster_node = instances[0] | ||
|
||
join_token = util.get_join_token(cluster_node, instances[1]) | ||
util.join_cluster(instances[1], join_token) | ||
|
||
new_join_token = util.get_join_token(cluster_node, instances[2]) | ||
|
||
cluster_node.exec(["k8s", "remove-node", instances[1].id]) | ||
|
||
another_join_token = util.get_join_token(cluster_node, instances[2]) | ||
|
||
# The join token should have changed after the node was removed as | ||
# it contains the ip addresses of all cluster nodes. | ||
assert ( | ||
new_join_token != another_join_token | ||
), "join token is not updated after node removal" | ||
util.join_cluster(instances[2], new_join_token) |