diff --git a/pkg/k8s/apis/kdoctor.io/v1beta1/netreach_types.go b/pkg/k8s/apis/kdoctor.io/v1beta1/netreach_types.go index 305b6d6e..0601e73a 100644 --- a/pkg/k8s/apis/kdoctor.io/v1beta1/netreach_types.go +++ b/pkg/k8s/apis/kdoctor.io/v1beta1/netreach_types.go @@ -37,22 +37,22 @@ type NetReachTarget struct { IPv6 *bool `json:"ipv6,omitempty"` // +kubebuilder:default=true - Endpoint bool `json:"endpoint,omitempty"` + Endpoint *bool `json:"endpoint,omitempty"` // +kubebuilder:default=false - MultusInterface bool `json:"multusInterface,omitempty"` + MultusInterface *bool `json:"multusInterface,omitempty"` // +kubebuilder:default=true - ClusterIP bool `json:"clusterIP,omitempty"` + ClusterIP *bool `json:"clusterIP,omitempty"` // +kubebuilder:default=true - NodePort bool `json:"nodePort,omitempty"` + NodePort *bool `json:"nodePort,omitempty"` // +kubebuilder:default=false - LoadBalancer bool `json:"loadBalancer,omitempty"` + LoadBalancer *bool `json:"loadBalancer,omitempty"` // +kubebuilder:default=false - Ingress bool `json:"ingress,omitempty"` + Ingress *bool `json:"ingress,omitempty"` // +kubebuilder:default=false // +kubebuilder:validation:Optional diff --git a/pkg/k8s/apis/kdoctor.io/v1beta1/zz_generated.deepcopy.go b/pkg/k8s/apis/kdoctor.io/v1beta1/zz_generated.deepcopy.go index a68f4e73..39dcd001 100644 --- a/pkg/k8s/apis/kdoctor.io/v1beta1/zz_generated.deepcopy.go +++ b/pkg/k8s/apis/kdoctor.io/v1beta1/zz_generated.deepcopy.go @@ -403,6 +403,36 @@ func (in *NetReachTarget) DeepCopyInto(out *NetReachTarget) { *out = new(bool) **out = **in } + if in.Endpoint != nil { + in, out := &in.Endpoint, &out.Endpoint + *out = new(bool) + **out = **in + } + if in.MultusInterface != nil { + in, out := &in.MultusInterface, &out.MultusInterface + *out = new(bool) + **out = **in + } + if in.ClusterIP != nil { + in, out := &in.ClusterIP, &out.ClusterIP + *out = new(bool) + **out = **in + } + if in.NodePort != nil { + in, out := &in.NodePort, &out.NodePort + *out = new(bool) + **out = **in + } + if in.LoadBalancer != nil { + in, out := &in.LoadBalancer, &out.LoadBalancer + *out = new(bool) + **out = **in + } + if in.Ingress != nil { + in, out := &in.Ingress, &out.Ingress + *out = new(bool) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetReachTarget. diff --git a/pkg/loadRequest/loadHttp/http_requester.go b/pkg/loadRequest/loadHttp/http_requester.go index 11c14bf5..ac24c5a7 100644 --- a/pkg/loadRequest/loadHttp/http_requester.go +++ b/pkg/loadRequest/loadHttp/http_requester.go @@ -120,7 +120,7 @@ type Work struct { // DisableCompression is an option to disable compression in response DisableCompression bool - // DisableKeepAlives is an option to prevents re-use of TCP connections between different HTTP requests + // DisableKeepAlives is an option to prevents reuse of TCP connections between different HTTP requests DisableKeepAlives bool // DisableRedirects is an option to prevent the following of HTTP redirects diff --git a/pkg/pluginManager/controllerReconciler.go b/pkg/pluginManager/controllerReconciler.go index 3a38aa30..686d4bbe 100644 --- a/pkg/pluginManager/controllerReconciler.go +++ b/pkg/pluginManager/controllerReconciler.go @@ -34,8 +34,8 @@ type pluginControllerReconciler struct { tracker *scheduler.Tracker } -// contorller reconcile -// (1) chedule all task time +// controller reconcile +// (1) schedule all task time // (2) update stauts result // (3) collect report from agent func (s *pluginControllerReconciler) Reconcile(ctx context.Context, req reconcile.Request) (reconcile.Result, error) { diff --git a/pkg/pluginManager/netreach/agentExecuteTask.go b/pkg/pluginManager/netreach/agentExecuteTask.go index 97fc4b11..014bcac3 100644 --- a/pkg/pluginManager/netreach/agentExecuteTask.go +++ b/pkg/pluginManager/netreach/agentExecuteTask.go @@ -101,8 +101,8 @@ func (s *PluginNetReach) AgentExecuteTask(logger *zap.Logger, ctx context.Contex logger.Sugar().Infof("load test kdoctor Agent pod: qps=%v, PerRequestTimeout=%vs, Duration=%vs", request.QPS, request.PerRequestTimeoutInMS, request.DurationInSecond) finalfailureReason = "" - if target.Endpoint { - podIPs, e := getTargetPodIP(ctx, runtimeResource.RuntimeName, runtimeResource.RuntimeType, target.MultusInterface) + if *target.Endpoint { + podIPs, e := getTargetPodIP(ctx, runtimeResource.RuntimeName, runtimeResource.RuntimeType, *target.MultusInterface) if e != nil { logger.Sugar().Debugf("test agent pod ip: %v", podIPs) if e != nil { @@ -146,7 +146,7 @@ func (s *PluginNetReach) AgentExecuteTask(logger *zap.Logger, ctx context.Contex logger.Sugar().Errorf("failed to get agent ipv6 service url , error=%v", e) } } - if target.ClusterIP { + if *target.ClusterIP { // ----------------------- test clusterIP ipv4 if target.IPv4 != nil && *(target.IPv4) { if agentV4Url != nil && len(agentV4Url.ClusterIPUrl) > 0 { @@ -163,7 +163,7 @@ func (s *PluginNetReach) AgentExecuteTask(logger *zap.Logger, ctx context.Contex } // ----------------------- test clusterIP ipv6 - if target.ClusterIP && target.IPv6 != nil && *(target.IPv6) { + if *target.ClusterIP && target.IPv6 != nil && *(target.IPv6) { if agentV6Url != nil && len(agentV6Url.ClusterIPUrl) > 0 { testTargetList = append(testTargetList, &TestTarget{ Name: "AgentClusterV6IP_" + agentV6Url.ClusterIPUrl[0], @@ -178,7 +178,7 @@ func (s *PluginNetReach) AgentExecuteTask(logger *zap.Logger, ctx context.Contex } } - if target.NodePort { + if *target.NodePort { // get node ip localNodeIpv4, localNodeIpv6, e := k8sObjManager.GetK8sObjManager().GetNodeIP(ctx, config.AgentConfig.LocalNodeName) if e != nil { @@ -217,7 +217,7 @@ func (s *PluginNetReach) AgentExecuteTask(logger *zap.Logger, ctx context.Contex } } - if target.LoadBalancer { + if *target.LoadBalancer { if target.IPv4 != nil && *(target.IPv4) { if agentV4Url != nil && len(agentV4Url.LoadBalancerUrl) > 0 { testTargetList = append(testTargetList, &TestTarget{ @@ -247,7 +247,7 @@ func (s *PluginNetReach) AgentExecuteTask(logger *zap.Logger, ctx context.Contex } } - if target.Ingress { + if *target.Ingress { if runtimeResource.ServiceNameV4 != nil { agentIngress, e := k8sObjManager.GetK8sObjManager().GetIngress(ctx, *runtimeResource.ServiceNameV4, config.AgentConfig.PodNamespace) if e != nil { diff --git a/pkg/pluginManager/netreach/webhook.go b/pkg/pluginManager/netreach/webhook.go index 1ba9df1a..071d2193 100644 --- a/pkg/pluginManager/netreach/webhook.go +++ b/pkg/pluginManager/netreach/webhook.go @@ -71,13 +71,15 @@ func (s *PluginNetReach) WebhookMutating(logger *zap.Logger, ctx context.Context enableIpv4 := types.ControllerConfig.Configmap.EnableIPv4 enableIpv6 := types.ControllerConfig.Configmap.EnableIPv6 + enable := true + disable := false m := &crd.NetReachTarget{ - Endpoint: true, - MultusInterface: false, - ClusterIP: true, - NodePort: true, - LoadBalancer: testLoadBalancer, - Ingress: testIngress, + Endpoint: &enable, + MultusInterface: &disable, + ClusterIP: &enable, + NodePort: &enable, + LoadBalancer: &testLoadBalancer, + Ingress: &testIngress, IPv6: &enableIpv6, IPv4: &enableIpv4, } diff --git a/pkg/scheduler/schedule.go b/pkg/scheduler/schedule.go index 935e1eb3..54adaa37 100644 --- a/pkg/scheduler/schedule.go +++ b/pkg/scheduler/schedule.go @@ -134,7 +134,7 @@ func (s *Scheduler) CreateTaskRuntimeIfNotExist(ctx context.Context, ownerTask m if s.taskKind == types.KindNameNetReach { nr := ownerTask.(*v1beta1.NetReach) - if nr.Spec.Target.Ingress { + if *nr.Spec.Target.Ingress { err = s.createIngress(ctx, serviceNameV4, runtime) if nil != err { return v1beta1.TaskResource{}, fmt.Errorf("failed to create runtime IPv4 ingress for task '%s/%s', error: %w", s.taskKind, s.taskName, err) diff --git a/test/e2e/apphttphealth/apphttphealth_test.go b/test/e2e/apphttphealth/apphttphealth_test.go index f5b9e2ab..eb2b85b6 100644 --- a/test/e2e/apphttphealth/apphttphealth_test.go +++ b/test/e2e/apphttphealth/apphttphealth_test.go @@ -71,7 +71,7 @@ var _ = Describe("testing appHttpHealth test ", Label("appHttpHealth"), func() { e = common.WaitKdoctorTaskDone(frame, appHttpHealth, pluginManager.KindNameAppHttpHealthy, 120) Expect(e).NotTo(HaveOccurred(), "wait appHttpHealth task finish") - success, e := common.CompareResult(frame, appHttpHealthName, pluginManager.KindNameAppHttpHealthy, testPodIPs, reportNum) + success, e := common.CompareResult(frame, appHttpHealthName, pluginManager.KindNameAppHttpHealthy, testPodIPs, reportNum, appHttpHealth) Expect(e).NotTo(HaveOccurred(), "compare report and task") Expect(success).To(BeTrue(), "compare report and task result") @@ -135,7 +135,7 @@ var _ = Describe("testing appHttpHealth test ", Label("appHttpHealth"), func() { e = common.WaitKdoctorTaskDone(frame, appHttpHealth, pluginManager.KindNameAppHttpHealthy, 120) Expect(e).NotTo(HaveOccurred(), "wait appHttpHealth task finish") - success, e := common.CompareResult(frame, appHttpHealthName, pluginManager.KindNameAppHttpHealthy, testPodIPs, reportNum) + success, e := common.CompareResult(frame, appHttpHealthName, pluginManager.KindNameAppHttpHealthy, testPodIPs, reportNum, appHttpHealth) Expect(e).NotTo(HaveOccurred(), "compare report and task") Expect(success).To(BeFalse(), "compare report and task result") @@ -197,7 +197,7 @@ var _ = Describe("testing appHttpHealth test ", Label("appHttpHealth"), func() { e = common.WaitKdoctorTaskDone(frame, appHttpHealth, pluginManager.KindNameAppHttpHealthy, 120) Expect(e).NotTo(HaveOccurred(), "wait appHttpHealth task finish") - success, e := common.CompareResult(frame, appHttpHealthName, pluginManager.KindNameAppHttpHealthy, testPodIPs, reportNum) + success, e := common.CompareResult(frame, appHttpHealthName, pluginManager.KindNameAppHttpHealthy, testPodIPs, reportNum, appHttpHealth) Expect(e).NotTo(HaveOccurred(), "compare report and task") Expect(success).To(BeFalse(), "compare report and task result") @@ -260,7 +260,7 @@ var _ = Describe("testing appHttpHealth test ", Label("appHttpHealth"), func() { e = common.WaitKdoctorTaskDone(frame, appHttpHealth, pluginManager.KindNameAppHttpHealthy, 120) Expect(e).NotTo(HaveOccurred(), "wait appHttpHealth task finish") - success, e := common.CompareResult(frame, appHttpHealthName, pluginManager.KindNameAppHttpHealthy, testPodIPs, reportNum) + success, e := common.CompareResult(frame, appHttpHealthName, pluginManager.KindNameAppHttpHealthy, testPodIPs, reportNum, appHttpHealth) Expect(e).NotTo(HaveOccurred(), "compare report and task") Expect(success).To(BeTrue(), "compare report and task result") @@ -325,7 +325,7 @@ var _ = Describe("testing appHttpHealth test ", Label("appHttpHealth"), func() { e = common.WaitKdoctorTaskDone(frame, appHttpHealth, pluginManager.KindNameAppHttpHealthy, 120) Expect(e).NotTo(HaveOccurred(), "wait appHttpHealth task finish") - success, e := common.CompareResult(frame, appHttpHealthName, pluginManager.KindNameAppHttpHealthy, []string{}, reportNum) + success, e := common.CompareResult(frame, appHttpHealthName, pluginManager.KindNameAppHttpHealthy, []string{}, reportNum, appHttpHealth) Expect(e).NotTo(HaveOccurred(), "compare report and task") Expect(success).To(BeFalse(), "compare report and task result") @@ -387,7 +387,7 @@ var _ = Describe("testing appHttpHealth test ", Label("appHttpHealth"), func() { e = common.WaitKdoctorTaskDone(frame, appHttpHealth, pluginManager.KindNameAppHttpHealthy, 120) Expect(e).NotTo(HaveOccurred(), "wait appHttpHealth task finish") - success, e := common.CompareResult(frame, appHttpHealthName, pluginManager.KindNameAppHttpHealthy, testPodIPs, reportNum) + success, e := common.CompareResult(frame, appHttpHealthName, pluginManager.KindNameAppHttpHealthy, testPodIPs, reportNum, appHttpHealth) Expect(e).NotTo(HaveOccurred(), "compare report and task") Expect(success).To(BeTrue(), "compare report and task result") @@ -453,7 +453,7 @@ var _ = Describe("testing appHttpHealth test ", Label("appHttpHealth"), func() { e = common.WaitKdoctorTaskDone(frame, appHttpHealth, pluginManager.KindNameAppHttpHealthy, 120) Expect(e).NotTo(HaveOccurred(), "wait appHttpHealth task finish") - success, e := common.CompareResult(frame, appHttpHealthName, pluginManager.KindNameAppHttpHealthy, testPodIPs, reportNum) + success, e := common.CompareResult(frame, appHttpHealthName, pluginManager.KindNameAppHttpHealthy, testPodIPs, reportNum, appHttpHealth) Expect(e).NotTo(HaveOccurred(), "compare report and task") Expect(success).To(BeTrue(), "compare report and task result") @@ -515,7 +515,7 @@ var _ = Describe("testing appHttpHealth test ", Label("appHttpHealth"), func() { e = common.WaitKdoctorTaskDone(frame, appHttpHealth, pluginManager.KindNameAppHttpHealthy, 120) Expect(e).NotTo(HaveOccurred(), "wait appHttpHealth task finish") - success, e := common.CompareResult(frame, appHttpHealthName, pluginManager.KindNameAppHttpHealthy, testPodIPs, reportNum) + success, e := common.CompareResult(frame, appHttpHealthName, pluginManager.KindNameAppHttpHealthy, testPodIPs, reportNum, appHttpHealth) Expect(e).NotTo(HaveOccurred(), "compare report and task") Expect(success).To(BeTrue(), "compare report and task result") @@ -577,7 +577,7 @@ var _ = Describe("testing appHttpHealth test ", Label("appHttpHealth"), func() { e = common.WaitKdoctorTaskDone(frame, appHttpHealth, pluginManager.KindNameAppHttpHealthy, 120) Expect(e).NotTo(HaveOccurred(), "wait appHttpHealth task finish") - success, e := common.CompareResult(frame, appHttpHealthName, pluginManager.KindNameAppHttpHealthy, testPodIPs, reportNum) + success, e := common.CompareResult(frame, appHttpHealthName, pluginManager.KindNameAppHttpHealthy, testPodIPs, reportNum, appHttpHealth) Expect(e).NotTo(HaveOccurred(), "compare report and task") Expect(success).To(BeTrue(), "compare report and task result") @@ -639,7 +639,7 @@ var _ = Describe("testing appHttpHealth test ", Label("appHttpHealth"), func() { e = common.WaitKdoctorTaskDone(frame, appHttpHealth, pluginManager.KindNameAppHttpHealthy, 120) Expect(e).NotTo(HaveOccurred(), "wait appHttpHealth task finish") - success, e := common.CompareResult(frame, appHttpHealthName, pluginManager.KindNameAppHttpHealthy, testPodIPs, reportNum) + success, e := common.CompareResult(frame, appHttpHealthName, pluginManager.KindNameAppHttpHealthy, testPodIPs, reportNum, appHttpHealth) Expect(e).NotTo(HaveOccurred(), "compare report and task") Expect(success).To(BeTrue(), "compare report and task result") @@ -701,7 +701,7 @@ var _ = Describe("testing appHttpHealth test ", Label("appHttpHealth"), func() { e = common.WaitKdoctorTaskDone(frame, appHttpHealth, pluginManager.KindNameAppHttpHealthy, 120) Expect(e).NotTo(HaveOccurred(), "wait appHttpHealth task finish") - success, e := common.CompareResult(frame, appHttpHealthName, pluginManager.KindNameAppHttpHealthy, testPodIPs, reportNum) + success, e := common.CompareResult(frame, appHttpHealthName, pluginManager.KindNameAppHttpHealthy, testPodIPs, reportNum, appHttpHealth) Expect(e).NotTo(HaveOccurred(), "compare report and task") Expect(success).To(BeTrue(), "compare report and task result") @@ -766,7 +766,7 @@ var _ = Describe("testing appHttpHealth test ", Label("appHttpHealth"), func() { e = common.WaitKdoctorTaskDone(frame, appHttpHealth, pluginManager.KindNameAppHttpHealthy, 120) Expect(e).NotTo(HaveOccurred(), "wait appHttpHealth task finish") - success, e := common.CompareResult(frame, appHttpHealthName, pluginManager.KindNameAppHttpHealthy, testPodIPs, reportNum) + success, e := common.CompareResult(frame, appHttpHealthName, pluginManager.KindNameAppHttpHealthy, testPodIPs, reportNum, appHttpHealth) Expect(e).NotTo(HaveOccurred(), "compare report and task") Expect(success).To(BeTrue(), "compare report and task result") @@ -828,7 +828,7 @@ var _ = Describe("testing appHttpHealth test ", Label("appHttpHealth"), func() { e = common.WaitKdoctorTaskDone(frame, appHttpHealth, pluginManager.KindNameAppHttpHealthy, 120) Expect(e).NotTo(HaveOccurred(), "wait appHttpHealth task finish") - success, e := common.CompareResult(frame, appHttpHealthName, pluginManager.KindNameAppHttpHealthy, testPodIPs, reportNum) + success, e := common.CompareResult(frame, appHttpHealthName, pluginManager.KindNameAppHttpHealthy, testPodIPs, reportNum, appHttpHealth) Expect(e).NotTo(HaveOccurred(), "compare report and task") Expect(success).To(BeFalse(), "compare report and task result") diff --git a/test/e2e/common/tools.go b/test/e2e/common/tools.go index 6f663830..6bc6c8ce 100644 --- a/test/e2e/common/tools.go +++ b/test/e2e/common/tools.go @@ -185,7 +185,7 @@ func GetPluginReportResult(f *frame.Framework, name string, n int) (*kdoctor_rep return report, nil } -func CompareResult(f *frame.Framework, name, taskKind string, podIPs []string, n int) (bool, error) { +func CompareResult(f *frame.Framework, name, taskKind string, podIPs []string, n int, object client.Object) (bool, error) { // get Aggregate API report var r *kdoctor_report.KdoctorReport @@ -204,6 +204,7 @@ func CompareResult(f *frame.Framework, name, taskKind string, podIPs []string, n } switch taskKind { case pluginManager.KindNameNetReach: + obj := object.(*v1beta1.NetReach) fake := &v1beta1.NetReach{ ObjectMeta: metav1.ObjectMeta{ Name: name, @@ -215,6 +216,31 @@ func CompareResult(f *frame.Framework, name, taskKind string, podIPs []string, n return GetResultFromReport(r), fmt.Errorf("failed get resource AppHttpHealthy %s", name) } + if *obj.Spec.Target.Ingress != *rs.Spec.Target.Ingress { + return GetResultFromReport(r), fmt.Errorf("spec target ingress not equal input %v,output %v", *obj.Spec.Target.Ingress, *rs.Spec.Target.Ingress) + } + if obj.Spec.Target.EnableLatencyMetric != rs.Spec.Target.EnableLatencyMetric { + return GetResultFromReport(r), fmt.Errorf("spec target EnableLatencyMetric not equal input %v,output %v", obj.Spec.Target.EnableLatencyMetric, rs.Spec.Target.EnableLatencyMetric) + } + if *obj.Spec.Target.Endpoint != *rs.Spec.Target.Endpoint { + return GetResultFromReport(r), fmt.Errorf("spec target Endpoint not equal input %v,output %v", *obj.Spec.Target.Endpoint, *rs.Spec.Target.Endpoint) + } + if *obj.Spec.Target.ClusterIP != *rs.Spec.Target.ClusterIP { + return GetResultFromReport(r), fmt.Errorf("spec target ClusterIP not equal input %v,output %v", *obj.Spec.Target.ClusterIP, *rs.Spec.Target.ClusterIP) + } + if *obj.Spec.Target.LoadBalancer != *rs.Spec.Target.LoadBalancer { + return GetResultFromReport(r), fmt.Errorf("spec target LoadBalancer not equal input %v,output %v", *obj.Spec.Target.LoadBalancer, *rs.Spec.Target.LoadBalancer) + } + if *obj.Spec.Target.MultusInterface != *rs.Spec.Target.MultusInterface { + return GetResultFromReport(r), fmt.Errorf("spec target MultusInterface not equal input %v,output %v", *obj.Spec.Target.MultusInterface, *rs.Spec.Target.MultusInterface) + } + if *obj.Spec.Target.IPv4 != *rs.Spec.Target.IPv4 { + return GetResultFromReport(r), fmt.Errorf("spec target IPv4 not equal input %v,output %v", *obj.Spec.Target.IPv4, *rs.Spec.Target.IPv4) + } + if *obj.Spec.Target.IPv6 != *rs.Spec.Target.IPv6 { + return GetResultFromReport(r), fmt.Errorf("spec target IPv6 not equal input %v,output %v", *obj.Spec.Target.IPv6, *rs.Spec.Target.IPv6) + } + for _, v := range *r.Spec.Report { for _, m := range v.NetReachTask.Detail { // qps @@ -632,7 +658,7 @@ func checkAgentSpec(f *frame.Framework, task client.Object, agentSpec v1beta1.Ag } if taskKind == kdoctor_types.KindNameNetReach { taskNr := task.(*v1beta1.NetReach) - if taskNr.Spec.Target.Ingress { + if *taskNr.Spec.Target.Ingress { ig := &networkingv1.Ingress{} fake := &networkingv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ @@ -678,7 +704,7 @@ func CheckRuntimeDeadLine(f *frame.Framework, taskName, taskKind string, timeout done = true runtimeResource = rs.Status.Resource terminationGracePeriodMinutes = *rs.Spec.AgentSpec.TerminationGracePeriodMinutes - testIngress = rs.Spec.Target.Ingress + testIngress = *rs.Spec.Target.Ingress break } time.Sleep(time.Second * interval) diff --git a/test/e2e/netdns/netdns_test.go b/test/e2e/netdns/netdns_test.go index 974ba00b..d45b7a4b 100644 --- a/test/e2e/netdns/netdns_test.go +++ b/test/e2e/netdns/netdns_test.go @@ -77,7 +77,7 @@ var _ = Describe("testing netDns ", Label("netDns"), func() { e = common.WaitKdoctorTaskDone(frame, netDns, pluginManager.KindNameNetdns, 120) Expect(e).NotTo(HaveOccurred(), "wait netDns task finish") - success, e := common.CompareResult(frame, netDnsName, pluginManager.KindNameNetdns, []string{}, reportNum) + success, e := common.CompareResult(frame, netDnsName, pluginManager.KindNameNetdns, []string{}, reportNum, netDns) Expect(e).NotTo(HaveOccurred(), "compare report and task") Expect(success).NotTo(BeFalse(), "compare report and task result") @@ -145,7 +145,7 @@ var _ = Describe("testing netDns ", Label("netDns"), func() { e = common.WaitKdoctorTaskDone(frame, netDns, pluginManager.KindNameNetdns, 120) Expect(e).NotTo(HaveOccurred(), "wait netDns task finish") - success, e := common.CompareResult(frame, netDnsName, pluginManager.KindNameNetdns, testPodIPs, reportNum) + success, e := common.CompareResult(frame, netDnsName, pluginManager.KindNameNetdns, testPodIPs, reportNum, netDns) Expect(e).NotTo(HaveOccurred(), "compare report and task") Expect(success).To(BeTrue(), "compare report and task result") diff --git a/test/e2e/netreach/netreach_test.go b/test/e2e/netreach/netreach_test.go index 6b061816..e2286157 100644 --- a/test/e2e/netreach/netreach_test.go +++ b/test/e2e/netreach/netreach_test.go @@ -34,19 +34,20 @@ var _ = Describe("testing netReach ", Label("netReach"), func() { successCondition.SuccessRate = &successRate successCondition.MeanAccessDelayInMs = &successMean netReach.Spec.SuccessCondition = successCondition - + enable := true + disable := false // target target := new(v1beta1.NetReachTarget) if !common.TestIPv4 && common.TestIPv6 { - target.Ingress = false + target.Ingress = &disable } else { - target.Ingress = true + target.Ingress = &enable } - target.LoadBalancer = true - target.ClusterIP = true - target.Endpoint = true - target.NodePort = true - target.MultusInterface = false + target.LoadBalancer = &enable + target.ClusterIP = &enable + target.Endpoint = &enable + target.NodePort = &enable + target.MultusInterface = &disable target.IPv4 = &common.TestIPv4 target.IPv6 = &common.TestIPv6 netReach.Spec.Target = target @@ -74,7 +75,7 @@ var _ = Describe("testing netReach ", Label("netReach"), func() { e = common.WaitKdoctorTaskDone(frame, netReach, pluginManager.KindNameNetReach, 120) Expect(e).NotTo(HaveOccurred(), "wait netReach task finish") - success, e := common.CompareResult(frame, netReachName, pluginManager.KindNameNetReach, []string{}, reportNum) + success, e := common.CompareResult(frame, netReachName, pluginManager.KindNameNetReach, []string{}, reportNum, netReach) Expect(e).NotTo(HaveOccurred(), "compare report and task") Expect(success).To(BeTrue(), "compare report and task result") diff --git a/test/e2e/runtime/runtime_test.go b/test/e2e/runtime/runtime_test.go index cc3d054b..46a59d68 100644 --- a/test/e2e/runtime/runtime_test.go +++ b/test/e2e/runtime/runtime_test.go @@ -42,16 +42,18 @@ var _ = Describe("testing runtime ", Label("runtime"), func() { // target target := new(v1beta1.NetReachTarget) + enable := true + disable := false if !common.TestIPv4 && common.TestIPv6 { - target.Ingress = false + target.Ingress = &disable } else { - target.Ingress = true + target.Ingress = &enable } - target.LoadBalancer = true - target.ClusterIP = true - target.Endpoint = true - target.NodePort = true - target.MultusInterface = false + target.LoadBalancer = &enable + target.ClusterIP = &enable + target.Endpoint = &enable + target.NodePort = &enable + target.MultusInterface = &disable target.IPv4 = &common.TestIPv4 target.IPv6 = &common.TestIPv6 netReach.Spec.Target = target @@ -260,18 +262,20 @@ var _ = Describe("testing runtime ", Label("runtime"), func() { successCondition.MeanAccessDelayInMs = &successMean netReach.Spec.SuccessCondition = successCondition + enable := true + disable := false // target target := new(v1beta1.NetReachTarget) if !common.TestIPv4 && common.TestIPv6 { - target.Ingress = false + target.Ingress = &disable } else { - target.Ingress = true + target.Ingress = &enable } - target.LoadBalancer = true - target.ClusterIP = true - target.Endpoint = true - target.NodePort = true - target.MultusInterface = false + target.LoadBalancer = &enable + target.ClusterIP = &enable + target.Endpoint = &enable + target.NodePort = &enable + target.MultusInterface = &disable target.IPv4 = &common.TestIPv4 target.IPv6 = &common.TestIPv6 netReach.Spec.Target = target