-
Notifications
You must be signed in to change notification settings - Fork 81
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: dongjiang1989 <dongjiang1989@126.com>
f9fa90e
to
cfd9647
Compare
@peter-wangxu PTAL |
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>
@peter-wangxu It's need to update token?
|
Signed-off-by: dongjiang1989 <dongjiang1989@126.com>
Did you pass local testing? If yes i am ok to merge this now. |
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) | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
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.
Yes. Please merge it. I will continue to add e2e cases. |
Add e2e unittest framework and add One case for CRD Install
fix #248