Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[system test] [doc] bridge package #10225

Merged
merged 20 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .azure/scripts/uncommitted-changes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ set -e
echo "Build reason: ${BUILD_REASON}"
echo "Source branch: ${BRANCH}"

CHANGED_DERIVED=$(git diff --name-status -- packaging/install/ packaging/helm-charts/ documentation/modules/appendix_crds.adoc cluster-operator/src/main/resources/cluster-roles)
GENERATED_FILES=$(git ls-files --other --exclude-standard -- packaging/install/ packaging/helm-charts/ cluster-operator/src/main/resources/cluster-roles api/src/test/resources/io/strimzi/api/kafka/model)
CHANGED_DERIVED=$(git diff --name-status -- packaging/install/ packaging/helm-charts/ documentation/modules/appendix_crds.adoc cluster-operator/src/main/resources/cluster-roles development-docs/systemtests/)
GENERATED_FILES=$(git ls-files --other --exclude-standard -- packaging/install/ packaging/helm-charts/ cluster-operator/src/main/resources/cluster-roles api/src/test/resources/io/strimzi/api/kafka/model development-docs/systemtests/)
if [ -n "$CHANGED_DERIVED" ] || [ -n "$GENERATED_FILES" ] ; then
if [ -n "$CHANGED_DERIVED" ] ; then
echo "ERROR: Uncommitted changes in derived resources:"
Expand All @@ -22,7 +22,7 @@ if [ -n "$CHANGED_DERIVED" ] || [ -n "$GENERATED_FILES" ] ; then
echo " && make crd_install \\"
echo " && make dashboard_install \\"
echo " && make helm_install \\"
echo " && git add packaging/install/ packaging/helm-charts/ documentation/modules/appendix_crds.adoc cluster-operator/src/main/resources/cluster-roles \\"
echo " && git add packaging/install/ packaging/helm-charts/ documentation/modules/appendix_crds.adoc cluster-operator/src/main/resources/cluster-roles development-docs/systemtests/ \\"
echo " && git commit -s -m 'Update derived resources'"
exit 1
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# HttpBridgeCorsST

**Description:** Test suite for HTTP Bridge CORS functionality, focusing on verifying correct handling of allowed and forbidden origins.

**Before tests execution steps:**

| Step | Action | Result |
| - | - | - |
| 1. | Set up Kafka Bridge and its configuration including CORS settings | Kafka Bridge is set up with the correct configuration |
| 2. | Deploy required Kafka resources and scraper pod | Kafka resources and scraper pod are deployed and running |

**Labels:**

* [bridge](labels/bridge.md)

<hr style="border:1px solid">

## testCorsForbidden

**Description:** Test ensuring that CORS (Cross-Origin Resource Sharing) requests with forbidden origins are correctly rejected by the Bridge.

**Steps:**

| Step | Action | Result |
| - | - | - |
| 1. | Create Kafka Bridge user and consumer group | Kafka Bridge user and consumer group are created successfully |
| 2. | Set up headers with forbidden origin and pre-flight HTTP OPTIONS method | Headers and method are set correctly |
| 3. | Send HTTP OPTIONS request to the Bridge | HTTP OPTIONS request is sent to the Bridge and a response is received |
| 4. | Verify the response contains '403' and 'CORS Rejected - Invalid origin' | Response indicates the CORS request is rejected |
| 5. | Remove 'Access-Control-Request-Method' from headers and set HTTP POST method | Headers are updated and HTTP method is set correctly |
| 6. | Send HTTP POST request to the Bridge | HTTP POST request is sent to the Bridge and a response is received |
| 7. | Verify the response contains '403' and 'CORS Rejected - Invalid origin' | Response indicates the CORS request is rejected |

**Labels:**

* [bridge](labels/bridge.md)


## testCorsOriginAllowed

**Description:** This test checks if CORS handling for allowed origin works correctly in the Kafka Bridge.

**Steps:**

| Step | Action | Result |
| - | - | - |
| 1. | Set up the Kafka Bridge user and configuration | Kafka Bridge user and configuration are set up |
| 2. | Construct the request URL and headers | URL and headers are constructed properly |
| 3. | Send OPTIONS request to Kafka Bridge and capture the response | Response is captured from Bridge |
| 4. | Validate the response contains expected status codes and headers | Response has correct status codes and headers for allowed origin |
| 5. | Send GET request to Kafka Bridge and capture the response | Response is captured from Bridge for GET request |
| 6. | Check if the GET request response is '404 Not Found' | Response for GET request is 404 Not Found |

**Labels:**

* [bridge](labels/bridge.md)

Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
# HttpBridgeST

**Description:** Test suite for various Kafka Bridge operations.

**Before tests execution steps:**

| Step | Action | Result |
| - | - | - |
| 1. | Initialize Test Storage and deploy Kafka and Kafka Bridge | Kafka and Kafka Bridge are deployed with necessary configuration |

**Labels:**

* [bridge](labels/bridge.md)

<hr style="border:1px solid">

## testConfigureDeploymentStrategy

**Description:** Test verifies KafkaBridge deployment strategy configuration and label updates with RECREATE and ROLLING_UPDATE strategies.

**Steps:**

| Step | Action | Result |
| - | - | - |
| 1. | Create KafkaBridge resource with deployment strategy RECREATE | KafkaBridge resource is created in RECREATE strategy |
| 2. | Add a label to KafkaBridge resource | KafkaBridge resource is recreated with new label |
| 3. | Check that observed generation is 1 and the label is present | Observed generation is 1 and label 'some=label' is present |
| 4. | Change deployment strategy to ROLLING_UPDATE | Deployment strategy is changed to ROLLING_UPDATE |
| 5. | Add another label to KafkaBridge resource | Pods are rolled with new label |
| 6. | Check that observed generation is 2 and the new label is present | Observed generation is 2 and label 'another=label' is present |

**Labels:**

* [bridge](labels/bridge.md)


## testCustomAndUpdatedValues

**Description:** Test that validates the creation, update, and verification of a Kafka Bridge with specific initial and updated configurations.

**Steps:**

| Step | Action | Result |
| - | - | - |
| 1. | Create a Kafka Bridge resource with initial configuration | Kafka Bridge is created and deployed with the specified initial configuration |
| 2. | Remove an environment variable that is in use | Environment variable TEST_ENV_1 is removed from the initial configuration |
| 3. | Verify initial probe values and environment variables | The probe values and environment variables match the initial configuration |
| 4. | Update Kafka Bridge resource with new configuration | Kafka Bridge is updated and redeployed with the new configuration |
| 5. | Verify updated probe values and environment variables | The probe values and environment variables match the updated configuration |
| 6. | Verify Kafka Bridge configurations for producer and consumer | Producer and consumer configurations match the updated settings |

**Labels:**

* [bridge](labels/bridge.md)


## testCustomBridgeLabelsAreProperlySet

**Description:** Test verifying if custom labels and annotations for Kafka Bridge services are properly set and validated.

**Steps:**

| Step | Action | Result |
| - | - | - |
| 1. | Initialize TestStorage | TestStorage instance is created with the current test context |
| 2. | Create Kafka Bridge resource with custom labels and annotations | Kafka Bridge resource is successfully created and available |
| 3. | Retrieve Kafka Bridge service with custom labels | Kafka Bridge service is retrieved with specified custom labels |
| 4. | Filter and validate custom labels and annotations | Custom labels and annotations match the expected values |

**Labels:**

* `label` (description file doesn't exist)
* `annotation` (description file doesn't exist)


## testDiscoveryAnnotation

**Description:** Test verifying the presence and correctness of the discovery annotation in the Kafka Bridge service.

**Steps:**

| Step | Action | Result |
| - | - | - |
| 1. | Retrieve the Kafka Bridge service using kubeClient | Kafka Bridge service instance is obtained |
| 2. | Extract the discovery annotation from the service metadata | The discovery annotation is retrieved as a string |
| 3. | Convert the discovery annotation to a JsonArray | JsonArray representation of the discovery annotation is created |
| 4. | Validate the content of the JsonArray against expected values | The JsonArray matches the expected service discovery information |

**Labels:**

* `service_discovery_verification` (description file doesn't exist)
* `annotation_validation` (description file doesn't exist)


## testReceiveSimpleMessage

**Description:** Test verifying that a simple message can be received using Kafka Bridge.

**Steps:**

| Step | Action | Result |
| - | - | - |
| 1. | Initialize the test storage | TestStorage instance is initialized |
| 2. | Create Kafka topic resource | Kafka topic resource is created with specified configurations |
| 3. | Setup and deploy Kafka Bridge consumer client | Kafka Bridge consumer client is set up and started receiving messages |
| 4. | Send messages using Kafka producer | Messages are sent to Kafka successfully |
| 5. | Verify message reception | All messages are received by Kafka Bridge consumer client |

**Labels:**

* [bridge](labels/bridge.md)


## testScaleBridgeSubresource

**Description:** Test checks the scaling of a KafkaBridge subresource and verifies the scaling operation.

**Steps:**

| Step | Action | Result |
| - | - | - |
| 1. | Initialize the KafkaBridge resource. | KafkaBridge resource is created in the specified namespace. |
| 2. | Scale the KafkaBridge resource to the desired replicas. | KafkaBridge resource is scaled to the expected number of replicas. |
| 3. | Verify the number of replicas. | The number of replicas is as expected and the observed generation is correct. |
| 4. | Check pod naming conventions. | Pod names should match the naming convention and be consistent. |

**Labels:**

* [bridge](labels/bridge.md)


## testScaleBridgeToZero

**Description:** Test that scales a KafkaBridge instance to zero replicas and verifies that it is properly handled.

**Steps:**

| Step | Action | Result |
| - | - | - |
| 1. | Create a KafkaBridge resource and wait for it to be ready | KafkaBridge resource is created and ready with 1 replica |
| 2. | Fetch the current number of KafkaBridge pods | There should be exactly 1 KafkaBridge pod initially |
| 3. | Scale KafkaBridge to zero replicas | Scaling action is acknowledged |
| 4. | Wait for KafkaBridge to scale down to zero replicas | KafkaBridge scales down to zero replicas correctly |
| 5. | Check the number of KafkaBridge pods after scaling | No KafkaBridge pods should be running |
| 6. | Verify the status of KafkaBridge | KafkaBridge status should indicate it is ready with zero replicas |

**Labels:**

* [bridge](labels/bridge.md)


## testSendSimpleMessage

**Description:** Test validating that sending a simple message through Kafka Bridge works correctly and checks labels.

**Steps:**

| Step | Action | Result |
| - | - | - |
| 1. | Initialize test storage | Test storage is initialized with necessary context |
| 2. | Create a Kafka Bridge client job | Kafka Bridge client job is configured and instantiated |
| 3. | Create Kafka topic | Kafka topic is successfully created |
| 4. | Start Kafka Bridge producer | Kafka Bridge producer successfully begins sending messages |
| 5. | Wait for producer success | All messages are sent successfully |
| 6. | Start Kafka consumer | Kafka consumer is instantiated and starts consuming messages |
| 7. | Wait for consumer success | All messages are consumed successfully |
| 8. | Verify Kafka Bridge pod labels | Labels for Kafka Bridge pods are correctly set and verified |
| 9. | Verify Kafka Bridge service labels | Labels for Kafka Bridge service are correctly set and verified |

**Labels:**

* [bridge](labels/bridge.md)

Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# HttpBridgeScramShaST

**Description:** Test suite for validating Kafka Bridge functionality with TLS and SCRAM-SHA authentication

**Before tests execution steps:**

| Step | Action | Result |
| - | - | - |
| 1. | Create TestStorage instance | TestStorage instance is created |
| 2. | Create BridgeClients instance | BridgeClients instance is created |
| 3. | Deploy Kafka and KafkaBridge | Kafka and KafkaBridge are deployed successfully |
| 4. | Create Kafka topic | Kafka topic is created with the given configuration |
| 5. | Create Kafka user with SCRAM-SHA authentication | Kafka user is created and configured with SCRAM-SHA authentication |
| 6. | Deploy HTTP bridge | HTTP bridge is deployed |

**Labels:**

* [bridge](labels/bridge.md)

<hr style="border:1px solid">

## testReceiveSimpleMessageTlsScramSha

**Description:** Test to check the reception of a simple message via Kafka Bridge using TLS and SCRAM-SHA encryption.

**Steps:**

| Step | Action | Result |
| - | - | - |
| 1. | Initialize TestStorage and BridgeClientsBuilder instances | Instances are successfully initialized |
| 2. | Create Kafka topic using ResourceManager | Kafka topic is created and available |
| 3. | Create Bridge consumer using ResourceManager | Bridge consumer is successfully created |
| 4. | Send messages to Kafka using KafkaClients | Messages are successfully sent to the Kafka topic |
| 5. | Wait for clients' success validation | Messages are successfully consumed from the Kafka topic |

**Labels:**

* [bridge](labels/bridge.md)


## testSendSimpleMessageTlsScramSha

**Description:** Test ensuring that sending a simple message using TLS and SCRAM-SHA authentication via Kafka Bridge works as expected.

**Steps:**

| Step | Action | Result |
| - | - | - |
| 1. | Create TestStorage and BridgeClients objects | Instances of TestStorage and BridgeClients are created |
| 2. | Create topic using the resource manager | Topic is created successfully with the specified configuration |
| 3. | Start producing messages via Kafka Bridge | Messages are produced successfully to the topic |
| 4. | Wait for producer success | Producer finishes sending messages without errors |
| 5. | Create KafkaClients and configure with TLS and SCRAM-SHA | Kafka client is configured with appropriate security settings |
| 6. | Start consuming messages via Kafka client | Messages are consumed successfully from the topic |
| 7. | Wait for consumer success | Consumer finishes receiving messages without errors |

**Labels:**

* [bridge](labels/bridge.md)

Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# HttpBridgeTlsST

**Description:** Test suite for verifying TLS functionalities in the HTTP Bridge.

**Before tests execution steps:**

| Step | Action | Result |
| - | - | - |
| 1. | Initialize test storage and context | Test storage and context are initialized successfully |
| 2. | Deploy Kafka and KafkaBridge | Kafka and KafkaBridge are deployed and running |
| 3. | Create Kafka user with TLS configuration | Kafka user with TLS configuration is created |
| 4. | Deploy HTTP bridge with TLS configuration | HTTP bridge is deployed with TLS configuration |

**Labels:**

* [bridge](labels/bridge.md)

<hr style="border:1px solid">

## testReceiveSimpleMessageTls

**Description:** Test to verify that a simple message can be received using TLS in a parallel environment.

**Steps:**

| Step | Action | Result |
| - | - | - |
| 1. | Initialize the test storage instance | TestStorage object is instantiated with the test context. |
| 2. | Configure Kafka Bridge client for consumption | Kafka Bridge client is configured with topic and consumer names. |
| 3. | Create Kafka topic with provided configurations | Kafka topic resource is created and available. |
| 4. | Deploy the Kafka Bridge consumer | Kafka Bridge consumer starts successfully and is ready to consume messages. |
| 5. | Initialize TLS Kafka client for message production | TLS Kafka client is configured and initialized. |
| 6. | Deploy the Kafka producer TLS client | TLS Kafka producer client starts successfully and begins sending messages. |
| 7. | Verify message consumption | Messages are successfully consumed by the Kafka Bridge consumer. |

**Labels:**

* [bridge](labels/bridge.md)


## testSendSimpleMessageTls

**Description:** Test to verify that sending a simple message using TLS works correctly.

**Steps:**

| Step | Action | Result |
| - | - | - |
| 1. | Initialize TestStorage and BridgeClients with TLS configuration | TestStorage and BridgeClients are initialized with TLS configuration |
| 2. | Create Kafka topic using resource manager | Kafka topic is successfully created |
| 3. | Create Kafka Bridge Client job for producing messages | Kafka Bridge Client job is created and produces messages successfully |
| 4. | Verify that the producer successfully sends messages | Producer successfully sends the expected number of messages |
| 5. | Create Kafka client consumer with TLS configuration | Kafka client consumer is created with TLS configuration |
| 6. | Verify that the consumer successfully receives messages | Consumer successfully receives the expected number of messages |

**Labels:**

* [bridge](labels/bridge.md)

22 changes: 22 additions & 0 deletions development-docs/systemtests/labels/bridge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# **Bridge**

## Description
These tests checks of various configurations and features of the Kafka Bridge component within the Strimzi ecosystem.
The Kafka Bridge facilitates communication between HTTP clients and Kafka clusters, enabling the integration of REST APIs with Kafka messaging.
These tests ensure that the bridge behaves as expected under various configurations, security protocols, and network setups.


<!-- generated part -->
**Tests:**
- [testScaleBridgeSubresource](../../.././development-docs/systemtests/io.strimzi.systemtest.bridge.HttpBridgeST.md)
- [testSendSimpleMessage](../../.././development-docs/systemtests/io.strimzi.systemtest.bridge.HttpBridgeST.md)
- [testReceiveSimpleMessageTlsScramSha](../../.././development-docs/systemtests/io.strimzi.systemtest.bridge.HttpBridgeScramShaST.md)
- [testReceiveSimpleMessage](../../.././development-docs/systemtests/io.strimzi.systemtest.bridge.HttpBridgeST.md)
- [testCorsOriginAllowed](../../.././development-docs/systemtests/io.strimzi.systemtest.bridge.HttpBridgeCorsST.md)
- [testSendSimpleMessageTls](../../.././development-docs/systemtests/io.strimzi.systemtest.bridge.HttpBridgeTlsST.md)
- [testCorsForbidden](../../.././development-docs/systemtests/io.strimzi.systemtest.bridge.HttpBridgeCorsST.md)
- [testReceiveSimpleMessageTls](../../.././development-docs/systemtests/io.strimzi.systemtest.bridge.HttpBridgeTlsST.md)
- [testConfigureDeploymentStrategy](../../.././development-docs/systemtests/io.strimzi.systemtest.bridge.HttpBridgeST.md)
- [testCustomAndUpdatedValues](../../.././development-docs/systemtests/io.strimzi.systemtest.bridge.HttpBridgeST.md)
- [testSendSimpleMessageTlsScramSha](../../.././development-docs/systemtests/io.strimzi.systemtest.bridge.HttpBridgeScramShaST.md)
- [testScaleBridgeToZero](../../.././development-docs/systemtests/io.strimzi.systemtest.bridge.HttpBridgeST.md)
Loading
Loading