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

add e2e for http #31

Merged
merged 1 commit into from
Jul 17, 2023
Merged

add e2e for http #31

merged 1 commit into from
Jul 17, 2023

Conversation

ii2day
Copy link
Collaborator

@ii2day ii2day commented Jun 25, 2023

No description provided.

@ii2day ii2day added the pr/not-ready not ready for merging label Jun 25, 2023
@ii2day ii2day requested a review from weizhoublue as a code owner June 25, 2023 09:45
@codecov
Copy link

codecov bot commented Jun 25, 2023

Codecov Report

Merging #31 (4ec3134) into main (4e4d0f3) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main      #31   +/-   ##
=======================================
  Coverage   40.28%   40.28%           
=======================================
  Files           8        8           
  Lines         494      494           
=======================================
  Hits          199      199           
  Misses        291      291           
  Partials        4        4           
Flag Coverage Δ
unittests 40.28% <ø> (ø)

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

@ii2day ii2day force-pushed the e2e branch 6 times, most recently from 11daec2 to 569389f Compare June 26, 2023 09:06
MultusNamespace = "kube-system"
MultusCRName = "ptp"

KDoctorAgentNS = "kube-system"
Copy link
Collaborator

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)
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个服务是在哪行代码启动的

apiVersion: v1
kind: Secret
metadata:
name: kdoctor-test-token
Copy link
Collaborator

Choose a reason for hiding this comment

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

apiserver-token


const (
ImageRegistry = "ghcr.io/kdoctor-io/kdoctor-agent"
PluginReportPath = "/apis/system.kdoctor.io/v1beta1/namespaces/default/pluginreports/"
Copy link
Collaborator

Choose a reason for hiding this comment

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

避免 hardcode, 没有 import 来引用么

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

没有

import "os"

const (
ImageRegistry = "ghcr.io/kdoctor-io/kdoctor-agent"
Copy link
Collaborator

@weizhoublue weizhoublue Jun 28, 2023

Choose a reason for hiding this comment

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

不能 hardcode,要工程化,否则不能本地跑
应该 外部 通过 helm 绚烂 获取出 agent 的 image

PluginReportPath = "/apis/system.kdoctor.io/v1beta1/namespaces/default/pluginreports/"

KDoctorAgentDSName = "kdoctor-agent"
KdoctorTestTokenSecretName = "kdoctor-test-token"
Copy link
Collaborator

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()
Copy link
Collaborator

@weizhoublue weizhoublue Jun 28, 2023

Choose a reason for hiding this comment

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

每个用例 beforeeach 最好 建自己 的 namespace 和 测试服务,避免 it 之间 串扰

KdoctroTestToken = ""
APISERVICEADDR = ""
TestNameSpace = "kube-system"
TestImageTag = "v0.1.0"
Copy link
Collaborator

@weizhoublue weizhoublue Jun 28, 2023

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

这些是从环境变量中获取的,只是给了一个默认值

@ii2day ii2day force-pushed the e2e branch 10 times, most recently from edbb553 to 6fd2fca Compare July 12, 2023 08:06
Expect(e).NotTo(HaveOccurred(), "wait appHttpHealth task finish")

// wait report gen
time.Sleep(time.Second * 20)
Copy link
Collaborator

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/"
Copy link
Collaborator

Choose a reason for hiding this comment

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

不可以 import 么 ?

@ii2day ii2day force-pushed the e2e branch 2 times, most recently from f776a89 to ca7970d Compare July 12, 2023 10:58
Expect(e).NotTo(HaveOccurred(), "wait test daemonSet and service ready")

// wait pod running
time.Sleep(time.Second * 20)
Copy link
Collaborator

@weizhoublue weizhoublue Jul 12, 2023

Choose a reason for hiding this comment

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

这里是在等 ?

Copy link
Collaborator Author

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的业务可以访问

Copy link
Collaborator

@weizhoublue weizhoublue Jul 13, 2023

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 比 用例本身时间 还长

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done 已修改

@ii2day ii2day force-pushed the e2e branch 4 times, most recently from 5b0d291 to 43cd4a8 Compare July 13, 2023 07:45

func CreateApplicationDaemonSetAndService(f *frame.Framework, key metav1.ObjectMeta, app, insecure bool) error {
ds := new(appsv1.DaemonSet)
svc := new(corev1.Service)
Copy link
Collaborator

Choose a reason for hiding this comment

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

不用 chart 么

@ii2day ii2day force-pushed the e2e branch 5 times, most recently from cec1d8e to 2191cac Compare July 17, 2023 09:14
Signed-off-by: ii2day <ji.li@daocloud.io>
@weizhoublue weizhoublue merged commit 63d29a0 into main Jul 17, 2023
24 checks passed
@ii2day ii2day mentioned this pull request Jul 18, 2023
@ii2day ii2day deleted the e2e branch September 4, 2023 03:29
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.

2 participants