more test fixes - more nocommits
Original commit: elastic/x-pack-elasticsearch@9d230d3b71
This commit is contained in:
parent
d3bd643bf4
commit
491e8fc167
|
@ -79,14 +79,15 @@ public class InternalEmailService extends AbstractLifecycleComponent<InternalEma
|
|||
|
||||
void reset(Settings nodeSettings) {
|
||||
Settings.Builder builder = Settings.builder();
|
||||
String prefix = "watcher.actions.email.service";
|
||||
for (String setting : settings.getAsMap().keySet()) {
|
||||
if (setting.startsWith("watcher.actions.email.service")) {
|
||||
builder.put(setting, settings.get(setting));
|
||||
builder.put(setting.substring(prefix.length()+1), settings.get(setting));
|
||||
}
|
||||
}
|
||||
for (String setting : nodeSettings.getAsMap().keySet()) {
|
||||
if (setting.startsWith("watcher.actions.email.service")) {
|
||||
builder.put(setting, settings.get(setting));
|
||||
builder.put(setting.substring(prefix.length()+1), settings.get(setting));
|
||||
}
|
||||
}
|
||||
accounts = createAccounts(builder.build(), logger);
|
||||
|
|
|
@ -13,6 +13,7 @@ import org.elasticsearch.common.compress.Compressor;
|
|||
import org.elasticsearch.common.compress.CompressorFactory;
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.common.xcontent.XContentHelper;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
|
||||
|
@ -30,18 +31,8 @@ public class WatcherXContentUtils {
|
|||
|
||||
public static Tuple<XContentType, Object> convertToObject(BytesReference bytes) throws ElasticsearchParseException {
|
||||
try {
|
||||
XContentParser parser;
|
||||
XContentType contentType;
|
||||
Compressor compressor = CompressorFactory.compressor(bytes);
|
||||
if (compressor != null) {
|
||||
StreamInput compressedStreamInput = compressor.streamInput(bytes.streamInput());
|
||||
contentType = XContentFactory.xContentType(compressedStreamInput);
|
||||
parser = XContentFactory.xContent(contentType).createParser(compressedStreamInput);
|
||||
} else {
|
||||
contentType = XContentFactory.xContentType(bytes);
|
||||
parser = XContentFactory.xContent(contentType).createParser(bytes.streamInput());
|
||||
}
|
||||
return Tuple.tuple(contentType, readValue(parser, parser.nextToken()));
|
||||
XContentParser parser = XContentHelper.createParser(bytes);
|
||||
return Tuple.tuple(parser.contentType(), readValue(parser, parser.nextToken()));
|
||||
} catch (IOException e) {
|
||||
throw new ElasticsearchParseException("Failed to parse content to map", e);
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import static org.mockito.Mockito.when;
|
|||
public class CompareConditionSearchTests extends AbstractWatcherIntegrationTests {
|
||||
|
||||
@Test
|
||||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/11692") //nocommit
|
||||
public void testExecute_withAggs() throws Exception {
|
||||
|
||||
client().admin().indices().prepareCreate("my-index")
|
||||
|
|
|
@ -49,6 +49,7 @@ public class ScriptConditionSearchTests extends AbstractWatcherIntegrationTests
|
|||
}
|
||||
|
||||
@Test
|
||||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/11692") //nocommit
|
||||
public void testExecute_withAggs() throws Exception {
|
||||
|
||||
client().admin().indices().prepareCreate("my-index")
|
||||
|
|
|
@ -72,16 +72,17 @@ public class SearchInputTests extends ElasticsearchIntegrationTest {
|
|||
|
||||
@Override
|
||||
public Settings nodeSettings(int nodeOrdinal) {
|
||||
Path tempDir = createTempDir();
|
||||
Path configPath = tempDir.resolve("config").resolve("scripts");
|
||||
final Path tempDir = createTempDir();
|
||||
final Path configPath = tempDir.resolve("config");
|
||||
final Path scriptPath = configPath.resolve("scripts");
|
||||
try {
|
||||
Files.createDirectories(configPath);
|
||||
Files.createDirectories(scriptPath);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("failed to create config dir");
|
||||
|
||||
}
|
||||
try (InputStream stream = SearchInputTests.class.getResourceAsStream("/org/elasticsearch/watcher/input/search/config/scripts/test_disk_template.mustache");
|
||||
OutputStream out = Files.newOutputStream(configPath.resolve("test_disk_template.mustache"))) {
|
||||
OutputStream out = Files.newOutputStream(scriptPath.resolve("test_disk_template.mustache"))) {
|
||||
Streams.copy(stream, out);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("failed to copy mustache template");
|
||||
|
|
|
@ -60,7 +60,7 @@ public class WatcherDateTimeUtilsTests extends ElasticsearchTestCase {
|
|||
.put(value + "s", TimeValue.timeValueSeconds(value))
|
||||
.put(value + "m", TimeValue.timeValueMinutes(value))
|
||||
.put(value + "h", TimeValue.timeValueHours(value))
|
||||
.put(value + "", TimeValue.timeValueMillis(value))
|
||||
// .put(value + "", TimeValue.timeValueMillis(value)) nocommit this is not allowed in 2.0 anymore - we need to upgrade those settings?
|
||||
.build();
|
||||
|
||||
String key = randomFrom(values.keySet().toArray(new String[values.size()]));
|
||||
|
@ -82,7 +82,7 @@ public class WatcherDateTimeUtilsTests extends ElasticsearchTestCase {
|
|||
.put(value + "s", TimeValue.timeValueSeconds(value))
|
||||
.put(value + "m", TimeValue.timeValueMinutes(value))
|
||||
.put(value + "h", TimeValue.timeValueHours(value))
|
||||
.put(value + "", TimeValue.timeValueMillis(value))
|
||||
//.put(value + "", TimeValue.timeValueMillis(value)) nocommit this is not allowed in 2.0 anymore - we need to upgrade those settings?
|
||||
.build();
|
||||
|
||||
String key = randomFrom(values.keySet().toArray(new String[values.size()]));
|
||||
|
|
|
@ -654,7 +654,7 @@ public abstract class AbstractWatcherIntegrationTests extends ElasticsearchInteg
|
|||
" cluster: cluster:monitor/nodes/info, cluster:monitor/nodes/liveness\n" +
|
||||
"\n" +
|
||||
"monitor:\n" +
|
||||
" cluster: monitor_watcher, cluster:monitor/nodes/info, cluster:monitor/nodes/liveness\\\n"
|
||||
" cluster: monitor_watcher, cluster:monitor/nodes/info, cWatcherDateTimeUtilsTestsluster:monitor/nodes/liveness\\\n"
|
||||
;
|
||||
|
||||
|
||||
|
|
|
@ -70,16 +70,17 @@ public class SearchTransformTests extends ElasticsearchIntegrationTest {
|
|||
|
||||
@Override
|
||||
public Settings nodeSettings(int nodeOrdinal) {
|
||||
Path tempDir = createTempDir();
|
||||
Path configPath = tempDir.resolve("config").resolve("scripts");
|
||||
final Path tempDir = createTempDir();
|
||||
final Path configPath = tempDir.resolve("config");
|
||||
final Path scriptPath = configPath.resolve("scripts");
|
||||
try {
|
||||
Files.createDirectories(configPath);
|
||||
Files.createDirectories(scriptPath);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("failed to create config dir");
|
||||
|
||||
}
|
||||
try (InputStream stream = SearchTransformTests.class.getResourceAsStream("/org/elasticsearch/watcher/transform/search/config/scripts/test_disk_template.mustache");
|
||||
OutputStream out = Files.newOutputStream(configPath.resolve("test_disk_template.mustache"))) {
|
||||
OutputStream out = Files.newOutputStream(scriptPath.resolve("test_disk_template.mustache"))) {
|
||||
Streams.copy(stream, out);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("failed to copy mustache template");
|
||||
|
|
|
@ -51,7 +51,7 @@ public class WatchLockServiceTests extends ElasticsearchTestCase {
|
|||
try {
|
||||
lockService.acquire("_name");
|
||||
fail("exception expected");
|
||||
} catch (IllegalStateException e) {
|
||||
} catch (IllegalArgumentException e) {
|
||||
assertThat(e.getMessage(), containsString("Lock already acquired"));
|
||||
}
|
||||
lock1.release();
|
||||
|
|
Loading…
Reference in New Issue