mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 01:22:26 -04:00
Port repository-url to new TestFramework (#102588)
removes docker-compose dependency from url-fixture
This commit is contained in:
parent
bc0751d392
commit
bc17acdada
7 changed files with 156 additions and 163 deletions
|
@ -8,12 +8,9 @@
|
|||
|
||||
import org.elasticsearch.gradle.PropertyNormalization
|
||||
|
||||
apply plugin: 'elasticsearch.legacy-yaml-rest-test'
|
||||
apply plugin: 'elasticsearch.legacy-yaml-rest-compat-test'
|
||||
apply plugin: 'elasticsearch.internal-yaml-rest-test'
|
||||
apply plugin: 'elasticsearch.yaml-rest-compat-test'
|
||||
apply plugin: 'elasticsearch.internal-cluster-test'
|
||||
apply plugin: 'elasticsearch.test.fixtures'
|
||||
|
||||
final Project fixture = project(':test:fixtures:url-fixture')
|
||||
|
||||
esplugin {
|
||||
description 'Module for URL repository'
|
||||
|
@ -32,6 +29,8 @@ dependencies {
|
|||
api "commons-logging:commons-logging:${versions.commonslogging}"
|
||||
api "commons-codec:commons-codec:${versions.commonscodec}"
|
||||
api "org.apache.logging.log4j:log4j-1.2-api:${versions.log4j}"
|
||||
yamlRestTestImplementation project(':test:fixtures:url-fixture')
|
||||
internalClusterTestImplementation project(':test:fixtures:url-fixture')
|
||||
}
|
||||
|
||||
tasks.named("thirdPartyAudit").configure {
|
||||
|
@ -45,15 +44,7 @@ tasks.named("thirdPartyAudit").configure {
|
|||
)
|
||||
}
|
||||
|
||||
testFixtures.useFixture(fixture.path, 'url-fixture')
|
||||
|
||||
def fixtureAddress = { fixtureName ->
|
||||
int ephemeralPort = fixture.postProcessFixture.ext."test.fixtures.${fixtureName}.tcp.80"
|
||||
assert ephemeralPort > 0
|
||||
'http://127.0.0.1:' + ephemeralPort
|
||||
}
|
||||
|
||||
File repositoryDir = fixture.fsRepositoryDir as File
|
||||
//File repositoryDir = fixture.fsRepositoryDir as File
|
||||
|
||||
testClusters.configureEach {
|
||||
// repositoryDir is used by a FS repository to create snapshots
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
|
||||
package org.elasticsearch.repositories.url;
|
||||
|
||||
import fixture.url.URLFixture;
|
||||
|
||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||
|
||||
|
@ -22,11 +24,15 @@ import org.elasticsearch.common.xcontent.support.XContentMapValues;
|
|||
import org.elasticsearch.core.PathUtils;
|
||||
import org.elasticsearch.repositories.fs.FsRepository;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
import org.elasticsearch.test.cluster.ElasticsearchCluster;
|
||||
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
|
||||
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
||||
import org.elasticsearch.xcontent.ToXContent;
|
||||
import org.elasticsearch.xcontent.XContentBuilder;
|
||||
import org.junit.Before;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.rules.RuleChain;
|
||||
import org.junit.rules.TestRule;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
|
@ -42,6 +48,22 @@ import static org.hamcrest.Matchers.notNullValue;
|
|||
|
||||
public class RepositoryURLClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
||||
|
||||
public static final URLFixture urlFixture = new URLFixture();
|
||||
|
||||
public static ElasticsearchCluster cluster = ElasticsearchCluster.local()
|
||||
.module("repository-url")
|
||||
.setting("path.repo", urlFixture::getRepositoryDir)
|
||||
.setting("repositories.url.allowed_urls", () -> "http://snapshot.test*, " + urlFixture.getAddress())
|
||||
.build();
|
||||
|
||||
@ClassRule
|
||||
public static TestRule ruleChain = RuleChain.outerRule(urlFixture).around(cluster);
|
||||
|
||||
@Override
|
||||
protected String getTestRestCluster() {
|
||||
return cluster.getHttpAddresses();
|
||||
}
|
||||
|
||||
public RepositoryURLClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
|
||||
super(testCandidate);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue