Skip to content

Commit 9b7439b

Browse files
committed
Test: fix null failure in watcher test (#31968)
A new commit was merged that does not allow a null attachement && text. This is valid for the slack API, as it does not allow this, but our unit tests did. This commit fixes the broken unit test. Closes #31948
1 parent 60c5870 commit 9b7439b

File tree

1 file changed

+1
-1
lines changed
  • x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/notification/slack/message

1 file changed

+1
-1
lines changed

x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/notification/slack/message/SlackMessageTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ public void testTemplateRender() throws Exception {
481481
if (randomBoolean()) {
482482
templateBuilder.setText(randomAlphaOfLength(10));
483483
}
484-
if (randomBoolean()) {
484+
if (templateBuilder.text == null || randomBoolean()) {
485485
int count = randomIntBetween(0, 3);
486486
for (int i = 0; i < count; i++) {
487487
Attachment.Template.Builder attachmentBuilder = createRandomAttachmentTemplateBuilder();

0 commit comments

Comments
 (0)