-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Add challenge tests for logsdb that utilize stored source #115606
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,17 +7,10 @@ | |
|
||
package org.elasticsearch.xpack.logsdb.qa; | ||
|
||
import org.elasticsearch.client.Request; | ||
import org.elasticsearch.client.Response; | ||
import org.elasticsearch.common.CheckedSupplier; | ||
import org.elasticsearch.common.settings.Settings; | ||
import org.elasticsearch.xcontent.XContentBuilder; | ||
|
||
import java.io.IOException; | ||
import java.util.List; | ||
import java.util.Locale; | ||
|
||
import static org.hamcrest.Matchers.equalTo; | ||
|
||
/** | ||
* This test compares behavior of a logsdb data stream and a standard index mode data stream | ||
|
@@ -52,27 +45,4 @@ public void baselineMappings(XContentBuilder builder) throws IOException { | |
public void contenderMappings(XContentBuilder builder) throws IOException { | ||
dataGenerationHelper.standardMapping(builder); | ||
} | ||
|
||
@Override | ||
public Response indexContenderDocuments(CheckedSupplier<List<XContentBuilder>, IOException> documentsSupplier) throws IOException { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This method exists in a base class, just a clean up. |
||
var reindexRequest = new Request("POST", "/_reindex?refresh=true"); | ||
reindexRequest.setJsonEntity(String.format(Locale.ROOT, """ | ||
{ | ||
"source": { | ||
"index": "%s" | ||
}, | ||
"dest": { | ||
"index": "%s", | ||
"op_type": "create" | ||
} | ||
} | ||
""", getBaselineDataStreamName(), getContenderDataStreamName())); | ||
var response = client.performRequest(reindexRequest); | ||
assertOK(response); | ||
|
||
var body = entityAsMap(response); | ||
assertThat("encountered failures when performing reindex:\n " + body, body.get("failures"), equalTo(List.of())); | ||
|
||
return response; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.logsdb.qa; | ||
|
||
import org.elasticsearch.common.settings.Settings; | ||
import org.elasticsearch.xcontent.XContentBuilder; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* This test compares behavior of a standard mode data stream and a logsdb data stream using stored source. | ||
* There should be no differences between such two data streams. | ||
*/ | ||
public class LogsDbVersusReindexedIntoStoredSourceChallengeRestIT extends ReindexChallengeRestIT { | ||
public String getBaselineDataStreamName() { | ||
return "logs-apache-baseline"; | ||
} | ||
|
||
public String getContenderDataStreamName() { | ||
return "logs-apache-reindexed"; | ||
} | ||
|
||
@Override | ||
public void baselineSettings(Settings.Builder builder) { | ||
dataGenerationHelper.logsDbSettings(builder); | ||
} | ||
|
||
@Override | ||
public void contenderSettings(Settings.Builder builder) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am wondering if we should just create base classes like
where the setting is applied and we can just inherit from them. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The thing is that sometimes baseline has stored source and sometimes the contender. |
||
dataGenerationHelper.logsDbSettings(builder); | ||
builder.put("index.mapping.source.mode", "stored"); | ||
} | ||
|
||
@Override | ||
public void baselineMappings(XContentBuilder builder) throws IOException { | ||
dataGenerationHelper.logsDbMapping(builder); | ||
} | ||
|
||
@Override | ||
public void contenderMappings(XContentBuilder builder) throws IOException { | ||
dataGenerationHelper.logsDbMapping(builder); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,17 +7,10 @@ | |
|
||
package org.elasticsearch.xpack.logsdb.qa; | ||
|
||
import org.elasticsearch.client.Request; | ||
import org.elasticsearch.client.Response; | ||
import org.elasticsearch.common.CheckedSupplier; | ||
import org.elasticsearch.common.settings.Settings; | ||
import org.elasticsearch.xcontent.XContentBuilder; | ||
|
||
import java.io.IOException; | ||
import java.util.List; | ||
import java.util.Locale; | ||
|
||
import static org.hamcrest.Matchers.equalTo; | ||
|
||
/** | ||
* This test compares behavior of a logsdb data stream and a data stream containing | ||
|
@@ -52,27 +45,4 @@ public void baselineMappings(XContentBuilder builder) throws IOException { | |
public void contenderMappings(XContentBuilder builder) throws IOException { | ||
dataGenerationHelper.logsDbMapping(builder); | ||
} | ||
|
||
@Override | ||
public Response indexContenderDocuments(CheckedSupplier<List<XContentBuilder>, IOException> documentsSupplier) throws IOException { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This method exists in a base class, just a clean up. |
||
var reindexRequest = new Request("POST", "/_reindex?refresh=true"); | ||
reindexRequest.setJsonEntity(String.format(Locale.ROOT, """ | ||
{ | ||
"source": { | ||
"index": "%s" | ||
}, | ||
"dest": { | ||
"index": "%s", | ||
"op_type": "create" | ||
} | ||
} | ||
""", getBaselineDataStreamName(), getContenderDataStreamName())); | ||
var response = client.performRequest(reindexRequest); | ||
assertOK(response); | ||
|
||
var body = entityAsMap(response); | ||
assertThat("encountered failures when performing reindex:\n " + body, body.get("failures"), equalTo(List.of())); | ||
|
||
return response; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.logsdb.qa; | ||
|
||
import org.elasticsearch.common.settings.Settings; | ||
|
||
/** | ||
* This test compares behavior of a standard mode data stream and a logsdb data stream using stored source. | ||
* There should be no differences between such two data streams. | ||
*/ | ||
public class StandardVersusLogsStoredSourceChallengeRestIT extends StandardVersusLogsIndexModeRandomDataChallengeRestIT { | ||
@Override | ||
public void contenderSettings(Settings.Builder builder) { | ||
super.contenderSettings(builder); | ||
builder.put("index.mapping.source.mode", "stored"); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.logsdb.qa; | ||
|
||
import org.elasticsearch.common.settings.Settings; | ||
import org.elasticsearch.xcontent.XContentBuilder; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* This test compares behavior of a logsdb data stream using stored source and a logsdb data stream | ||
* containing data reindexed from initial data stream. | ||
* There should be no differences between such two data streams. | ||
*/ | ||
public class StoredSourceLogsDbVersusReindexedLogsDbChallengeRestIT extends ReindexChallengeRestIT { | ||
public String getBaselineDataStreamName() { | ||
return "logs-apache-baseline"; | ||
} | ||
|
||
public String getContenderDataStreamName() { | ||
return "logs-apache-reindexed"; | ||
} | ||
|
||
@Override | ||
public void baselineSettings(Settings.Builder builder) { | ||
dataGenerationHelper.logsDbSettings(builder); | ||
builder.put("index.mapping.source.mode", "stored"); | ||
} | ||
|
||
@Override | ||
public void contenderSettings(Settings.Builder builder) { | ||
dataGenerationHelper.logsDbSettings(builder); | ||
} | ||
|
||
@Override | ||
public void baselineMappings(XContentBuilder builder) throws IOException { | ||
dataGenerationHelper.logsDbMapping(builder); | ||
} | ||
|
||
@Override | ||
public void contenderMappings(XContentBuilder builder) throws IOException { | ||
dataGenerationHelper.logsDbMapping(builder); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noticed this oversight, it only impacted reindex tests.