-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Mehdi Rebiai <[email protected]>
- Loading branch information
Showing
85 changed files
with
3,961 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
*.class | ||
*.log | ||
.bsp | ||
.idea | ||
.metals | ||
target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
= Contributing | ||
|
||
== Introduction | ||
|
||
You can contribute to [Kapoeira](https://github.com/lectra-tech/kapoeira) via | ||
[pull requests](https://help.github.com/articles/about-pull-requests/) filed. | ||
|
||
== Signing off each Commit | ||
|
||
As part of filing a pull request we ask you to sign off the | ||
[Developer Certificate of Origin](https://developercertificate.org/) (DCO) in each commit. | ||
Any Pull Request with commits that are not signed off will be reject by the | ||
[DCO check](https://probot.github.io/apps/dco/). | ||
|
||
A DCO is lightweight way for a contributor to confirm that they wrote or otherwise have the right | ||
to submit code or documentation to a project. Simply add `Signed-off-by` as shown in the example below | ||
to indicate that you agree with the DCO. | ||
|
||
Example for a commit message with a sign-off: | ||
|
||
---- | ||
doc(readme.adoc): Align sample code | ||
Signed-off-by: John Doe <[email protected]> | ||
---- | ||
|
||
Git has the `-s` option (lower case) for `commit` that can sign off a commit for you, see example below: | ||
|
||
`$ git commit -s -m 'doc(readme.adoc): Align sample code'` | ||
|
||
|
||
== Git History | ||
|
||
TODO | ||
|
||
- [Ensure that your commit messages will make your mom proud](https://www.robertcooper.me/git-commit-messages) | ||
- [See what is done on ORT](https://github.com/oss-review-toolkit/.github/blob/main/CONTRIBUTING.md#git-history) | ||
|
||
|
||
== Coding Conventions | ||
|
||
TODO | ||
- code organization | ||
- format | ||
|
||
|
||
|
||
|
||
Thank you for reading and happy contributing! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
= Kapoeira | ||
:toc: | ||
:sectnums: | ||
|
||
Dockerized Integration test tool for Kafka Environment | ||
|
||
|
||
image::src/main/docs/images/kapoeira.png[] | ||
|
||
image::src/main/docs/images/archi.png[] | ||
|
||
== Context | ||
* Define Gherkin features respecting Kapoeira DSL defined by these link:src/test/resources/features[examples] | ||
* Kafka records can be defined in Gherkin files or with links to external files (json, avro-json, plain...) | ||
* External commands can be called for assertions (with .sh files for example, calling docker tools if needed) | ||
|
||
== How to build? | ||
=== Locally | ||
[source, bash] | ||
---- | ||
./run-local.sh build | ||
---- | ||
|
||
== How to test? | ||
|
||
=== In your IDE | ||
Run/Debug this Scala class : link:src/test/scala/com/lectra/kapoeira/FeaturesTestRunner.scala[FeaturesTestRunner] | ||
|
||
=== With Docker Locally | ||
Coming soon | ||
|
||
== How to use? | ||
|
||
=== Manual Docker command | ||
.Draft | ||
[source, bash] | ||
---- | ||
docker run --rm -ti \ | ||
-v <PATH_TO_YOUR_FEATURES_FOLDER>:/features \ | ||
-v /var/run/docker.sock:/var/run/docker.sock \ | ||
-e KAFKA_BOOTSTRAP_SERVER=<HOST:PORT[,HOST2:PORT2,HOST3:PORT3,...]> \ | ||
-e KAFKA_SCHEMA_REGISTRY_URL=<URL> \ | ||
-e KAFKA_USER=<XXX> \ | ||
-e KAFKA_PASSWORD=<****> \ | ||
-e JAAS_AUTHENT=<true (default) | false> \ | ||
-e LOGGING_LEVEL=<INFO (default) | ERROR | ...> \ | ||
-e THREADS=<8 (default) | ... > \ | ||
<REGISTRY>/kapoeira:<VERSION> | ||
---- | ||
|
||
[NOTE] | ||
==== | ||
* Volume mount on docker.sock only for calling docker command | ||
* KAFKA_SCHEMA_REGISTRY_URL only for AVRO content | ||
==== | ||
|
||
=== Produce & consume a record | ||
|
||
[source, language=gherkin] | ||
---- | ||
include::src/test/resources/features/producer-key-value.feature[] | ||
---- | ||
|
||
=== Produce from a file | ||
|
||
[source, language=gherkin] | ||
---- | ||
include::src/test/resources/features/producer-file-value.feature[] | ||
---- | ||
|
||
=== Specify keys & headers for a record | ||
|
||
[source, language=gherkin] | ||
---- | ||
include::src/test/resources/features/producer-file-key-value.feature[] | ||
---- | ||
|
||
=== Assertions | ||
|
||
[source, language=gherkin] | ||
---- | ||
include::src/test/resources/features/assertions.feature[] | ||
---- | ||
|
||
=== Call functions | ||
|
||
[source, language=gherkin] | ||
---- | ||
include::src/test/resources/features/call-function.feature[] | ||
---- | ||
|
||
=== Call scripts | ||
|
||
[source, language=gherkin] | ||
---- | ||
include::src/test/resources/features/call-external-script.feature[] | ||
---- | ||
|
||
=== Produce & Consume Avro records | ||
|
||
[source, language=gherkin] | ||
---- | ||
include::src/test/resources/features/producer-avro-file-key-value.feature[] | ||
---- | ||
|
||
=== Produce & Consume with batches | ||
|
||
[source, language=gherkin] | ||
---- | ||
include::src/test/resources/features/batch-produce-consume.feature[] | ||
---- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import scala.io.Source | ||
|
||
val projectVersion = { | ||
val versionFile = Source.fromFile("./version.txt") | ||
val version = versionFile.getLines.mkString | ||
versionFile.close() | ||
version | ||
} | ||
|
||
ThisBuild / version := projectVersion | ||
ThisBuild / scalaVersion := "2.13.10" | ||
ThisBuild / organization := "com.lectra.kafka" | ||
ThisBuild / organizationName := "lectra" | ||
ThisBuild / publishConfiguration := publishConfiguration.value.withOverwrite(true) | ||
ThisBuild / publishLocalConfiguration := publishLocalConfiguration.value.withOverwrite(true) | ||
|
||
val zioVersion = "1.0.9" | ||
|
||
lazy val root = (project in file(".")) | ||
.settings( | ||
name := "kapoeira", | ||
// confluent | ||
libraryDependencies += "io.confluent" % "kafka-avro-serializer" % "7.2.2" exclude("javax.ws.rs", "javax.ws.rs-api"), | ||
libraryDependencies += "io.confluent" % "kafka-json-schema-serializer" % "7.2.2" exclude("javax.ws.rs", "javax.ws.rs-api"), | ||
// more libs to include | ||
// https://github.com/confluentinc/schema-registry/blob/master/pom.xml | ||
libraryDependencies += "org.apache.kafka" %% "kafka" % "3.2.3", | ||
libraryDependencies += "io.cucumber" %% "cucumber-scala" % "6.10.2", | ||
libraryDependencies += "io.cucumber" % "cucumber-junit" % "6.10.2", | ||
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.15", | ||
libraryDependencies += "com.typesafe" % "config" % "1.4.2", | ||
libraryDependencies += "io.gatling" % "gatling-jsonpath" % "3.5.1", | ||
libraryDependencies += "com.lihaoyi" %% "requests" % "0.6.9", | ||
libraryDependencies += "com.lihaoyi" %% "ammonite-ops" % "2.3.8", | ||
libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.2.11" % Runtime, | ||
libraryDependencies += "dev.zio" %% "zio" % zioVersion, | ||
libraryDependencies += "dev.zio" %% "zio-streams" % zioVersion, | ||
// only tests | ||
libraryDependencies += "org.scalamock" %% "scalamock" % "5.1.0" % Test, | ||
libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.14.1" % Test, | ||
libraryDependencies ++= Seq( | ||
"dev.zio" %% "zio-test" % zioVersion % "test", | ||
"dev.zio" %% "zio-test-sbt" % zioVersion % "test" | ||
), | ||
testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework") | ||
) | ||
|
||
// assembly config | ||
assembly / assemblyJarName := "kapoeira.jar" | ||
assembly / assemblyMergeStrategy := { | ||
case "module-info.class" => MergeStrategy.discard | ||
case x if x.endsWith("/module-info.class") => MergeStrategy.discard | ||
case "META-INF/io.netty.versions.properties" => MergeStrategy.first | ||
case "kafka/kafka-version.properties" => MergeStrategy.first | ||
case "application.conf" => | ||
new sbtassembly.MergeStrategy { | ||
val name = "reverseConcat" | ||
|
||
def apply( | ||
tempDir: File, | ||
path: String, | ||
files: Seq[File] | ||
): Either[String, Seq[(File, String)]] = | ||
MergeStrategy.concat(tempDir, path, files.reverse) | ||
} | ||
case "logback.xml" => MergeStrategy.first | ||
case x => | ||
val oldStrategy = (assembly / assemblyMergeStrategy).value | ||
oldStrategy(x) | ||
|
||
} | ||
assembly / mainClass := Some("io.cucumber.core.cli.Main") |
Oops, something went wrong.