Skip to content

Commit

Permalink
Migrate integration test from config to project (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
RustedBones authored Aug 14, 2023
1 parent 14e0ed8 commit e03d80a
Show file tree
Hide file tree
Showing 21 changed files with 55 additions and 258 deletions.
52 changes: 23 additions & 29 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,21 @@ ThisBuild / tlSonatypeUseLegacyHost := true
// mima
ThisBuild / mimaBinaryIssueFilters ++= Seq()

lazy val commonSettings = Defaults.itSettings ++
headerSettings(IntegrationTest) ++
inConfig(IntegrationTest)(ScalafmtPlugin.scalafmtConfigSettings)

lazy val `pekko-http-metrics` = (project in file("."))
.aggregate(
integration,
`pekko-http-metrics-core`,
`pekko-http-metrics-datadog`,
`pekko-http-metrics-graphite`,
`pekko-http-metrics-dropwizard`,
`pekko-http-metrics-dropwizard-v5`,
`pekko-http-metrics-prometheus`
)
.settings(commonSettings)
.settings(
publishArtifact := false
)

lazy val `pekko-http-metrics-core` = (project in file("core"))
.configs(IntegrationTest)
.settings(commonSettings)
.settings(
libraryDependencies ++= Seq(
Dependencies.Enumeratum,
Expand All @@ -79,32 +73,22 @@ lazy val `pekko-http-metrics-core` = (project in file("core"))
)

lazy val `pekko-http-metrics-datadog` = (project in file("datadog"))
.configs(IntegrationTest)
.dependsOn(`pekko-http-metrics-core`)
.settings(commonSettings)
.settings(
libraryDependencies ++= Seq(
Dependencies.Datadog,
Dependencies.Provided.PekkoStream,
Dependencies.Test.Logback,
Dependencies.Test.PekkoHttpTestkit,
Dependencies.Test.PekkoSlf4j,
Dependencies.Test.PekkoStreamTestkit,
Dependencies.Test.ScalaTest
Dependencies.Provided.PekkoStream
)
)

lazy val `pekko-http-metrics-dropwizard` = (project in file("dropwizard"))
.configs(IntegrationTest)
.dependsOn(`pekko-http-metrics-core`)
.settings(commonSettings)
.settings(
libraryDependencies ++= Seq(
Dependencies.DropwizardCore,
Dependencies.DropwizardJson,
Dependencies.ScalaLogging,
Dependencies.Provided.PekkoStream,
Dependencies.Test.DropwizardJvm,
Dependencies.Test.Logback,
Dependencies.Test.PekkoHttpJson,
Dependencies.Test.PekkoHttpTestkit,
Expand All @@ -117,15 +101,12 @@ lazy val `pekko-http-metrics-dropwizard` = (project in file("dropwizard"))
)

lazy val `pekko-http-metrics-dropwizard-v5` = (project in file("dropwizard-v5"))
.configs(IntegrationTest)
.dependsOn(`pekko-http-metrics-core`)
.settings(commonSettings)
.settings(
libraryDependencies ++= Seq(
Dependencies.DropwizardV5Core,
Dependencies.DropwizardV5Json,
Dependencies.Provided.PekkoStream,
Dependencies.Test.DropwizardV5Jvm,
Dependencies.Test.Logback,
Dependencies.Test.PekkoHttpJson,
Dependencies.Test.PekkoHttpTestkit,
Expand All @@ -138,29 +119,42 @@ lazy val `pekko-http-metrics-dropwizard-v5` = (project in file("dropwizard-v5"))
)

lazy val `pekko-http-metrics-graphite` = (project in file("graphite"))
.configs(IntegrationTest)
.dependsOn(`pekko-http-metrics-core`)
.settings(commonSettings)
.settings(
libraryDependencies ++= Seq(
Dependencies.Provided.PekkoStream
)
)

lazy val `pekko-http-metrics-prometheus` = (project in file("prometheus"))
.dependsOn(`pekko-http-metrics-core`)
.settings(
libraryDependencies ++= Seq(
Dependencies.PrometheusCommon,
Dependencies.Provided.PekkoStream,
Dependencies.Test.Logback,
Dependencies.Test.PekkoHttpTestkit,
Dependencies.Test.PekkoSlf4j,
Dependencies.Test.PekkoStreamTestkit,
Dependencies.Test.PekkoTestkit,
Dependencies.Test.ScalaTest
)
)

lazy val `pekko-http-metrics-prometheus` = (project in file("prometheus"))
.configs(IntegrationTest)
.dependsOn(`pekko-http-metrics-core`)
.settings(commonSettings)
lazy val integration = (project in file("integration"))
.dependsOn(
`pekko-http-metrics-core` % "test->test",
`pekko-http-metrics-datadog` % "test",
`pekko-http-metrics-graphite` % "test",
`pekko-http-metrics-dropwizard-v5` % "test",
`pekko-http-metrics-prometheus` % "test"
)
.settings(
publishArtifact := false,
libraryDependencies ++= Seq(
Dependencies.PrometheusCommon,
Dependencies.Provided.PekkoStream,
Dependencies.Test.DropwizardV5Jvm,
Dependencies.Test.Logback,
Dependencies.Test.PekkoHttpJson,
Dependencies.Test.PekkoHttpTestkit,
Dependencies.Test.PekkoSlf4j,
Dependencies.Test.PekkoStreamTestkit,
Expand Down

This file was deleted.

5 changes: 0 additions & 5 deletions datadog/src/it/resources/application.conf

This file was deleted.

15 changes: 0 additions & 15 deletions datadog/src/it/resources/logback-test.xml

This file was deleted.

5 changes: 0 additions & 5 deletions dropwizard-v5/src/it/resources/application.conf

This file was deleted.

15 changes: 0 additions & 15 deletions dropwizard-v5/src/it/resources/logback-test.xml

This file was deleted.

5 changes: 0 additions & 5 deletions dropwizard/src/it/resources/application.conf

This file was deleted.

15 changes: 0 additions & 15 deletions dropwizard/src/it/resources/logback-test.xml

This file was deleted.

This file was deleted.

5 changes: 0 additions & 5 deletions graphite/src/it/resources/application.conf

This file was deleted.

15 changes: 0 additions & 15 deletions graphite/src/it/resources/logback-test.xml

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<configuration debug="false">
<appender name="file" class="ch.qos.logback.core.FileAppender">
<file>./target/pekko-http-metrics-core.it-test.log</file>
<file>./target/pekko-http-metrics.it-test.log</file>
<append>false</append>
<encoder>
<pattern>%date{HH:mm:ss} %-5level %logger{0} {%class %method} - %msg%n</pattern>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@

package fr.davit.pekko.http.metrics.datadog

import com.timgroup.statsd.NonBlockingStatsDClientBuilder
import fr.davit.pekko.http.metrics.core.{Dimension, PathLabeler, StatusGroupLabeler}
import org.apache.pekko.actor.ActorSystem
import org.apache.pekko.io.{IO, Udp}
import org.apache.pekko.testkit.{TestKit, TestProbe}
import com.timgroup.statsd.NonBlockingStatsDClientBuilder
import fr.davit.pekko.http.metrics.core.{Dimension, PathLabeler, StatusGroupLabeler}
import org.scalatest.BeforeAndAfterAll
import org.scalatest.flatspec.AnyFlatSpecLike
import org.scalatest.matchers.should.Matchers

import java.net.InetSocketAddress
import scala.concurrent.duration._
import scala.concurrent.duration.*

class DatadogRegistrySpec
extends TestKit(ActorSystem("DatadogRegistrySpec"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,28 @@

package fr.davit.pekko.http.metrics.dropwizard

import java.util.concurrent.TimeUnit
import fr.davit.pekko.http.metrics.core.HttpMetrics.*
import fr.davit.pekko.http.metrics.core.scaladsl.server.HttpMetricsDirectives.*
import fr.davit.pekko.http.metrics.dropwizard.marshalling.DropwizardMarshallers.*
import io.dropwizard.metrics5.MetricRegistry
import io.dropwizard.metrics5.jvm.{CachedThreadStatesGaugeSet, GarbageCollectorMetricSet, MemoryUsageGaugeSet}
import org.apache.pekko.actor.ActorSystem
import org.apache.pekko.http.scaladsl.Http
import org.apache.pekko.http.scaladsl.marshallers.sprayjson.SprayJsonSupport
import org.apache.pekko.http.scaladsl.model.{HttpRequest, StatusCodes, Uri}
import org.apache.pekko.http.scaladsl.server.Directives._
import org.apache.pekko.http.scaladsl.server.Directives.*
import org.apache.pekko.http.scaladsl.server.Route
import org.apache.pekko.http.scaladsl.unmarshalling.Unmarshal
import org.apache.pekko.testkit.TestKit
import fr.davit.pekko.http.metrics.core.HttpMetrics._
import fr.davit.pekko.http.metrics.core.scaladsl.server.HttpMetricsDirectives._
import fr.davit.pekko.http.metrics.dropwizard.marshalling.DropwizardMarshallers._
import io.dropwizard.metrics5.MetricRegistry
import io.dropwizard.metrics5.jvm.{CachedThreadStatesGaugeSet, GarbageCollectorMetricSet, MemoryUsageGaugeSet}
import org.scalatest.BeforeAndAfterAll
import org.scalatest.concurrent.ScalaFutures
import org.scalatest.flatspec.AnyFlatSpecLike
import org.scalatest.matchers.should.Matchers
import org.scalatest.time.{Millis, Seconds, Span}
import spray.json.{DefaultJsonProtocol, JsValue, RootJsonFormat}

import scala.concurrent.duration._
import java.util.concurrent.TimeUnit
import scala.concurrent.duration.*

class DropwizardMetricsItSpec
extends TestKit(ActorSystem("DropwizardMetricsItSpec"))
Expand Down
Loading

0 comments on commit e03d80a

Please sign in to comment.