Skip to content

Commit a3b2cda

Browse files
Refactoring tests
1 parent e166d18 commit a3b2cda

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

x-pack/plugin/inference/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/xpack/application/AuthorizationTaskExecutorUpgradeIT.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,17 @@ public void testUpgradeAuthorizationTaskExecutor() throws Exception {
6060
oldClusterHasFeature(BEFORE_AUTHORIZATION_TASK_FEATURE)
6161
);
6262

63-
// If the old cluster already has the feature for the authorization polling task, the task should already exist
64-
// We only want to test when upgrading from a version that does not have the task
65-
if (oldClusterHasFeature(INFERENCE_AUTH_POLLER_PERSISTENT_TASK) == false) {
66-
if (isOldCluster()) {
67-
// if we're on a version prior to the authorization polling task, the task should not be created
68-
assertFalse(doesAuthPollingTaskExist());
69-
}
70-
if (isMixedCluster()) {
71-
// if we're in the middle of an upgrade where some nodes are upgraded and some are not, the task should
72-
// still not be created. It should wait until all nodes are upgraded
63+
final var oldHasAuthTaskFeature = oldClusterHasFeature(INFERENCE_AUTH_POLLER_PERSISTENT_TASK);
64+
65+
if (isOldCluster() || isMixedCluster()) {
66+
if (oldHasAuthTaskFeature == false) {
67+
// If cluster version does not have the authorization polling task feature:
68+
// The task must not exist on a non-upgraded or mixed cluster.
7369
assertFalse(doesAuthPollingTaskExist());
70+
} else {
71+
// If cluster version already has the feature:
72+
// The task must already exist on non-upgraded or mixed cluster.
73+
assertBusy(() -> assertTrue(doesAuthPollingTaskExist()));
7474
}
7575
}
7676

0 commit comments

Comments
 (0)