Skip to content

E2E test framework#443

Merged
kmesh-bot merged 18 commits intokmesh-net:mainfrom
YaoZengzeng:e2e
Jun 27, 2024
Merged

E2E test framework#443
kmesh-bot merged 18 commits intokmesh-net:mainfrom
YaoZengzeng:e2e

Conversation

@YaoZengzeng
Copy link
Copy Markdown
Member

What type of PR is this?

/kind feature

What this PR does / why we need it:

E2E test framework to make the project more robust

Which issue(s) this PR fixes:
Fixes most part of #137

Special notes for your reviewer:

Does this PR introduce a user-facing change?:


path: istio-token
containers:
- name: kmesh
image: ghcr.io/kmesh-net/kmesh:latest
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's better to open a new folder for e2e's yaml

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good catch, I should find a way to configure HUB of the image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How do you install, if using helm we can customize the image

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Now I apply yamls directly for convenience and I will use helm later.

# Exit immediately for non zero status
set -e

DEFAULT_KIND_IMAGE="kindest/node:v1.30.0@sha256:047357ac0cfea04663786a612ba1eaba9702bef25227a794b52890dd8bcd692e"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If you limit the kind/node image version, you will also have a limit on the kind version.
I have another option:Check for kind, then create cluster without specifying image.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Istio uses this to test on compatability with different k8s version.

What we need maybe add a mechanism to test comaptability with differen istio versions

build_and_push_images
fi

go test -v -tags=integ ./test/e2e/...
Copy link
Copy Markdown
Contributor

@LiZhenCheng9527 LiZhenCheng9527 Jun 18, 2024

Choose a reason for hiding this comment

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

Suggested change
go test -v -tags=integ ./test/e2e/...
go test -v -tags=integ $ROOT_DIR/test/e2e/...

ROOT_DIR=$(git rev-parse --show-toplevel)
Preventing test failures by not running in the kmesh root directory.

@YaoZengzeng YaoZengzeng force-pushed the e2e branch 4 times, most recently from 1438e87 to 52777b8 Compare June 18, 2024 07:50
@YaoZengzeng YaoZengzeng mentioned this pull request Jun 18, 2024
@YaoZengzeng YaoZengzeng force-pushed the e2e branch 2 times, most recently from 66ff584 to 59a61a6 Compare June 19, 2024 01:52
@YaoZengzeng YaoZengzeng force-pushed the e2e branch 4 times, most recently from 1fb6e0a to 8a7ffc4 Compare June 21, 2024 09:22
hzxuzhonghu
hzxuzhonghu previously approved these changes Jun 22, 2024
Copy link
Copy Markdown
Member

@hzxuzhonghu hzxuzhonghu left a comment

Choose a reason for hiding this comment

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

Looked just a small part


### Motivation

E2E testing is a software approach that tests an application's workflow from start to finish, simulating read-user scenarios. The main purpose of E2E testing is to validate the system as a whole,ensuring that all the individual components and integrations work together seamlessly. It helps to identify any issues or defects that may arise from the interation between different components of the appliction, ensuing the application works as expected under normal operating conditions.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

s/defects/detects

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

simulating read-user scenarios. what does this mean?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

s/defects/detects

It is defetcs actually :)

simulating read-user scenarios. what does this mean?

updated, it is real user scenarios.


1. Use [namespace](https://github.com/istio/istio/blob/master/pkg/test/framework/components/namespace/namespace.go) package to create namespace for deploying test applications.

2. Use [deployment](https://github.com/istio/istio/blob/master/pkg/test/framework/components/echo/deployment/builder.go) package to build test applications. `WithClusters()` can be used to specify the clusters where the test applications should be deployed. Each call to `WithConfig()` will generate a test application with corresponding configuration. Actually we create all test applications at the beginning. In each test case, we select some suitable applications for testing. And an application can be used as both a client and a server.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should document if these apps do not satisfy new tests, how can developer deploy new apps

// Client-go does not handle different versions of mergo due to some breaking changes - use the matching version
replace github.com/imdario/mergo => github.com/imdario/mergo v0.3.5

replace istio.io/api => istio.io/api v1.22.0-alpha.1.0.20240620154034-5b788fec62d2
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why replace instead of bumping directly

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

If we bump directly, it will use version istio.io/api v1.22.1, there will be some interface incompatible

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I donot understand what do you mean

@@ -0,0 +1,155 @@
//go:build integ
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

do we really need this building tag

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It will be added automaticlly in my vscode

# Exit immediately for non zero status
set -e

DEFAULT_KIND_IMAGE="kindest/node:v1.30.0@sha256:047357ac0cfea04663786a612ba1eaba9702bef25227a794b52890dd8bcd692e"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Istio uses this to test on compatability with different k8s version.

What we need maybe add a mechanism to test comaptability with differen istio versions

fi

# Create KinD cluster.
cat <<EOF | kind create cluster --name="${NAME}" -v4 --retain --image "${IMAGE}" --config=-
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can we add a multi nodes cluster, since we have daemonset


builder := deployment.New(t).
WithClusters(t.Clusters()...).
/*
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

remove

Comment on lines +54 to +59
// AllWaypoint is a waypoint for all types
AllWaypoint echo.Instances
// WorkloadAddressedWaypoint is a workload only waypoint
WorkloadAddressedWaypoint echo.Instances
// ServiceAddressedWaypoint is a service only waypoint
ServiceAddressedWaypoint echo.Instances
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am not sure this is suitable for kmesh, at least the names and comments are confusing

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

removed, we don't need these fields now.

Captured = "captured"
Uncaptured = "uncaptured"
WaypointImageAnnotation = "sidecar.istio.io/proxyImage"
KmeshCustomWaypointImage = "ghcr.io/kmesh-net/waypoint-x86:v0.3.0"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should support customize it

}
if src.Config().IsUncaptured() {
// TODO: fix this and remove this skip
t.Skip("https://github.com/istio/istio/issues/43238")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The test case is direclty copied from ambient integration test (https://github.com/istio/istio/blob/master/tests/integration/ambient/baseline_test.go#L628`).

Actually I think most the test cases there should be copied and used direcly. Because we need to fully match ambient's capabilities and be transparent to isito and users.

if opt.Scheme != scheme.HTTP {
return
}
if !dst.Config().HasServiceAddressedWaypointProxy() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you remove this istio special concept

Signed-off-by: YaoZengzeng <yaozengzeng@huawei.com>
Signed-off-by: YaoZengzeng <yaozengzeng@huawei.com>
Signed-off-by: YaoZengzeng <yaozengzeng@huawei.com>
Signed-off-by: YaoZengzeng <yaozengzeng@huawei.com>
Signed-off-by: YaoZengzeng <yaozengzeng@huawei.com>
Signed-off-by: YaoZengzeng <yaozengzeng@huawei.com>
Signed-off-by: YaoZengzeng <yaozengzeng@huawei.com>
Signed-off-by: YaoZengzeng <yaozengzeng@huawei.com>
Signed-off-by: YaoZengzeng <yaozengzeng@huawei.com>
Signed-off-by: YaoZengzeng <yaozengzeng@huawei.com>
Signed-off-by: YaoZengzeng <yaozengzeng@huawei.com>
Signed-off-by: YaoZengzeng <yaozengzeng@huawei.com>
Signed-off-by: YaoZengzeng <yaozengzeng@huawei.com>
Signed-off-by: YaoZengzeng <yaozengzeng@huawei.com>
Copy link
Copy Markdown
Member

@hzxuzhonghu hzxuzhonghu left a comment

Choose a reason for hiding this comment

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

looks super good, i will try with it. And understand it deeper

fi

if [[ -z "${SKIP_SETUP:-}" ]]; then
setup_kind_cluster
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If i have already installed kind cluster and istio, how can i reuse them

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

You can use flags to skip some steps, the specific usage method has been added to the proposal.

Signed-off-by: YaoZengzeng <yaozengzeng@huawei.com>
Signed-off-by: YaoZengzeng <yaozengzeng@huawei.com>
@YaoZengzeng
Copy link
Copy Markdown
Member Author

@hzxuzhonghu PTAL

Copy link
Copy Markdown
Member

@hzxuzhonghu hzxuzhonghu left a comment

Choose a reason for hiding this comment

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

/lgtm

@kmesh-bot
Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hzxuzhonghu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kmesh-bot kmesh-bot merged commit ba03077 into kmesh-net:main Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants