Fix EnsureNoWarning assertion (#73647)
EnsureNoWarnings method should assert that there is no other warnings than the allowed "predefined" warnings in filteredWarnings() method bug introduced in #71207
This commit is contained in:
parent
44c26c8bdc
commit
6d34a38cb1
|
@ -701,6 +701,8 @@ public abstract class MapperTestCase extends MapperServiceTestCase {
|
|||
} else {
|
||||
expectThrows(MapperParsingException.class, () -> mapper.parse(source(b -> b.nullField("field"))));
|
||||
}
|
||||
|
||||
assertWarnings(getParseMinimalWarnings());
|
||||
}
|
||||
|
||||
protected boolean allowsNullValues() {
|
||||
|
|
|
@ -54,7 +54,10 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static org.elasticsearch.cluster.coordination.ClusterBootstrapService.INITIAL_MASTER_NODES_SETTING;
|
||||
import static org.elasticsearch.discovery.SettingsBasedSeedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING;
|
||||
|
@ -187,6 +190,14 @@ public abstract class ESSingleNodeTestCase extends ESTestCase {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> filteredWarnings() {
|
||||
return Stream.concat(super.filteredWarnings().stream(),
|
||||
List.of("[index.data_path] setting was deprecated in Elasticsearch and will be removed in a future release! " +
|
||||
"See the breaking changes documentation for the next major version.").stream())
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private Node newNode() {
|
||||
final Path tempDir = createTempDir();
|
||||
final String nodeName = nodeSettings().get(Node.NODE_NAME_SETTING.getKey(), "node_s_0");
|
||||
|
|
|
@ -405,7 +405,7 @@ public abstract class ESTestCase extends LuceneTestCase {
|
|||
// unit tests do not run with the bundled JDK, if there are warnings we need to filter the no-jdk deprecation warning
|
||||
final List<String> filteredWarnings = warnings
|
||||
.stream()
|
||||
.filter(k -> filteredWarnings().stream().anyMatch(s -> s.contains(k)))
|
||||
.filter(k -> filteredWarnings().stream().noneMatch(s -> k.contains(s)))
|
||||
.collect(Collectors.toList());
|
||||
assertThat("unexpected warning headers", filteredWarnings, empty());
|
||||
} else {
|
||||
|
@ -418,9 +418,10 @@ public abstract class ESTestCase extends LuceneTestCase {
|
|||
|
||||
protected List<String> filteredWarnings() {
|
||||
if (JvmInfo.jvmInfo().getBundledJdk() == false) {
|
||||
return List.of("no-jdk distributions that do not bundle a JDK are deprecated and will be removed in a future release");
|
||||
return List.of("setting [path.shared_data] is deprecated and will be removed in a future release",
|
||||
"no-jdk distributions that do not bundle a JDK are deprecated and will be removed in a future release");
|
||||
} else {
|
||||
return List.of();
|
||||
return List.of("setting [path.shared_data] is deprecated and will be removed in a future release");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,8 @@ public class InternalTestClusterTests extends ESTestCase {
|
|||
protected List<String> filteredWarnings() {
|
||||
return Stream.concat(super.filteredWarnings().stream(),
|
||||
List.of("Configuring multiple [path.data] paths is deprecated. Use RAID or other system level features for utilizing " +
|
||||
"multiple disks. This feature will be removed in 8.0.").stream()).collect(Collectors.toList());
|
||||
"multiple disks. This feature will be removed in 8.0.").stream())
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public void testInitializiationIsConsistent() {
|
||||
|
|
|
@ -142,6 +142,9 @@ public class TransportNodeEnrollmentActionTests extends ESTestCase {
|
|||
assertSameCertificate(response.getTransportCert(), transportPath, "password".toCharArray(), false);
|
||||
assertThat(response.getNodesAddresses().size(), equalTo(numberOfNodes));
|
||||
assertThat(nodesInfoRequests.size(), equalTo(1));
|
||||
|
||||
assertWarnings("[keystore.password] setting was deprecated in Elasticsearch and will be removed in a future release! " +
|
||||
"See the breaking changes documentation for the next major version.");
|
||||
}
|
||||
|
||||
private void assertSameCertificate(String cert, Path original, char[] originalPassword, boolean isCa) throws Exception{
|
||||
|
|
Loading…
Reference in New Issue