-
Notifications
You must be signed in to change notification settings - Fork 17
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
add e2e for http #31
add e2e for http #31
Conversation
Codecov Report
@@ Coverage Diff @@
## main #31 +/- ##
=======================================
Coverage 40.28% 40.28%
=======================================
Files 8 8
Lines 494 494
=======================================
Hits 199 199
Misses 291 291
Partials 4 4
Flags with carried forward coverage won't be shown. Click here to find out more. |
11daec2
to
569389f
Compare
test/e2e/common/constants.go
Outdated
MultusNamespace = "kube-system" | ||
MultusCRName = "ptp" | ||
|
||
KDoctorAgentNS = "kube-system" |
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.
不应该是 hardcode,而是 CI 变量传递
testDS, e := frame.GetDaemonSet(common.KDoctorTestDSName, common.KDoctorAgentNS) | ||
Expect(e).NotTo(HaveOccurred(), "get kdoctor test daemonset") | ||
|
||
testPods, e := frame.GetDaemonSetPodList(testDS) |
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.
这个服务是在哪行代码启动的
e724314
to
4695610
Compare
282c757
to
ce5ca04
Compare
test/yaml/kdoctortoken.yaml
Outdated
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: kdoctor-test-token |
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.
apiserver-token
test/e2e/common/constants.go
Outdated
|
||
const ( | ||
ImageRegistry = "ghcr.io/kdoctor-io/kdoctor-agent" | ||
PluginReportPath = "/apis/system.kdoctor.io/v1beta1/namespaces/default/pluginreports/" |
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.
避免 hardcode, 没有 import 来引用么
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.
没有
test/e2e/common/constants.go
Outdated
import "os" | ||
|
||
const ( | ||
ImageRegistry = "ghcr.io/kdoctor-io/kdoctor-agent" |
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.
不能 hardcode,要工程化,否则不能本地跑
应该 外部 通过 helm 绚烂 获取出 agent 的 image
test/e2e/common/constants.go
Outdated
PluginReportPath = "/apis/system.kdoctor.io/v1beta1/namespaces/default/pluginreports/" | ||
|
||
KDoctorAgentDSName = "kdoctor-agent" | ||
KdoctorTestTokenSecretName = "kdoctor-test-token" |
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.
环境变量化
Expect(e).NotTo(HaveOccurred()) | ||
|
||
// test request body | ||
bodyConfigMapName = "kdoctor-test-body-" + tools.RandomName() |
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.
每个用例 beforeeach 最好 建自己 的 namespace 和 测试服务,避免 it 之间 串扰
test/e2e/common/constants.go
Outdated
KdoctroTestToken = "" | ||
APISERVICEADDR = "" | ||
TestNameSpace = "kube-system" | ||
TestImageTag = "v0.1.0" |
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.
跟着 ci 的版本走,不能 hardcode
PROJECT_IMAGE_VERSION
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.
这些是从环境变量中获取的,只是给了一个默认值
edbb553
to
6fd2fca
Compare
Expect(e).NotTo(HaveOccurred(), "wait appHttpHealth task finish") | ||
|
||
// wait report gen | ||
time.Sleep(time.Second * 20) |
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.
? 这是
) | ||
|
||
const ( | ||
PluginReportPath = "/apis/system.kdoctor.io/v1beta1/namespaces/default/kdoctorreports/" |
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.
不可以 import 么 ?
f776a89
to
ca7970d
Compare
Expect(e).NotTo(HaveOccurred(), "wait test daemonSet and service ready") | ||
|
||
// wait pod running | ||
time.Sleep(time.Second * 20) |
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.
这里是在等 ?
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.
framework的waitdaemonset ready 这个函数这是等待 pod的状态,但是并不是 pod真正running ,这里等待一下 pod的业务可以访问
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.
pod有自身的 健康检测,那 应该是用一个 api 等待 pod ready 才是最优雅的做法 ?也不至于 20s 比 用例本身时间 还长
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.
done 已修改
5b0d291
to
43cd4a8
Compare
test/e2e/common/tools.go
Outdated
|
||
func CreateApplicationDaemonSetAndService(f *frame.Framework, key metav1.ObjectMeta, app, insecure bool) error { | ||
ds := new(appsv1.DaemonSet) | ||
svc := new(corev1.Service) |
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.
不用 chart 么
cec1d8e
to
2191cac
Compare
Signed-off-by: ii2day <ji.li@daocloud.io>
No description provided.