Skip to content

Commit

Permalink
Merge pull request #15 from fsanaulla/issue-14
Browse files Browse the repository at this point in the history
[ALL][ISSUE-14]: udp specs
  • Loading branch information
fsanaulla authored Jul 25, 2019
2 parents 486ba71 + b09cb46 commit 62c47ac
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,13 @@ import com.github.fsanaulla.core.testing.configurations.InfluxUDPConf
import com.github.fsanaulla.scalatest.embedinflux.EmbeddedInfluxDB
import org.scalatest.concurrent.{Eventually, IntegrationPatience}
import org.scalatest.time.{Second, Seconds, Span}
import org.scalatest.{FlatSpec, Ignore, Matchers, TryValues}
import org.scalatest.{FlatSpec, Matchers, TryValues}

/**
* Created by
* Author: [email protected]
* Date: 27.02.18
*/
@Ignore
class InfluxUDPSpec
extends FlatSpec
with Matchers
Expand All @@ -56,6 +55,10 @@ class InfluxUDPSpec

val t = Test("f", 1)

eventually {
influxHttp.ping.get.right.get.version shouldEqual "1.7.6"
}

influxUdp
.write[Test]("cpu", t)
.success
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import com.github.fsanaulla.chronicler.urlhttp.io.InfluxIO
import com.github.fsanaulla.core.testing.configurations.InfluxUDPConf
import com.github.fsanaulla.specs2.embedinflux.EmbeddedInfluxDB
import org.specs2._
import org.specs2.matcher.EventuallyMatchers

/**
* Created by
Expand All @@ -32,11 +33,10 @@ import org.specs2._
class InfluxUDPSpec
extends mutable.Specification
with InfluxUDPConf
with EmbeddedInfluxDB {
with EmbeddedInfluxDB
with EventuallyMatchers {

args(skipAll = true)

case class Test(@tag name: String, @field age: Int)
final case class Test(@tag name: String, @field age: Int)

lazy val influxHttp =
InfluxIO("localhost", 8086)
Expand All @@ -47,15 +47,26 @@ class InfluxUDPSpec
"correctly work" in {
val t = Test("f", 1)

eventually {
influxHttp
.ping
.get
.right
.get
.version mustEqual "1.7.6"
}

influxUdp
.write[Test]("cpu", t)
.get mustEqual {}

influxHttp
.measurement[Test]("udp", "cpu")
.read("SELECT * FROM cpu")
.map(_.right.get mustEqual Array(t))
.get
eventually {
influxHttp
.measurement[Test]("udp", "cpu")
.read("SELECT * FROM cpu")
.map(_.right.get mustEqual Array(t))
.get
}
}
}
}

0 comments on commit 62c47ac

Please sign in to comment.