mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-23 05:15:04 +00:00
Test: Fix a second case of bad watch creation
There was still a case with a null text that allowed for 0 attachments to be created. This commit ensures that greater than zero are created if the text is null. Otherwise, it uses the same logic to create 0 to 3 random attachments. Closes #31948
This commit is contained in:
parent
b7f07f03ed
commit
1bf205f862
@ -461,7 +461,6 @@ public class SlackMessageTests extends ESTestCase {
|
||||
assertThat(parsed, equalTo(template));
|
||||
}
|
||||
|
||||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/31948")
|
||||
public void testTemplateRender() throws Exception {
|
||||
Settings settings = SlackMessageDefaultsTests.randomSettings();
|
||||
SlackMessageDefaults defaults = new SlackMessageDefaults(settings);
|
||||
@ -483,7 +482,9 @@ public class SlackMessageTests extends ESTestCase {
|
||||
templateBuilder.setText(randomAlphaOfLength(10));
|
||||
}
|
||||
if (templateBuilder.text == null || randomBoolean()) {
|
||||
int count = randomIntBetween(0, 3);
|
||||
// ensure at least one attachment in the event the text is null
|
||||
int minimumAttachments = templateBuilder.text == null ? 1 : 0;
|
||||
int count = randomIntBetween(minimumAttachments, 3);
|
||||
for (int i = 0; i < count; i++) {
|
||||
Attachment.Template.Builder attachmentBuilder = createRandomAttachmentTemplateBuilder();
|
||||
templateBuilder.addAttachments(attachmentBuilder);
|
||||
|
Loading…
x
Reference in New Issue
Block a user