Skip to content

Commit eff54bb

Browse files
Upgrade to work with kairosdb 1.3.0 (#128)
* Upgrade to work with kairosdb 1.3.0 Major bump as some endpoints where removed, so removed corresponding methods (see kairosdb/kairosdb@877c53e)
1 parent 3cc47a8 commit eff54bb

File tree

15 files changed

+45
-147
lines changed

15 files changed

+45
-147
lines changed

src/it/docker/Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
FROM java:8-alpine
1+
FROM openjdk:8u342-slim-buster
22

3-
RUN apk upgrade libssl1.0 --update-cache && \
4-
apk add wget ca-certificates bash
3+
RUN apt-get update
4+
RUN apt-get -y upgrade libssl1.0 && \
5+
apt-get -y install wget ca-certificates bash
56
RUN wget -O /tmp/kairosdb.tar.gz \
6-
# https://github.com/kairosdb/kairosdb/releases/download/v1.1.3/kairosdb-1.1.3-1.tar.gz
7-
https://github.com/kairosdb/kairosdb/releases/download/v1.2.0/kairosdb-1.2.0-1.tar.gz
7+
https://github.com/kairosdb/kairosdb/releases/download/v1.3.0/kairosdb-1.3.0-1.tar.gz
88

99
RUN mkdir -p /opt/ && \
1010
cd /opt/ && \

src/it/docker/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
#
33
# build the KairosDB image
44

5-
#VERSION=1.1.3-1
6-
VERSION=1.2.0-1
5+
VERSION=1.3.0-1
76

87
all: build
98

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test: test
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
basicAuth {
2+
org.eclipse.jetty.jaas.spi.PropertyFileLoginModule required
3+
debug="true"
4+
//The line below should point to your .props file which lists your users and their passwords.
5+
file="conf/auth/auth.props";
6+
};

src/it/resources/conf/kairosdb.properties

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

src/it/scala/integration/AddAndQueryDataPointsIntegrationSpec.scala

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,18 @@ class AddAndQueryDataPointsIntegrationSpec extends IntegrationSpec {
123123
(Instant.parse("1970-01-04T00:00:00Z"), KNumber(555)
124124
))
125125
))))))
126+
case ("KairosDB 1.3.0-1.20210808220820", results) =>
127+
results must be(QueryResponse.Response(Seq(ResponseQuery(2, Seq(
128+
Result("my.new.metric", Seq(GroupBy.GroupByType("number")), Seq(TagResult("aoeu", Seq("snth"))), Seq(
129+
(Instant.parse("1970-01-01T00:00:00Z"), KNull),
130+
(Instant.parse("1970-01-02T00:00:00Z"), KNumber(555)),
131+
(Instant.parse("1970-01-03T00:00:00Z"), KNull),
132+
(Instant.parse("1970-01-04T00:00:00Z"), KNumber(555)),
133+
(Instant.parse("1970-01-05T00:00:00Z"), KNull)
134+
)
135+
))))))
126136
case other =>
127-
fail("Unknown kairos version")
137+
fail(s"Unknown kairos version ${other._1}")
128138
}
129139
}
130140
}

src/it/scala/integration/AuthSpec.scala

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,25 @@ import scala.concurrent.ExecutionContext.Implicits.global
1111
import scala.collection.immutable.Seq
1212

1313
class AuthSpec extends IntegrationSpec {
14-
15-
// TODO enabling auth by providing env variables, when kairosdb 1.1.2 is released
16-
// // same as KairosDB Main.java
17-
// def toEnvVarName(propName: String) = {
18-
// propName.toUpperCase().replace('.', '_')
19-
// }
20-
//
21-
// override lazy val dockerEnv = Seq(
22-
// toEnvVarName("kairosdb.jetty.basic_auth.user") + "=test",
23-
// toEnvVarName("kairosdb.jetty.basic_auth.password") + "=test"
24-
// )
25-
2614
// enabling auth by providing a properties file
2715
override lazy val volumes = Seq(
2816
HostConfig.Bind
29-
.from(Paths.get("src/it/resources/conf").toAbsolutePath.toString)
30-
.to("/opt/kairosdb/conf")
17+
.from(Paths.get("src/it/resources/conf/auth").toAbsolutePath.toString)
18+
.to("/opt/kairosdb/conf/auth")
3119
.build()
3220
)
3321

22+
override lazy val env: Seq[String] = Seq(
23+
"JAVA_OPTS=-Djava.security.auth.login.config=/opt/kairosdb/conf/auth/basicAuth.conf -Dkairosdb.jetty.auth_module_name=basicAuth "+
24+
"-Dkairosdb.jetty.basic_auth.user=test " +
25+
"-Dkairosdb.jetty.basic_auth.password=test"
26+
)
27+
28+
3429
"The health status" should {
3530
"fail without auth" in {
3631
val kairosDB = new KairosDB(wsClient, KairosDBConfig(port = kairosPort), global)
37-
val res = kairosDB.healthStatus.failed.futureValue
32+
val res = kairosDB.version.failed.futureValue
3833

3934
res mustBe an[KairosDBResponseException]
4035
res must be(KairosDBResponseException(401, "Unauthorized", Seq.empty))
@@ -47,9 +42,9 @@ class AuthSpec extends IntegrationSpec {
4742
password = Some("test")
4843
)
4944
val kairosDB = new KairosDB(wsClient, kairosConfig, global)
50-
val res = kairosDB.healthStatus.futureValue
45+
val res = kairosDB.version.futureValue
5146

52-
res must be(HealthStatusResults(Seq("JVM-Thread-Deadlock: OK", "Datastore-Query: OK")))
47+
res must startWith("KairosDB")
5348
}
5449
}
5550
}

src/it/scala/integration/IntegrationSpec.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ trait IntegrationSpec extends AnyWordSpec with Matchers with ScalaFutures with S
1919
lazy val env = Seq.empty[String]
2020
lazy val volumes = Seq.empty[HostConfig.Bind]
2121

22-
val kairosdbContainer = ContainerSpec("brunoballekens/kairosdb-scala-driver-it:1.2.0-1")
22+
val kairosdbContainer = ContainerSpec("brunoballekens/kairosdb-scala-driver-it:1.3.0-1")
2323
.withEnv(env:_*)
2424
// broken with the spotify client
2525
.withVolumeBindings(volumes:_*)
@@ -37,7 +37,7 @@ trait IntegrationSpec extends AnyWordSpec with Matchers with ScalaFutures with S
3737
.getOrElse(throw new IllegalStateException(s"Missing container mapped port for $DefaultKairosDbPort"))
3838
}
3939

40-
implicit val pc = PatienceConfig(Span(20, Seconds), Span(1, Second))
40+
implicit val pc = PatienceConfig(Span(2000, Seconds), Span(1, Second))
4141
//override def dockerInitPatienceInterval = PatienceConfig(scaled(Span(30, Seconds)), scaled(Span(10, Millis)))
4242

4343
override val managedContainers: ContainerGroup = ContainerGroup(Seq(kairosdbContainer.toContainer))

src/it/scala/integration/ListTagNamesIntegrationSpec.scala

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

src/main/scala/io/waylay/kairosdb/driver/KairosDB.scala

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -51,26 +51,6 @@ class KairosDB(wsClient: StandaloneWSClient, config: KairosDBConfig, executionCo
5151
.map(_.map(MetricName))
5252
}
5353

54-
def listTagNames: Future[Seq[String]] = {
55-
wsClient
56-
.url((url / "api" / "v1" / "tagnames").toString())
57-
.applyKairosDBAuth
58-
.get()
59-
.map {
60-
wsRepsonseToResult(json => (json \ "results").validate[Seq[String]])
61-
}
62-
}
63-
64-
def listTagValues: Future[Seq[String]] = {
65-
wsClient
66-
.url((url / "api" / "v1" / "tagvalues").toString())
67-
.applyKairosDBAuth
68-
.get()
69-
.map(
70-
wsRepsonseToResult(json => (json \ "results").validate[Seq[String]])
71-
)
72-
}
73-
7454
def healthStatus: Future[HealthStatusResults] = {
7555
wsClient
7656
.url((url / "api" / "v1" / "health" / "status").toString())

0 commit comments

Comments
 (0)