mirror of
https://github.com/kubevela/kubevela.git
synced 2026-08-23 22:46:53 +00:00
Fix: remove the old test case.
Signed-off-by: barnettZQG <barnett.zqg@gmail.com>
This commit is contained in:
@@ -384,80 +384,6 @@ var _ = Describe("Test Query Provider", func() {
|
||||
})
|
||||
})
|
||||
|
||||
Context("Test CollectPods", func() {
|
||||
It("Test collect pod from workload deployment", func() {
|
||||
// deploy := baseDeploy.DeepCopy()
|
||||
// deploy.SetName("test-collect-pod")
|
||||
// deploy.Spec.Selector = &metav1.LabelSelector{
|
||||
// MatchLabels: map[string]string{
|
||||
// oam.LabelAppComponent: "test",
|
||||
// },
|
||||
// }
|
||||
// deploy.Spec.Template.ObjectMeta.SetLabels(map[string]string{
|
||||
// oam.LabelAppComponent: "test",
|
||||
// })
|
||||
// Expect(k8sClient.Create(ctx, deploy)).Should(BeNil())
|
||||
// for i := 1; i <= 5; i++ {
|
||||
// pod := basePod.DeepCopy()
|
||||
// pod.SetName(fmt.Sprintf("test-collect-pod-%d", i))
|
||||
// pod.SetLabels(map[string]string{
|
||||
// oam.LabelAppComponent: "test",
|
||||
// })
|
||||
// Expect(k8sClient.Create(ctx, pod)).Should(BeNil())
|
||||
// }
|
||||
|
||||
// prd := provider{cli: k8sClient}
|
||||
// unstructuredDeploy, err := util.Object2Unstructured(deploy)
|
||||
// Expect(err).Should(BeNil())
|
||||
// unstructuredDeploy.SetGroupVersionKind((&corev1.ObjectReference{
|
||||
// APIVersion: "apps/v1",
|
||||
// Kind: "Deployment",
|
||||
// }).GroupVersionKind())
|
||||
|
||||
// deployJson, err := json.Marshal(unstructuredDeploy)
|
||||
// Expect(err).Should(BeNil())
|
||||
// opt := fmt.Sprintf(`value: %s
|
||||
// cluster: ""`, deployJson)
|
||||
// v, err := value.NewValue(opt, nil, "")
|
||||
// Expect(err).Should(BeNil())
|
||||
// Expect(prd.CollectPods(nil, v, nil)).Should(BeNil())
|
||||
|
||||
// podList := new(PodList)
|
||||
// Expect(v.UnmarshalTo(podList)).Should(BeNil())
|
||||
// Expect(len(podList.List)).Should(Equal(5))
|
||||
// for _, pod := range podList.List {
|
||||
// Expect(pod.GroupVersionKind()).Should(Equal((&corev1.ObjectReference{
|
||||
// APIVersion: "v1",
|
||||
// Kind: "Pod",
|
||||
// }).GroupVersionKind()))
|
||||
// }
|
||||
})
|
||||
|
||||
It("Test collect pod with incomplete parameter", func() {
|
||||
// emptyOpt := ""
|
||||
// prd := provider{cli: k8sClient}
|
||||
// v, err := value.NewValue(emptyOpt, nil, "")
|
||||
// Expect(err).Should(BeNil())
|
||||
// err = prd.CollectPods(nil, v, nil)
|
||||
// Expect(err).ShouldNot(BeNil())
|
||||
// Expect(err.Error()).Should(Equal("var(path=value) not exist"))
|
||||
|
||||
// optWithoutCluster := `value: {}`
|
||||
// v, err = value.NewValue(optWithoutCluster, nil, "")
|
||||
// Expect(err).Should(BeNil())
|
||||
// err = prd.CollectPods(nil, v, nil)
|
||||
// Expect(err).ShouldNot(BeNil())
|
||||
// Expect(err.Error()).Should(Equal("var(path=cluster) not exist"))
|
||||
|
||||
// optWithWrongValue := `value: {test: 1}
|
||||
// cluster: "test"`
|
||||
// v, err = value.NewValue(optWithWrongValue, nil, "")
|
||||
// Expect(err).Should(BeNil())
|
||||
// err = prd.CollectPods(nil, v, nil)
|
||||
// Expect(err).ShouldNot(BeNil())
|
||||
})
|
||||
})
|
||||
|
||||
Context("Test search event from k8s object", func() {
|
||||
It("Test search event with incomplete parameter", func() {
|
||||
emptyOpt := ""
|
||||
@@ -554,9 +480,12 @@ options: {
|
||||
h, ok := p.GetHandler("query", "listResourcesInApp")
|
||||
Expect(h).ShouldNot(BeNil())
|
||||
Expect(ok).Should(Equal(true))
|
||||
h, ok = p.GetHandler("query", "collectPods")
|
||||
h, ok = p.GetHandler("query", "collectResources")
|
||||
Expect(h).ShouldNot(BeNil())
|
||||
Expect(ok).Should(Equal(true))
|
||||
l, ok := p.GetHandler("query", "listAppliedResources")
|
||||
Expect(l).ShouldNot(BeNil())
|
||||
Expect(ok).Should(Equal(true))
|
||||
h, ok = p.GetHandler("query", "searchEvents")
|
||||
Expect(ok).Should(Equal(true))
|
||||
Expect(h).ShouldNot(BeNil())
|
||||
|
||||
Reference in New Issue
Block a user