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

feat: egress e2e test #1289

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

Ressetkk
Copy link
Contributor

@Ressetkk Ressetkk commented Feb 9, 2025

  • Add simple e2e test for egress TLS gateway
  • Add small documentation on writing E2E tests from scratch
  • Add new Makefile target to run E2E tests. It uses gotestsum to generate nice summary of the tests without additional effort from the developer.
  • Add test-e2e to Matrixes of gardener tests on post and release workflows.

This tests implements the official Istio egress tutorial with TLS passthrough.

Note that this test will work only on a cluster that supports NetworkPolicy.

K3s/K3d uses flannel as CNI. Flannel does not support NetworkPolicies very well!

For local cluster only kind supports NetworkPolicies. If we don't want to spend a lot of money on gardener clusters, we should invest in using kind locally and in CI one day.

#1201

@Ressetkk Ressetkk requested review from a team as code owners February 9, 2025 20:47
@kyma-bot kyma-bot added cla: yes Indicates the PR's author has signed the CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Feb 9, 2025
@Ressetkk Ressetkk mentioned this pull request Feb 9, 2025
12 tasks
kubicar
kubicar previously approved these changes Feb 10, 2025
Copy link

@kubicar kubicar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like your approach to e2e topic. This will simplify writing e2e tests, to not make a lot of abstraction without need to do that.
Spotted things to improve:

  • during second implementation of e2e in this approach, generic for infrastructure management task functions should be divided to separate packages.

tests/e2e/egress/egress_test.go Outdated Show resolved Hide resolved
@kyma-bot kyma-bot added the lgtm Looks good to me! label Feb 10, 2025
@kubicar kubicar assigned Ressetkk and unassigned kubicar Feb 10, 2025
@kyma-bot kyma-bot removed the lgtm Looks good to me! label Feb 10, 2025
@kyma-bot
Copy link
Contributor

New changes are detected. LGTM label has been removed.

* add simple e2e test for egress TLS gateway

This tests implements the official Istio egress tutorial with TLS passthrough.

Note that this test will work only on a cluster that supports NetworkPolicy. For local cluster only kind supports NetworkPolicies.
@@ -0,0 +1,56 @@
# End-to-end tests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# End-to-end tests
# End-to-End Tests

Comment on lines +3 to +4
This directory contains definitions and implementations of end-to-end tests for istio operator.
These tests are for testing the connectivity of istio components to external services, implementing user scenarios.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This directory contains definitions and implementations of end-to-end tests for istio operator.
These tests are for testing the connectivity of istio components to external services, implementing user scenarios.
This directory contains definitions and implementations of end-to-end tests for Istio Operator.
These tests verify the connectivity of Istio components to external services, implementing user scenarios.

This directory contains definitions and implementations of end-to-end tests for istio operator.
These tests are for testing the connectivity of istio components to external services, implementing user scenarios.

## Running end-to-end tests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Running end-to-end tests
## Running End-to-End Tests


## Running end-to-end tests

E2E tests run against cluster that is set up as active in your `KUBECONFIG` file. If you want to change the target,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
E2E tests run against cluster that is set up as active in your `KUBECONFIG` file. If you want to change the target,
E2E tests run against a cluster that is set up as active in your `KUBECONFIG` file. If you want to change the target,

export an environment vairable `KUBECONFIG` to specific kubeconfig file. Make sure you have admin permission on a
cluster.

To run the E2E tests, use `make test-e2e` command in project root directory.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To run the E2E tests, use `make test-e2e` command in project root directory.
To run the E2E tests, use the `make test-e2e` command in the project's root directory.

Put libraries used in tests under `pkg` directory, just as in standard Go project scheme.

Function body does not follow a strict methodology. Just keep it simple. Usually they are written as procedural functions.
If you need to implement more advanced logic, remember to not leak the implementation outside the package/function.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If you need to implement more advanced logic, remember to not leak the implementation outside the package/function.
If you need to implement more advanced logic, remember not to leak the implementation outside the package/function.

Function body does not follow a strict methodology. Just keep it simple. Usually they are written as procedural functions.
If you need to implement more advanced logic, remember to not leak the implementation outside the package/function.

Start name of each function with prefix `TestE2E`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Start name of each function with prefix `TestE2E`.
Start each function's name with the prefix `TestE2E`.

If you need to implement more advanced logic, remember to not leak the implementation outside the package/function.

Start name of each function with prefix `TestE2E`.
When running `go test`, we set up pattern for running tests that only start with this prefix.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When running `go test`, we set up pattern for running tests that only start with this prefix.
When running `go test`, we set up a pattern for running tests that only start with this prefix.


When you want to conditionally run specific test, use environment variables.
Those environment variables must be set in the environment before running `go test`. Do not set the variable in the test file.
For example, when the test should run only on gardener, add the simple if statement at the beginning of your test function:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For example, when the test should run only on gardener, add the simple if statement at the beginning of your test function:
For example, when the test should run only on Gardener, add the simple `if` statement at the beginning of your test function:

}
```

When you need to test multiple options in single configuration of a cluster, consider using table-driven tests.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When you need to test multiple options in single configuration of a cluster, consider using table-driven tests.
When you need to test multiple options in a single configuration of a cluster, consider using table-driven tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Indicates the PR's author has signed the CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants