Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions x-pack/plugin/ccr/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ esplugin {
}
archivesBaseName = 'x-pack-ccr'

integTest.enabled = false

compileJava.options.compilerArgs << "-Xlint:-try"
compileTestJava.options.compilerArgs << "-Xlint:-try"

Expand All @@ -29,9 +27,31 @@ task internalClusterTest(type: RandomizedTestingTask,
classpath = project.test.classpath
testClassesDirs = project.test.testClassesDirs
include '**/*IT.class'
exclude '**/CcrRestIT.class'
systemProperty 'es.set.netty.runtime.available.processors', 'false'
}

integTestCluster {
distribution 'zip'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.security.enabled', 'true'
setting 'xpack.license.self_generated.type', 'trial'
// TODO: reduce the need for superuser here
setupCommand 'setup-ccr-user',
'bin/elasticsearch-users', 'useradd', 'ccr-user', '-p', 'ccr-user-password', '-r', 'superuser'
waitCondition = { node, ant ->
File tmpFile = new File(node.cwd, 'wait.success')
ant.get(src: "http://${node.httpUri()}/_cluster/health?wait_for_nodes=>=${numNodes}&wait_for_status=yellow",
dest: tmpFile.toString(),
username: 'ccr-user',
password: 'ccr-user-password',
ignoreerrors: true,
retries: 10)
return tmpFile.exists()
}
}

check.dependsOn internalClusterTest
internalClusterTest.mustRunAfter test

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

package org.elasticsearch.xpack.ccr;

import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
import org.elasticsearch.common.settings.SecureString;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.concurrent.ThreadContext;
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
import org.elasticsearch.xpack.test.rest.XPackRestTestHelper;
import org.junit.After;

import static org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken.basicAuthHeaderValue;

public class CcrRestIT extends ESClientYamlSuiteTestCase {

public CcrRestIT(final ClientYamlTestCandidate testCandidate) {
super(testCandidate);
}

@ParametersFactory
public static Iterable<Object[]> parameters() throws Exception {
return ESClientYamlSuiteTestCase.createParameters();
}

@Override
protected Settings restClientSettings() {
final String ccrUserAuthHeaderValue = basicAuthHeaderValue("ccr-user", new SecureString("ccr-user-password".toCharArray()));
return Settings.builder().put(ThreadContext.PREFIX + ".Authorization", ccrUserAuthHeaderValue).build();
}

@After
public void cleanup() throws Exception {
XPackRestTestHelper.waitForPendingTasks(adminClient());
}

}