Log more data for PrevalidateShardPathIT#testCheckShards (#109887)

`PrevalidateShardPathIT#testCheckShards` still keeps failing on CI, so we need more logging.

* Add debug logging for `MasterService` events to verify that a cluster service update is triggered.
* Log explanation for stuck shards regardless whether they are located on node_2 in the cluster state.

See #104807
This commit is contained in:
Artem Prigoda 2024-06-19 16:06:23 +02:00 committed by GitHub
parent b65e02c601
commit 0145a41ea5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View file

@ -67,9 +67,6 @@ tests:
- class: "org.elasticsearch.xpack.shutdown.NodeShutdownReadinessIT"
issue: "https://github.com/elastic/elasticsearch/issues/109838"
method: "testShutdownReadinessService"
- class: "org.elasticsearch.cluster.PrevalidateShardPathIT"
issue: "https://github.com/elastic/elasticsearch/issues/104807"
method: "testCheckShards"
- class: "org.elasticsearch.packaging.test.RpmPreservationTests"
issue: "https://github.com/elastic/elasticsearch/issues/109898"
method: "test30PreserveConfig"
@ -82,6 +79,7 @@ tests:
issue: "https://github.com/elastic/elasticsearch/issues/109915"
method: "testRandomMultiValuesTopN"
# Examples:
#
# Mute a single test case in a YAML test suite:

View file

@ -22,6 +22,7 @@ import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.ChunkedToXContent;
import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.test.junit.annotations.TestLogging;
import java.util.HashSet;
import java.util.List;
@ -39,6 +40,10 @@ import static org.hamcrest.Matchers.equalTo;
@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, numDataNodes = 0)
public class PrevalidateShardPathIT extends ESIntegTestCase {
@TestLogging(
value = "org.elasticsearch.cluster.service.MasterService:DEBUG",
reason = "https://github.com/elastic/elasticsearch/issues/104807"
)
public void testCheckShards() throws Exception {
internalCluster().startMasterOnlyNode();
String node1 = internalCluster().startDataOnlyNode();
@ -95,7 +100,6 @@ public class PrevalidateShardPathIT extends ESIntegTestCase {
.allShards()
.filter(s -> s.getIndexName().equals(indexName))
.filter(s -> node2ShardIds.contains(s.shardId()))
.filter(s -> s.currentNodeId().equals(node2Id))
.toList();
logger.info("Found {} shards on the relocation source node {} in the cluster state", node2Shards, node2Id);
for (var node2Shard : node2Shards) {