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: add e2e unittest framework #251

Merged
merged 5 commits into from
Jan 17, 2024

Conversation

dongjiang1989
Copy link
Collaborator

@dongjiang1989 dongjiang1989 commented Dec 15, 2023

Add e2e unittest framework and add One case for CRD Install

fix #248

@dongjiang1989 dongjiang1989 marked this pull request as draft December 20, 2023 02:55
@codecov-commenter
Copy link

codecov-commenter commented Dec 20, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (833c992) 32.02% compared to head (dfbb975) 32.30%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #251      +/-   ##
==========================================
+ Coverage   32.02%   32.30%   +0.28%     
==========================================
  Files          41       41              
  Lines        6426     6426              
==========================================
+ Hits         2058     2076      +18     
+ Misses       4079     4060      -19     
- Partials      289      290       +1     
Flag Coverage Δ
unittests 32.30% <100.00%> (+0.28%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>
@dongjiang1989 dongjiang1989 marked this pull request as ready for review December 21, 2023 11:42
@dongjiang1989
Copy link
Collaborator Author

@peter-wangxu PTAL

@peter-wangxu
Copy link
Collaborator

Do you plan adding a example test case other than install CRD?

@dongjiang1989
Copy link
Collaborator Author

Do you plan adding a example test case other than install CRD?

Yes. I will continue to add e2e cases.

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>
Signed-off-by: dongjiang1989 <dongjiang1989@126.com>
@dongjiang1989
Copy link
Collaborator Author

@peter-wangxu It's need to update token?

[2024-01-08T11:40:03.070Z] ['info'] Pinging Codecov: https://codecov.io/upload/v4?package=github-action-2.1.0-uploader-0.7.1&token=*******&branch=e2e-framework&build=7446893003&build_url=https%3A%2F%2Fgithub.com%2Falibaba%2Fopen-local%2Factions%2Fruns%2F7446893003%2Fjob%2F20258074232&commit=d8411a0ab6dfa9eb3ef6c75eca8cbc54579387b5&job=Build&pr=251&service=github-actions&slug=alibaba%2Fopen-local&name=&tag=&flags=unittests&parent=
[2024-01-08T11:40:03.374Z] ['error'] There was an error running the uploader: Error uploading to [https://codecov.io:](https://codecov.io/) Error: There was an error fetching the storage URL during POST: 404 - {'detail': ErrorDetail(string='Unable to locate build via Github Actions API. Please upload with the Codecov repository upload token to resolve issue.', code='not_found')}
Error: Codecov: Failed to properly upload: The process '/home/runner/work/_actions/codecov/codecov-action/v2/dist/codecov' failed with exit code 255

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>
@peter-wangxu
Copy link
Collaborator

Did you pass local testing? If yes i am ok to merge this now.

Comment on lines +28 to +73
func testInsertAgent(ctx context.Context) func(t *testing.T) {
return func(t *testing.T) {
testCtx := testframework.NewTestCtx(t)
defer testCtx.Cleanup(t)

testNS := testframework.CreateNamespace(context.Background(), t, testCtx)

err := testframework.CreateOrUpdateDaemonSetAndWaitUntilReady(context.Background(), testNS, &appsv1.DaemonSet{
TypeMeta: metav1.TypeMeta{
Kind: "DaemonSet",
APIVersion: "apps/v1",
},
ObjectMeta: metav1.ObjectMeta{
Name: "test-agent",
Namespace: testNS,
Annotations: map[string]string{},
},
Spec: appsv1.DaemonSetSpec{
Selector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"name": "test-agent",
},
},
Template: corev1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{
"name": "test-agent",
},
},
Spec: corev1.PodSpec{
Containers: []corev1.Container{
{
Name: "agent",
Image: testframework.Image,
},
},
},
},
},
})

if err != nil {
t.Fatal(err)
}
}
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@peter-wangxu this is example e2e case.

@dongjiang1989
Copy link
Collaborator Author

Did you pass local testing? If yes i am ok to merge this now.

Yes. Please merge it. I will continue to add e2e cases.

@peter-wangxu peter-wangxu merged commit 850073d into alibaba:main Jan 17, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature] Add e2e case with Kind
3 participants