Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
[Timelock Partitioning] Part 48: Make use of templates for conf… (#4426)
Browse files Browse the repository at this point in the history
* Make use of templates for config whilst testing.

* Configure the port correctly...

* Checkstyle.

* Test failure.
  • Loading branch information
felixdesouza authored Jan 13, 2020
1 parent 7d96985 commit 19bc9b1
Show file tree
Hide file tree
Showing 22 changed files with 179 additions and 600 deletions.
1 change: 1 addition & 0 deletions timelock-server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ dependencies {
testCommonImplementation (project(":atlasdb-tests-shared")) {
exclude group: 'com.fasterxml.jackson.jaxrs'
}
testCommonImplementation group: 'org.freemarker', name: 'freemarker'

testCommonApi group: 'io.dropwizard', name: 'dropwizard-testing'
testCommonApi group: 'com.github.peterwippermann.junit4', name: 'parameterized-suite'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,18 @@
import org.junit.ClassRule;
import org.junit.rules.RuleChain;

import com.palantir.atlasdb.timelock.ImmutableTemplateVariables.TimestampPaxos;

public abstract class AbstractAsyncTimelockServiceIntegrationTest {

protected static final String LOCALHOST = "https://localhost";
public static final TemplateVariables DEFAULT_SINGLE_SERVER = ImmutableTemplateVariables.builder()
.localServerPort(9050)
.addServerPorts()
.clientPaxos(TimestampPaxos.builder().isUseBatchPaxos(true).build())
.build();

protected static final TestableTimelockCluster CLUSTER_WITH_ASYNC = new TestableTimelockCluster(
LOCALHOST,
"paxosSingleServer.yml");
protected static final TestableTimelockCluster CLUSTER_WITH_ASYNC =
new TestableTimelockCluster("paxosSingleServer.ftl", DEFAULT_SINGLE_SERVER);

@ClassRule
public static final RuleChain ASYNC_RULE_CHAIN = CLUSTER_WITH_ASYNC.getRuleChain();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public void taggedMetricsCanBeIteratedThrough() {
assertThat(metrics).hasKeySatisfying(new Condition<MetricName>("contains random namespace") {
@Override
public boolean matches(MetricName value) {
return value.safeTags().get("client").equals(randomNamespace.namespace());
return randomNamespace.namespace().equals(value.safeTags().get("client"));
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.google.common.collect.Iterables;
import com.palantir.atlasdb.http.AtlasDbHttpClients;
import com.palantir.atlasdb.http.TestProxyUtils;
import com.palantir.atlasdb.timelock.ImmutableTemplateVariables.TimestampPaxos;
import com.palantir.atlasdb.timelock.paxos.PaxosTimeLockConstants;
import com.palantir.atlasdb.timelock.util.ExceptionMatchers;
import com.palantir.atlasdb.timelock.util.TestProxies;
Expand All @@ -42,9 +43,13 @@
*/
public class IsolatedPaxosTimeLockServerIntegrationTest {

private static final TemplateVariables SINGLE_NODE = ImmutableTemplateVariables.builder()
.localServerPort(9060)
.clientPaxos(TimestampPaxos.builder().isUseBatchPaxos(false).build())
.build();

private static final TestableTimelockCluster CLUSTER = new TestableTimelockCluster(
"https://localhost",
"paxosThreeServers.yml");
"paxosStaticThreeServers.ftl", SINGLE_NODE);

private static final TestableTimelockServer SERVER = Iterables.getOnlyElement(CLUSTER.servers());

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

import java.io.File;
import static com.palantir.atlasdb.timelock.AbstractAsyncTimelockServiceIntegrationTest.DEFAULT_SINGLE_SERVER;

import java.util.List;
import java.util.SortedMap;
import java.util.concurrent.TimeUnit;
Expand All @@ -44,8 +45,6 @@
import com.palantir.lock.v2.TimelockService;
import com.palantir.timestamp.TimestampManagementService;

import io.dropwizard.testing.ResourceHelpers;

public class PaxosTimeLockServerIntegrationTest {
private static final String CLIENT_1 = "test";
private static final String CLIENT_2 = "test2";
Expand All @@ -63,12 +62,10 @@ public class PaxosTimeLockServerIntegrationTest {
private static final LockDescriptor LOCK_1 = StringLockDescriptor.of("lock1");
private static final SortedMap<LockDescriptor, LockMode> LOCK_MAP =
ImmutableSortedMap.of(LOCK_1, LockMode.WRITE);
private static final File TIMELOCK_CONFIG_TEMPLATE =
new File(ResourceHelpers.resourceFilePath("paxosSingleServer.yml"));

private static final TemporaryFolder TEMPORARY_FOLDER = new TemporaryFolder();
private static final TemporaryConfigurationHolder TEMPORARY_CONFIG_HOLDER =
new TemporaryConfigurationHolder(TEMPORARY_FOLDER, TIMELOCK_CONFIG_TEMPLATE);
new TemporaryConfigurationHolder(TEMPORARY_FOLDER, "paxosSingleServer.ftl", DEFAULT_SINGLE_SERVER);
private static final TimeLockServerHolder TIMELOCK_SERVER_HOLDER =
new TimeLockServerHolder(TEMPORARY_CONFIG_HOLDER::getTemporaryConfigFileLocation);
private static final TestableTimelockServer TIMELOCK =
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

import static com.palantir.atlasdb.timelock.AbstractAsyncTimelockServiceIntegrationTest.DEFAULT_SINGLE_SERVER;

import org.junit.ClassRule;
import org.junit.Test;
import org.junit.rules.RuleChain;
Expand All @@ -36,9 +38,8 @@ public class TimeLockServerDownIntegrationTest {
private static final byte[] DATA = "foo".getBytes();
private static final Cell CELL = Cell.create("bar".getBytes(), "baz".getBytes());

private static final TestableTimelockCluster CLUSTER = new TestableTimelockCluster(
"https://localhost",
"paxosSingleServer.yml");
private static final TestableTimelockCluster CLUSTER =
new TestableTimelockCluster("paxosSingleServer.ftl", DEFAULT_SINGLE_SERVER);

@ClassRule
public static final RuleChain ruleChain = CLUSTER.getRuleChain();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ install:
ttl: PT5M
maximum-size: 1000
paxos:
data-directory: "<TEMP_DATA_DIR>"
data-directory: "${dataDirectory}"
is-new-service: false
cluster:
cluster:
Expand All @@ -16,12 +16,15 @@ install:
keyStorePassword: "keystore"
keyStoreType: "JKS"
uris:
- "localhost:9050"
local-server: "localhost:9050"
- "localhost:${localServerPort?c}"
local-server: "localhost:${localServerPort?c}"
enableNonstandardAndPossiblyDangerousTopology: true
timestampBoundPersistence:

runtime:
paxos:
timestamp-paxos:
use-batch-paxos: ${clientPaxos.useBatchPaxos?c}
targeted-sweep-locks:
mode: disabled-by-default
excluded-clients:
Expand All @@ -41,7 +44,7 @@ server:
maxThreads: 200
applicationConnectors:
- type: h2
port: 9050
port: ${localServerPort?c}
selectorThreads: 8
acceptorThreads: 4
keyStorePath: var/security/keyStore.jks
Expand All @@ -64,6 +67,4 @@ server:
- TLS_RSA_WITH_AES_256_CBC_SHA
- TLS_RSA_WITH_AES_128_CBC_SHA
- TLS_EMPTY_RENEGOTIATION_INFO_SCSV
adminConnectors:
- type: http
port: 7050
adminConnectors: []

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
install:
paxos:
data-directory: "<TEMP_DATA_DIR>"
data-directory: "${dataDirectory}"
is-new-service: false
cluster:
cluster:
Expand All @@ -11,10 +11,10 @@ install:
keyStorePassword: "keystore"
keyStoreType: "JKS"
uris:
- "localhost:${localServerPort?c}"
- "localhost:9061"
- "localhost:9060"
- "localhost:9062"
local-server: "localhost:9060"
local-server: "localhost:${localServerPort?c}"
timestampBoundPersistence:

runtime:
Expand All @@ -23,7 +23,7 @@ runtime:
server:
applicationConnectors:
- type: h2
port: 9060
port: ${localServerPort?c}
keyStorePath: var/security/keyStore.jks
keyStorePassword: keystore
trustStorePath: var/security/trustStore.jks
Expand All @@ -44,6 +44,4 @@ server:
- TLS_RSA_WITH_AES_256_CBC_SHA
- TLS_RSA_WITH_AES_128_CBC_SHA
- TLS_EMPTY_RENEGOTIATION_INFO_SCSV
adminConnectors:
- type: http
port: 7060
adminConnectors: []
Loading

0 comments on commit 19bc9b1

Please sign in to comment.