Skip to content

Commit

Permalink
chore: Use pure Citrus instead of YAKS
Browse files Browse the repository at this point in the history
  • Loading branch information
christophd committed Jan 16, 2025
1 parent eec5bf8 commit dc3cbf4
Show file tree
Hide file tree
Showing 159 changed files with 3,287 additions and 3,363 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.
# ---------------------------------------------------------------------------

name: YAKS Tests
name: Integration Tests

on:
pull_request:
Expand Down Expand Up @@ -60,25 +60,25 @@ jobs:
- name: Build Kamelet libraries
run: |
./mvnw clean install -DskipTests -DskipITs
- name: YAKS Tests
- name: Run Tests
run: |
echo "Install JBang via SDKMAN"
curl -s "https://get.sdkman.io" | bash
source "/home/runner/.sdkman/bin/sdkman-init.sh"
sdk install jbang
jbang trust add https://github.com/citrusframework/yaks/
jbang trust add https://github.com/citrusframework/citrus/
jbang trust add https://github.com/apache/camel/
jbang yaks@citrusframework/yaks --version
jbang citrus@citrusframework/citrus --version
jbang camel@apache/camel --version
echo "Running YAKS tests for Kamelets"
echo "Running Citrus tests for Kamelets"
./mvnw clean verify -pl :camel-kamelets-itest -Denable.yaks.tests
./mvnw clean verify -pl :camel-kamelets-itest -Denable.integration.tests
- uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
if: failure()
with:
name: dumps
path: tests/camel-kamelets-itest/.yaks-jbang
path: tests/camel-kamelets-itest/.citrus-jbang
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ terraform.*
.terraform*
.camel-jbang*
.yaks-jbang*
.citrus-jbang*

_output
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@
- Fix AWS DDB Streams Source Kamelet [\#2008](https://github.com/apache/camel-kamelets/pull/2008) ([christophd](https://github.com/christophd))
- Generated sources regen for SBOM [\#2007](https://github.com/apache/camel-kamelets/pull/2007) ([github-actions[bot]](https://github.com/apps/github-actions))
- Replace IBM bean by the IBM jakarta version [\#2006](https://github.com/apache/camel-kamelets/pull/2006) ([gansheer](https://github.com/gansheer))
- Bump org.citrusframework.yaks:yaks-bom from 0.19.0 to 0.19.1 [\#2004](https://github.com/apache/camel-kamelets/pull/2004) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump org.citrusframework.citrus:yaks-bom from 0.19.0 to 0.19.1 [\#2004](https://github.com/apache/camel-kamelets/pull/2004) ([dependabot[bot]](https://github.com/apps/dependabot))
- Kamelet Catalog: Provide a method in the catalog API to get DataType … [\#2002](https://github.com/apache/camel-kamelets/pull/2002) ([oscerd](https://github.com/oscerd))
- Bump org.apache.maven.plugins:maven-gpg-plugin from 3.2.3 to 3.2.4 [\#2001](https://github.com/apache/camel-kamelets/pull/2001) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump org.apache.maven.resolver:maven-resolver-api from 1.9.18 to 1.9.19 [\#2000](https://github.com/apache/camel-kamelets/pull/2000) ([dependabot[bot]](https://github.com/apps/dependabot))
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,16 @@ Kamelets **MAY** choose not to declare a `mediaType` when it varies depending on
### Testing
Kamelets **SHOULD** be accompanied with testing code that verifies their correct behavior.
Kamelets **SHOULD** be accompanied by tests that verify their correct behavior.
[Yaks](https://github.com/citrusframework/yaks) is the testing framework of choice for Kamelets and the one implemented in the CI.
[Citrus](https://github.com/citrusframework/citrus) is the testing framework of choice for Kamelets and the one implemented in the CI.
Test code must be submitted in the `test/<kamelet-name>/` directory in the root of this repository.
Test code must be submitted in the `tests/camel-kamelets-itests/src/test/resources/<kamelet-name>/` directory in the root of this repository.
Kamelets submitted with tests that verify their correctness **MUST** be labeled with `camel.apache.org/kamelet.verified=true`.
> [!NOTE]
> There's no way at the moment to inject credentials for external systems into the CI in order to write more advanced tests, but we can expect we'll find an usable strategy in the long run.
> There's no way at the moment to inject credentials for external systems into the CI in order to write more advanced tests, but we can expect we'll find a usable strategy in the long run.
### Kamelet Pipe Examples
Expand Down
4 changes: 2 additions & 2 deletions docs/modules/ROOT/pages/development.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1422,8 +1422,8 @@ This will create a new integration that forwards the Apache Camel logo to your p

The most obvious way to test a Kamelet is via an e2e tests that verifies if the Kamelet respects its specification.

https://github.com/citrusframework/yaks[YAKS] is the framework of choice for such e2e tests. You can find more information and
documentation starting from the https://github.com/citrusframework/yaks[YAKS GitHub repository]. Here we'll provide examples for the Kamelets above.
https://github.com/citrusframework/citrus[Citrus] is the framework of choice for such e2e tests. You can find more information and
documentation starting from the https://github.com/citrusframework/citrus[Citrus GitHub repository]. Here we'll provide examples for the Kamelets above.

=== Testing a source

Expand Down
3 changes: 1 addition & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-dependencies</artifactId>
<version>4.9.0</version>
<version>4.9.0</version>
</parent>

<groupId>org.apache.camel.kamelets</groupId>
Expand Down Expand Up @@ -66,7 +66,6 @@

<citrus.version>4.5.0</citrus.version>
<cucumber.version>7.20.1</cucumber.version>
<yaks.version>0.21.0-SNAPSHOT</yaks.version>

<!-- Versions used inside Kamelets (add them also to the dependencyManagement section and the groovy script below) -->
<!-- These properties must keep this same format "version.<groupId>.<artifactId>" -->
Expand Down
14 changes: 7 additions & 7 deletions tests/camel-kamelets-itest/README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
# Kamelets YAKS Tests
# Kamelets Citrus Tests

This folder contains a suite of integration tests for Kamelets

You need the following tools to run the tests:
- Java 17
- [JBang](https://www.jbang.dev/)
- [Camel JBang](https://camel.apache.org/manual/camel-jbang.html)
- [YAKS](https://github.com/citrusframework/yaks)
- [Citrus JBang App](https://citrusframework.org/citrus/reference/html/index.html#runtime-jbang-install)

Once everything is set you just need to run

```console
mvn verify -Denable.yaks.tests
mvn verify -Denable.integration.tests
```

This runs all available YAKS tests that are not marked as `@ignored`.
This runs all available Citrus tests.

You can run individual tests when specifying its folder or feature file name.
You can run individual tests when specifying its folder name on the class `KameletsIT` (e.g. `aws`).

```console
mvn verify -Dcucumber.feature=aws/s3/aws-s3-to-http.feature -Denable.yaks.tests
mvn verify -Dtest=KameletsIT#aws
```

You can run the tests also from your favorite Java IDE.
By default, the YAKS tests use local runtime where Camel integrations, Kamelets, bindings and pipes are run with Camel JBang.
By default, the Citrus tests use local runtime where Camel integrations, Kamelets, bindings and pipes are run with Camel JBang.
82 changes: 17 additions & 65 deletions tests/camel-kamelets-itest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<description>Camel Kamelets Integration Tests</description>

<properties>
<enable.yaks.tests>*YaksIT</enable.yaks.tests>
<enable.integration.tests>*KameletsIT</enable.integration.tests>
</properties>

<dependencyManagement>
Expand All @@ -46,31 +46,10 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.citrusframework.yaks</groupId>
<artifactId>yaks-bom</artifactId>
<version>${yaks.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<!-- Test scoped dependencies -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>

<!-- Apache Camel -->
<dependency>
<groupId>org.apache.camel</groupId>
Expand Down Expand Up @@ -117,79 +96,52 @@
</dependency>
<dependency>
<groupId>org.citrusframework</groupId>
<artifactId>citrus-spring</artifactId>
<artifactId>citrus-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.citrusframework</groupId>
<artifactId>citrus-junit</artifactId>
<artifactId>citrus-jbang-connector</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.citrusframework</groupId>
<artifactId>citrus-mail</artifactId>
<artifactId>citrus-testcontainers</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.citrusframework</groupId>
<artifactId>citrus-validation-text</artifactId>
<artifactId>citrus-yaml</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.citrusframework</groupId>
<artifactId>citrus-validation-json</artifactId>
<scope>test</scope>
</dependency>

<!-- YAKS -->
<dependency>
<groupId>org.citrusframework.yaks</groupId>
<artifactId>yaks-standard</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.citrusframework.yaks</groupId>
<artifactId>yaks-http</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.citrusframework.yaks</groupId>
<artifactId>yaks-kubernetes</artifactId>
<artifactId>citrus-groovy</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.citrusframework.yaks</groupId>
<artifactId>yaks-knative</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.citrusframework.yaks</groupId>
<artifactId>yaks-kafka</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.citrusframework.yaks</groupId>
<artifactId>yaks-groovy</artifactId>
<groupId>org.citrusframework</groupId>
<artifactId>citrus-camel</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.citrusframework.yaks</groupId>
<artifactId>yaks-camel</artifactId>
<groupId>org.citrusframework</groupId>
<artifactId>citrus-kafka</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.citrusframework.yaks</groupId>
<artifactId>yaks-camel-k</artifactId>
<groupId>org.citrusframework</groupId>
<artifactId>citrus-mail</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.citrusframework.yaks</groupId>
<artifactId>yaks-testcontainers</artifactId>
<groupId>org.citrusframework</groupId>
<artifactId>citrus-validation-text</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.citrusframework.yaks</groupId>
<artifactId>yaks-jdbc</artifactId>
<groupId>org.citrusframework</groupId>
<artifactId>citrus-validation-json</artifactId>
<scope>test</scope>
</dependency>

Expand Down Expand Up @@ -223,7 +175,7 @@
<version>${maven-failsafe-plugin.version}</version>
<configuration>
<excludes>
<exclude>${enable.yaks.tests}</exclude>
<exclude>${enable.integration.tests}</exclude>
</excludes>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,25 @@
* limitations under the License.
*/

import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;
import org.citrusframework.annotations.CitrusConfiguration;
import org.citrusframework.http.server.HttpServer;
import org.citrusframework.spi.BindToRegistry;
import org.springframework.http.HttpStatus;

@RunWith(Cucumber.class)
@CucumberOptions(
//features = "src/test/resources/openapi",
extraGlue = "org.citrusframework.yaks",
plugin = { "pretty", "org.citrusframework.yaks.report.TestReporter" }
)
public class KameletsYaksIT {
import static org.citrusframework.http.endpoint.builder.HttpEndpoints.http;

@CitrusConfiguration
public class EndpointAutoConfiguration {

@BindToRegistry
public HttpServer httpServer() {
return http()
.server()
.port(8081)
.defaultStatus(HttpStatus.CREATED)
.timeout(120000L)
.autoStart(true)
.build();
}

}
Loading

0 comments on commit dc3cbf4

Please sign in to comment.