Skip to content

Commit f70b4c0

Browse files
author
Magesh Chandramouli
authored
Merge pull request #235 from ExpediaDotCom/cassandra-resiliency
fixing unit tests
2 parents 207032a + 54795bf commit f70b4c0

File tree

5 files changed

+33
-60
lines changed

5 files changed

+33
-60
lines changed

backends/cassandra/build/integration-tests/docker-app.conf

Lines changed: 0 additions & 39 deletions
This file was deleted.

backends/cassandra/pom.xml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,11 @@
9393
<goal>test</goal>
9494
</goals>
9595
<configuration>
96-
<wildcardSuites>com.expedia.www.haystack.trace.reader.unit</wildcardSuites>
96+
<environmentVariables>
97+
<HAYSTACK_PROP_CASSANDRA_ENDPOINTS>cass1,cass2</HAYSTACK_PROP_CASSANDRA_ENDPOINTS>
98+
<HAYSTACK_PROP_CASSANDRA_KEYSPACE_AUTO_CREATE_SCHEMA>cassandra_cql_schema_1</HAYSTACK_PROP_CASSANDRA_KEYSPACE_AUTO_CREATE_SCHEMA>
99+
</environmentVariables>
100+
<wildcardSuites>com.expedia.www.haystack.trace.storage.backends.cassandra.unit</wildcardSuites>
97101
</configuration>
98102
</execution>
99103
<execution>
@@ -104,10 +108,9 @@
104108
</goals>
105109
<configuration>
106110
<environmentVariables>
107-
<HAYSTACK_OVERRIDES_CONFIG_PATH>/src/reader/build/integration-tests/docker-app.conf
108-
</HAYSTACK_OVERRIDES_CONFIG_PATH>
111+
<HAYSTACK_OVERRIDES_CONFIG_PATH>/src/backends/cassandra/build/integration-tests/docker-app.conf</HAYSTACK_OVERRIDES_CONFIG_PATH>
109112
</environmentVariables>
110-
<wildcardSuites>com.expedia.www.haystack.trace.reader.integration</wildcardSuites>
113+
<wildcardSuites>com.expedia.www.haystack.trace.storage.backends.cassandra.integration</wildcardSuites>
111114
</configuration>
112115
</execution>
113116
</executions>

backends/cassandra/src/test/resources/config/base.conf

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
haystack.graphite.host = "monitoring-influxdb-graphite.kube-system.svc"
22

33
service {
4-
port = 8090
5-
ssl {
6-
enabled = false
7-
cert.path = ""
8-
private.key.path = ""
9-
}
4+
port = 8090
5+
ssl {
6+
enabled = false
7+
cert.path = "/ssl/cert"
8+
private.key.path = "/ssl/private-key"
9+
}
1010
}
1111

1212
cassandra {
@@ -26,14 +26,26 @@ cassandra {
2626
}
2727

2828
connections {
29-
max.per.host = 10
29+
max.per.host = 100
3030
read.timeout.ms = 5000
3131
conn.timeout.ms = 10000
3232
keep.alive = true
3333
}
34+
ttl.sec = 86400
35+
36+
retries {
37+
max = 10
38+
backoff {
39+
initial.ms = 250
40+
factor = 2
41+
}
42+
}
3443

3544
keyspace {
3645
name = "haystack"
3746
table.name = "traces"
47+
auto.create.schema = "CREATE KEYSPACE IF NOT EXISTS haystack WITH REPLICATION = { 'class': 'SimpleStrategy', 'replication_factor' : 1 } AND durable_writes = false; CREATE TABLE IF NOT EXISTS haystack.traces (id varchar, ts timestamp, spans blob, PRIMARY KEY ((id), ts)) WITH CLUSTERING ORDER BY (ts ASC) AND compaction = { 'class' : 'DateTieredCompactionStrategy', 'max_sstable_age_days': '3' } AND gc_grace_seconds = 86400;"
48+
49+
3850
}
3951
}

backends/cassandra/src/test/scala/com/expedia/www/haystack/trace/storage/backends/cassandra/integration/BaseIntegrationTestSpec.scala

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,19 @@ trait BaseIntegrationTestSpec extends FunSpec with GivenWhenThen with Matchers w
4747
private var cassandraSession: Session = _
4848

4949
override def beforeAll() {
50+
executors.submit(new Runnable {
51+
override def run(): Unit = Service.main(null)
52+
})
53+
//waiting for the service to start up
54+
55+
Thread.sleep(5000)
5056
// setup cassandra
5157
cassandraSession = Cluster
5258
.builder()
5359
.addContactPoints(CASSANDRA_ENDPOINT)
5460
.build()
5561
.connect(CASSANDRA_KEYSPACE)
5662
deleteCassandraTableRows()
57-
58-
59-
60-
executors.submit(new Runnable {
61-
override def run(): Unit = Service.main(null)
62-
})
63-
64-
Thread.sleep(5000)
65-
6663
client = StorageBackendGrpc.newBlockingStub(ManagedChannelBuilder.forAddress("localhost", 8090)
6764
.usePlaintext(true)
6865
.build())

backends/cassandra/src/test/scala/com/expedia/www/haystack/trace/storage/backends/cassandra/unit/config/ConfigurationLoaderSpec.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class ConfigurationLoaderSpec extends BaseUnitTestSpec {
2727
it("should load the service config from base.conf") {
2828
val serviceConfig: ServiceConfiguration = project.serviceConfig
2929
serviceConfig.port shouldBe 8090
30-
serviceConfig.ssl.enabled shouldBe true
30+
serviceConfig.ssl.enabled shouldBe false
3131
serviceConfig.ssl.certChainFilePath shouldBe "/ssl/cert"
3232
serviceConfig.ssl.privateKeyPath shouldBe "/ssl/private-key"
3333
}

0 commit comments

Comments
 (0)