package npu_operator
import (
"context"
"time"
. "gitcode.com/openFuyao/e2e-auto-test/e2e/npu-operator/utils"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime/schema"
)
func InstalledPhase() {
var _ = Describe("NPU Operator has been installed", Ordered, Label("npu_operator_installed", "npu"), func() {
var installedByCurrentPhase bool
BeforeAll(func() {
installedByCurrentPhase = EnsureNPUOperatorInstallation(clientset, ctx, nodesNPUSituation)
GinkgoWriter.Println()
})
AfterAll(func() {
GinkgoWriter.Println()
if !installedByCurrentPhase {
GinkgoWriter.Println("NPU Operator reused existing environment in this phase, skip uninstall")
return
}
VerifyNPUOperatorUninstallation(clientset, ctx)
})
Context("查询所有的节点", Label("npu_operator_nodes"), func() {
var nodes *corev1.NodeList
BeforeEach(func() {
var err error
nodes, err = clientset.CoreV1().Nodes().List(ctx, metav1.ListOptions{})
Expect(err).NotTo(HaveOccurred(), "'kubectl get nodes' 执行失败")
Expect(nodes.Items).NotTo(BeEmpty(), "在集群中没有找到任何节点")
GinkgoWriter.Printf("检测到nodes数量:\n%d\n", len(nodes.Items))
})
It("669-检查master和worker节点对应的标签(多节点)", func() {
for _, node := range nodes.Items {
_, controlPlaneExists := node.Labels["node-role.kubernetes.io/control-plane"]
_, masterExists := node.Labels["node-role.kubernetes.io/master"]
masterLabelExists := controlPlaneExists && masterExists
if masterLabelExists {
GinkgoWriter.Printf("%s节点是master节点\n", node.Name)
label := "masterselector"
expectValue := "dls-master-node"
VerifyNodeLabels(node, label, expectValue)
} else {
GinkgoWriter.Printf("%s节点是worker节点\n", node.Name)
_, exists := node.Labels["masterselector"]
Expect(exists).To(BeFalse(), "worker节点不应存在master节点标签")
GinkgoWriter.Printf("%s节点不存在masterselector标签\n", node.Name)
}
}
})
It("670-检查容器运行时标签", func() {
label := "openfuyao.com/container.runtime"
expectValue := "containerd"
for _, node := range nodes.Items {
VerifyNodeLabels(node, label, expectValue)
}
})
It("676-检查新增NFD服务发现标签(310P-D100)", func() {
label := "feature.node.kubernetes.io/pci-1200_19e5_d100.present"
expectValue := "true"
npuType := "d100"
VerifyAllNodesLabels(nodes, nodesNPUSituation, label, expectValue, npuType)
})
It("677-检查新增NFD服务发现标签(310-D500)", func() {
label := "feature.node.kubernetes.io/pci-1200_19e5_d500.present"
expectValue := "true"
npuType := "d500"
VerifyAllNodesLabels(nodes, nodesNPUSituation, label, expectValue, npuType)
})
It("678-检查新增NFD服务发现标签(910-D801)", func() {
label := "feature.node.kubernetes.io/pci-1200_19e5_d801.present"
expectValue := "true"
npuType := "d801"
VerifyAllNodesLabels(nodes, nodesNPUSituation, label, expectValue, npuType)
})
It("679-检查新增NFD服务发现标签(910-D802)", func() {
label := "feature.node.kubernetes.io/pci-1200_19e5_d802.present"
expectValue := "true"
npuType := "d802"
VerifyAllNodesLabels(nodes, nodesNPUSituation, label, expectValue, npuType)
})
It("680-检查节点NPU设备标签", func() {
label := "openfuyao.com/npu.present"
expectValue := ""
for _, node := range nodes.Items {
foundNPU := nodesNPUSituation[node.Name]
if foundNPU == "none" {
GinkgoWriter.Printf("%s节点不存在NPU\n", node.Name)
continue
} else {
GinkgoWriter.Printf("%s 节点未找到NPU设备,跳过验证", node.Name)
}
VerifyNodeLabels(node, label, expectValue)
}
})
It("681-检查管理节点标签(单节点)", func() {
if len(nodes.Items) != 1 {
GinkgoWriter.Printf("当前环境节点数为:%d,不符合单节点环境要求,跳过验证", len(nodes.Items))
} else {
node := nodes.Items[0]
label := "masterselector"
expectValue := "dls-master-node"
VerifyNodeLabels(node, label, expectValue)
}
})
It("410-npu-operator 节点标签验证(Ascend 310P ARM)-worker标签", func() {
var testNpuType = "Ascend310P"
var testSystemType = "arm"
VerifyWorkerLabel(nodes, nodesNPUSituation, testNpuType, testSystemType)
})
It("411-npu-operator 节点标签验证(Ascend 310P X86)-worker标签", func() {
var testNpuType = "Ascend310P"
var testSystemType = "amd"
VerifyWorkerLabel(nodes, nodesNPUSituation, testNpuType, testSystemType)
})
It("412-npu-operator 节点标签验证(Atlas 800T A2-Ascend 910B/Atlas 900 A2 PoD-Ascend 910B ARM)-worker标签", func() {
var testNpuType = "Ascend910B"
var testSystemType = "arm"
VerifyWorkerLabel(nodes, nodesNPUSituation, testNpuType, testSystemType)
})
It("682-检查NPU-operator节点标签(Atalas 800I-Ascend 910B ARM)-worker标签", func() {
var testNpuType = "Ascend910B"
var testSystemType = "arm"
VerifyWorkerLabel(nodes, nodesNPUSituation, testNpuType, testSystemType)
})
})
Context("查询所有的服务", Label("npu_operator_services"), func() {
var services *corev1.ServiceList
BeforeEach(func() {
var err error
services, err = clientset.CoreV1().Services("").List(ctx, metav1.ListOptions{})
Expect(err).NotTo(HaveOccurred(), "'kubectl get svc -A' 应执行成功")
Expect(services.Items).NotTo(BeEmpty(), "集群上应发现服务")
GinkgoWriter.Printf("检测到services数量:\n%d\n", len(services.Items))
})
It("NPU Exporter组件功能验证-实际下发使用NPU的任务", func() {
clusterIP, servicePort, found := FindNPUExporterService(services)
Expect(found).To(BeTrue(), "未找到 npu-exporter/npu-exporter-service 服务")
Expect(clusterIP).NotTo(BeEmpty(), "服务的 ClusterIP 为空")
Expect(clusterIP).NotTo(Equal("None"), "服务是 Headless Service,没有 ClusterIP")
Expect(servicePort).NotTo(BeZero(), "服务没有定义端口")
GinkgoWriter.Printf("找到服务: ClusterIP=%s, Port=%d\n", clusterIP, servicePort)
for nodeName, npuType := range nodesNPUSituation {
if npuType == "none" {
GinkgoWriter.Printf("%s 节点没有npu设备,跳过验证\n", nodeName)
} else {
GinkgoWriter.Printf("%s 节点有npu设备:%s\n", nodeName, npuType)
podName, containerName, err := CreateNPUOperatorTestPod(clientset, ctx, npuType)
Expect(err).NotTo(HaveOccurred(), "应成功创建npu-operator-test-pod")
VerifyPodRunning(clientset, ctx, podName)
GinkgoWriter.Printf("Pod:%s 正在运行!\n", podName)
metricsUrl, err := BuildNPUExporterMetricsURLForPodNode(clientset, ctx, podName)
Expect(err).NotTo(HaveOccurred(), "应成功找到测试 Pod 所在节点上的 npu-exporter")
VerifyMetricsThroughURL(metricsUrl, podName, containerName)
GinkgoWriter.Printf("成功验证 container_name 为 %s, pod_name 为 %s\n", containerName, podName)
err = DeleteNPUOperatorTestPod(clientset, ctx, podName)
Expect(err).NotTo(HaveOccurred(), "'kubectl delete npu-operator pod -n "+podName+"' 应执行成功")
VerifyNPUOperatorTestPodDeleted(clientset, ctx, podName)
GinkgoWriter.Printf("npu-operator-test-pod已删除,原有环境已恢复")
}
}
})
})
Context("查找NPU Operator相关的CR", Ordered, Label("npu_operator_cr"), func() {
var (
NPUOperatorCRD apiextensionsv1.CustomResourceDefinition
NPUOperatorCR unstructured.Unstructured
gvr schema.GroupVersionResource
)
BeforeEach(func() {
crds, err := extensionClient.ApiextensionsV1().CustomResourceDefinitions().List(context.TODO(), metav1.ListOptions{})
Expect(err).NotTo(HaveOccurred(), "应该成功获取CRD列表")
Expect(len(crds.Items)).Should(BeNumerically(">=", 1), "CRD数量应为至少1个")
GinkgoWriter.Printf("找到%d个CRD\n", len(crds.Items))
NPUOperatorCRDs, found := FilterNPUOperatorCRDs(crds)
Expect(found).To(BeTrue(), "应该能够找到NPU Operator CRD")
Expect(len(NPUOperatorCRDs)).Should(BeNumerically("==", 1), "NPU Operator CRD数量应为1个")
GinkgoWriter.Printf("成功找到NPU Operator CRD\n")
NPUOperatorCRD = NPUOperatorCRDs[0]
gvr = schema.GroupVersionResource{
Group: NPUOperatorCRD.Spec.Group,
Version: NPUOperatorCRD.Spec.Versions[0].Name,
Resource: NPUOperatorCRD.Spec.Names.Plural,
}
Eventually(func() bool {
currentNPUOperatorCR, err := GetNPUOperatorCR(dynamicClient, gvr)
Expect(err).NotTo(HaveOccurred(), "应该成功获取最新NPUOperatorCR")
NPUOperatorCR = currentNPUOperatorCR
isReady, err := IsNPUOperatorCRReady(currentNPUOperatorCR)
if err != nil {
return false
}
GinkgoWriter.Printf("当前NPUOperatorCR的状态:%t\n", isReady)
return isReady
}, 60*time.Second, 1*time.Second).Should(BeTrue(), "NPUOperatorCR的状态应为Ready")
GinkgoWriter.Printf("NPUOperatorCR:%s 验证成功,状态为Ready\n", NPUOperatorCR.GetName())
})
It("622-MindIO组件状态验证-prevState.type", func() {
var verifyField = "type"
verifyModificationANDEffectivenessInfo := VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "mindioacp",
ComponentName: "mindioacp",
}
VerifyComponentManagedFalsePrevState(&verifyModificationANDEffectivenessInfo, verifyField)
currentNPUOperatorCR, err := GetNPUOperatorCR(dynamicClient, gvr)
Expect(err).NotTo(HaveOccurred(), "应该成功获取最新NPUOperatorCR")
NPUOperatorCR = currentNPUOperatorCR
verifyModificationANDEffectivenessInfo = VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "mindiotft",
ComponentName: "mindiotft",
}
VerifyComponentManagedFalsePrevState(&verifyModificationANDEffectivenessInfo, verifyField)
})
It("609-MindIO组件状态验证-prevState.reason", func() {
var verifyField = "reason"
verifyModificationANDEffectivenessInfo := VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "mindioacp",
ComponentName: "mindioacp",
}
VerifyComponentManagedFalsePrevState(&verifyModificationANDEffectivenessInfo, verifyField)
currentNPUOperatorCR, err := GetNPUOperatorCR(dynamicClient, gvr)
Expect(err).NotTo(HaveOccurred(), "应该成功获取最新NPUOperatorCR")
NPUOperatorCR = currentNPUOperatorCR
verifyModificationANDEffectivenessInfo = VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "mindiotft",
ComponentName: "mindiotft",
}
VerifyComponentManagedFalsePrevState(&verifyModificationANDEffectivenessInfo, verifyField)
})
It("611-MindIO组件状态验证-State.reason", func() {
var verifyField = "reason"
verifyModificationANDEffectivenessInfo := VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "mindioacp",
ComponentName: "mindioacp",
}
VerifyComponentManagedFalseState(&verifyModificationANDEffectivenessInfo, verifyField)
currentNPUOperatorCR, err := GetNPUOperatorCR(dynamicClient, gvr)
Expect(err).NotTo(HaveOccurred(), "应该成功获取最新NPUOperatorCR")
NPUOperatorCR = currentNPUOperatorCR
verifyModificationANDEffectivenessInfo = VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "mindiotft",
ComponentName: "mindiotft",
}
VerifyComponentManagedFalseState(&verifyModificationANDEffectivenessInfo, verifyField)
})
It("610-MindIO ACP组件managed与镜像异常状态验证", func() {
info := VerifyManagedAndInvalidImageInfo{
Clientset: clientset,
DynamicClient: dynamicClient,
Ctx: ctx,
Gvr: gvr,
ModificationName: "mindioacp",
ComponentName: "mindioacp",
PodPrefix: "mindio-acp",
InvalidRepositorySuffix: "-invalid-610",
}
VerifyComponentManagedAndInvalidImageState(&info)
})
It("612-NPU Exporter组件状态验证-prevState.type", func() {
var verifyField = "type"
verifyModificationANDEffectivenessInfo := VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "exporter",
ComponentName: "npu-exporter",
}
VerifyComponentManagedFalsePrevState(&verifyModificationANDEffectivenessInfo, verifyField)
})
It("613-NPU Exporter组件状态验证-prevState.reason", func() {
var verifyField = "reason"
verifyModificationANDEffectivenessInfo := VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "exporter",
ComponentName: "npu-exporter",
}
VerifyComponentManagedFalsePrevState(&verifyModificationANDEffectivenessInfo, verifyField)
})
It("615-NPU Exporter组件状态验证-State.reason", func() {
var verifyField = "reason"
verifyModificationANDEffectivenessInfo := VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "exporter",
ComponentName: "npu-exporter",
}
VerifyComponentManagedFalseState(&verifyModificationANDEffectivenessInfo, verifyField)
})
It("614-NPU Exporter组件managed与镜像异常状态验证", func() {
info := VerifyManagedAndInvalidImageInfo{
Clientset: clientset,
DynamicClient: dynamicClient,
Ctx: ctx,
Gvr: gvr,
ModificationName: "exporter",
ComponentName: "npu-exporter",
PodPrefix: "npu-exporter",
InvalidRepositorySuffix: "-invalid-614",
}
VerifyComponentManagedAndInvalidImageState(&info)
})
It("616-Volcano Scheduler组件managed与镜像异常状态验证", func() {
info := VerifyManagedAndInvalidImageInfo{
Clientset: clientset,
DynamicClient: dynamicClient,
Ctx: ctx,
Gvr: gvr,
ModificationName: "vcscheduler",
ComponentName: "volcano-scheduler",
PodPrefix: "volcano-scheduler",
InvalidRepositorySuffix: "-invalid-616",
}
VerifyComponentManagedAndInvalidImageState(&info)
})
It("617-Volcano组件状态验证-State.reason", func() {
var verifyField = "reason"
verifyModificationANDEffectivenessInfo := VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "vccontroller",
ComponentName: "volcano-controller",
}
VerifyComponentManagedFalseState(&verifyModificationANDEffectivenessInfo, verifyField)
currentNPUOperatorCR, err := GetNPUOperatorCR(dynamicClient, gvr)
Expect(err).NotTo(HaveOccurred(), "应该成功获取最新NPUOperatorCR")
NPUOperatorCR = currentNPUOperatorCR
verifyModificationANDEffectivenessInfo = VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "vcscheduler",
ComponentName: "volcano-scheduler",
}
VerifyComponentManagedFalseState(&verifyModificationANDEffectivenessInfo, verifyField)
})
It("628-Volcano组件状态验证-prevState.type", func() {
var verifyField = "type"
verifyModificationANDEffectivenessInfo := VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "vccontroller",
ComponentName: "volcano-controller",
}
VerifyComponentManagedFalsePrevState(&verifyModificationANDEffectivenessInfo, verifyField)
currentNPUOperatorCR, err := GetNPUOperatorCR(dynamicClient, gvr)
Expect(err).NotTo(HaveOccurred(), "应该成功获取最新NPUOperatorCR")
NPUOperatorCR = currentNPUOperatorCR
verifyModificationANDEffectivenessInfo = VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "vcscheduler",
ComponentName: "volcano-scheduler",
}
VerifyComponentManagedFalsePrevState(&verifyModificationANDEffectivenessInfo, verifyField)
})
It("629-Volcano组件状态验证-prevState.reason", func() {
var verifyField = "reason"
verifyModificationANDEffectivenessInfo := VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "vccontroller",
ComponentName: "volcano-controller",
}
VerifyComponentManagedFalsePrevState(&verifyModificationANDEffectivenessInfo, verifyField)
currentNPUOperatorCR, err := GetNPUOperatorCR(dynamicClient, gvr)
Expect(err).NotTo(HaveOccurred(), "应该成功获取最新NPUOperatorCR")
NPUOperatorCR = currentNPUOperatorCR
verifyModificationANDEffectivenessInfo = VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "vcscheduler",
ComponentName: "volcano-scheduler",
}
VerifyComponentManagedFalsePrevState(&verifyModificationANDEffectivenessInfo, verifyField)
})
It("618-Resilience组件状态验证-prevState.type", func() {
var verifyField = "type"
verifyModificationANDEffectivenessInfo := VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "rscontroller",
ComponentName: "resilience-controller",
}
VerifyComponentManagedFalsePrevState(&verifyModificationANDEffectivenessInfo, verifyField)
})
It("619-Resilience组件状态验证-prevState.reason", func() {
var verifyField = "reason"
verifyModificationANDEffectivenessInfo := VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "rscontroller",
ComponentName: "resilience-controller",
}
VerifyComponentManagedFalsePrevState(&verifyModificationANDEffectivenessInfo, verifyField)
})
It("621-Resilience组件状态验证-State.reason", func() {
var verifyField = "reason"
verifyModificationANDEffectivenessInfo := VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "rscontroller",
ComponentName: "resilience-controller",
}
VerifyComponentManagedFalseState(&verifyModificationANDEffectivenessInfo, verifyField)
})
It("620-Resilience Controller组件managed与镜像异常状态验证", func() {
info := VerifyManagedAndInvalidImageInfo{
Clientset: clientset,
DynamicClient: dynamicClient,
Ctx: ctx,
Gvr: gvr,
ModificationName: "rscontroller",
ComponentName: "resilience-controller",
PodPrefix: "resilience-controller",
InvalidRepositorySuffix: "-invalid-620",
}
VerifyComponentManagedAndInvalidImageState(&info)
})
It("623-NodeD组件状态验证-State.reason", func() {
var verifyField = "reason"
verifyModificationANDEffectivenessInfo := VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "nodeD",
ComponentName: "noded",
}
VerifyComponentManagedFalseState(&verifyModificationANDEffectivenessInfo, verifyField)
})
It("634-NodeD组件状态验证-prevState.type", func() {
var verifyField = "type"
verifyModificationANDEffectivenessInfo := VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "nodeD",
ComponentName: "noded",
}
VerifyComponentManagedFalsePrevState(&verifyModificationANDEffectivenessInfo, verifyField)
})
It("635-NodeD组件状态验证-prevState.reason", func() {
var verifyField = "reason"
verifyModificationANDEffectivenessInfo := VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "nodeD",
ComponentName: "noded",
}
VerifyComponentManagedFalsePrevState(&verifyModificationANDEffectivenessInfo, verifyField)
})
It("624-ClusterD组件状态验证-prevState.type", func() {
var verifyField = "type"
verifyModificationANDEffectivenessInfo := VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "clusterd",
ComponentName: "clusterd",
}
VerifyComponentManagedFalsePrevState(&verifyModificationANDEffectivenessInfo, verifyField)
})
It("625-ClusterD组件状态验证-prevState.reason", func() {
var verifyField = "reason"
verifyModificationANDEffectivenessInfo := VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "clusterd",
ComponentName: "clusterd",
}
VerifyComponentManagedFalsePrevState(&verifyModificationANDEffectivenessInfo, verifyField)
})
It("627-ClusterD组件状态验证-State.reason", func() {
var verifyField = "reason"
verifyModificationANDEffectivenessInfo := VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "clusterd",
ComponentName: "clusterd",
}
VerifyComponentManagedFalseState(&verifyModificationANDEffectivenessInfo, verifyField)
})
It("630-Ascend Operator组件状态验证-prevState.type", func() {
var verifyField = "type"
verifyModificationANDEffectivenessInfo := VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "trainer",
ComponentName: "trainer",
}
VerifyComponentManagedFalsePrevState(&verifyModificationANDEffectivenessInfo, verifyField)
})
It("631-Ascend Operator组件状态验证-prevState.reason", func() {
var verifyField = "reason"
verifyModificationANDEffectivenessInfo := VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "trainer",
ComponentName: "trainer",
}
VerifyComponentManagedFalsePrevState(&verifyModificationANDEffectivenessInfo, verifyField)
})
It("633-Ascend Operator组件状态验证-State.reason", func() {
var verifyField = "reason"
verifyModificationANDEffectivenessInfo := VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "trainer",
ComponentName: "trainer",
}
VerifyComponentManagedFalseState(&verifyModificationANDEffectivenessInfo, verifyField)
})
It("638-Ascend Docker Runtime组件状态验证-State.reason", func() {
var verifyField = "reason"
verifyModificationANDEffectivenessInfo := VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "ociRuntime",
ComponentName: "oci-runtime",
}
VerifyComponentManagedFalseState(&verifyModificationANDEffectivenessInfo, verifyField)
})
It("648-Ascend Docker Runtime组件状态验证-prevState.type", func() {
var verifyField = "type"
verifyModificationANDEffectivenessInfo := VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "ociRuntime",
ComponentName: "oci-runtime",
}
VerifyComponentManagedFalsePrevState(&verifyModificationANDEffectivenessInfo, verifyField)
})
It("649-Ascend Docker Runtime组件状态验证-prevState.reason", func() {
var verifyField = "reason"
verifyModificationANDEffectivenessInfo := VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "ociRuntime",
ComponentName: "oci-runtime",
}
VerifyComponentManagedFalsePrevState(&verifyModificationANDEffectivenessInfo, verifyField)
})
It("639-Ascend Device Plugin组件状态验证-prevState.type", func() {
var verifyField = "type"
verifyModificationANDEffectivenessInfo := VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "devicePlugin",
ComponentName: "device-plugin",
}
VerifyComponentManagedFalsePrevState(&verifyModificationANDEffectivenessInfo, verifyField)
})
It("640-Ascend Device Plugin组件状态验证-prevState.reason", func() {
var verifyField = "reason"
verifyModificationANDEffectivenessInfo := VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "devicePlugin",
ComponentName: "device-plugin",
}
VerifyComponentManagedFalsePrevState(&verifyModificationANDEffectivenessInfo, verifyField)
})
It("642-Ascend Device Plugin组件状态验证-State.reason", func() {
var verifyField = "reason"
verifyModificationANDEffectivenessInfo := VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "devicePlugin",
ComponentName: "device-plugin",
}
VerifyComponentManagedFalseState(&verifyModificationANDEffectivenessInfo, verifyField)
})
It("644-Ascend Driver & Firmware组件状态验证-prevState.type", func() {
var verifyField = "type"
verifyModificationANDEffectivenessInfo := VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "driver",
ComponentName: "driver",
}
VerifyComponentManagedFalsePrevState(&verifyModificationANDEffectivenessInfo, verifyField)
})
It("645-Ascend Driver & Firmware组件状态验证-prevState.reason", func() {
var verifyField = "reason"
verifyModificationANDEffectivenessInfo := VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "driver",
ComponentName: "driver",
}
VerifyComponentManagedFalsePrevState(&verifyModificationANDEffectivenessInfo, verifyField)
})
It("647-Ascend Driver & Firmware组件状态验证-State.reason", func() {
var verifyField = "reason"
verifyModificationANDEffectivenessInfo := VerifyModificationANDEffectivenessInfo{
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationName: "driver",
ComponentName: "driver",
}
VerifyComponentManagedFalseState(&verifyModificationANDEffectivenessInfo, verifyField)
})
It("655-ClusterD组件验证修改 managed=false 卸载相关Pod", func() {
verifyPodStateInfo := VerifyPodStateInfo{
Clientset: clientset,
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationNames: []string{"clusterd"},
PodNames: []string{"clusterd"},
}
VerifyComponentManagedFalsePodState(&verifyPodStateInfo)
GinkgoWriter.Println("ClusterD组件修改 managed=false 卸载相关Pod验证成功")
})
It("656-ClusterD组件验证修改 managed=true 安装相关Pod", func() {
verifyPodStateInfo := VerifyPodStateInfo{
Clientset: clientset,
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationNames: []string{"clusterd"},
PodNames: []string{"clusterd"},
}
VerifyComponentManagedTruePodState(&verifyPodStateInfo)
GinkgoWriter.Println("ClusterD组件修改 managed=true 安装相关Pod验证成功")
})
It("657-Resilience组件验证修改 managed=false 卸载相关Pod", func() {
verifyPodStateInfo := VerifyPodStateInfo{
Clientset: clientset,
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationNames: []string{"rscontroller"},
PodNames: []string{"resilience-controller"},
}
VerifyComponentManagedFalsePodState(&verifyPodStateInfo)
GinkgoWriter.Println("Resilience组件修改 managed=false 卸载相关Pod验证成功")
})
It("658-Resilience组件验证修改 managed=true 安装相关Pod", func() {
verifyPodStateInfo := VerifyPodStateInfo{
Clientset: clientset,
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationNames: []string{"rscontroller"},
PodNames: []string{"resilience-controller"},
}
VerifyComponentManagedTruePodState(&verifyPodStateInfo)
GinkgoWriter.Println("Resilience组件修改 managed=true 安装相关Pod验证成功")
})
It("659-MingIO组件验证修改 managed=false 卸载相关Pod", func() {
verifyPodStateInfo := VerifyPodStateInfo{
Clientset: clientset,
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationNames: []string{"mindioacp", "mindiotft"},
PodNames: []string{"mindio-acp", "mindio-tft"},
}
VerifyComponentManagedFalsePodState(&verifyPodStateInfo)
GinkgoWriter.Println("MingIO组件修改 managed=false 卸载相关Pod验证成功")
})
It("660-MingIO组件验证修改 managed=true 安装相关Pod", func() {
verifyPodStateInfo := VerifyPodStateInfo{
Clientset: clientset,
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationNames: []string{"mindioacp", "mindiotft"},
PodNames: []string{"mindio-acp", "mindio-tft"},
}
VerifyComponentManagedTruePodState(&verifyPodStateInfo)
GinkgoWriter.Println("MingIO组件修改 managed=true 安装相关Pod验证成功")
})
It("661-NPU Exporter组件验证修改 managed=false 卸载相关Pod", func() {
verifyPodStateInfo := VerifyPodStateInfo{
Clientset: clientset,
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationNames: []string{"exporter"},
PodNames: []string{"npu-exporter"},
}
VerifyComponentManagedFalsePodState(&verifyPodStateInfo)
GinkgoWriter.Println("NPU Exporter组件修改 managed=false 卸载相关Pod验证成功")
})
It("650-NPU Exporter组件验证修改 managed=true 安装相关Pod", func() {
verifyPodStateInfo := VerifyPodStateInfo{
Clientset: clientset,
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationNames: []string{"exporter"},
PodNames: []string{"npu-exporter"},
}
VerifyComponentManagedTruePodState(&verifyPodStateInfo)
GinkgoWriter.Println("NPU Exporter组件修改 managed=true 安装相关Pod验证成功")
})
It("675-Ascend Docker Runtime组件验证修改 managed=false 卸载相关Pod", func() {
verifyPodStateInfo := VerifyPodStateInfo{
Clientset: clientset,
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationNames: []string{"ociRuntime"},
PodNames: []string{"ascend-runtime-containerd"},
}
VerifyComponentManagedFalsePodState(&verifyPodStateInfo)
GinkgoWriter.Println("Ascend Docker Runtime组件修改 managed=false 卸载相关Pod验证成功")
})
It("662-Ascend Docker Runtime组件验证修改 managed=true 安装相关Pod", func() {
verifyPodStateInfo := VerifyPodStateInfo{
Clientset: clientset,
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationNames: []string{"ociRuntime"},
PodNames: []string{"ascend-runtime-containerd"},
}
VerifyComponentManagedTruePodState(&verifyPodStateInfo)
VerifyAscendDockerRuntimeOnNode(nodesNPUSituation)
GinkgoWriter.Println("Ascend Docker Runtime组件修改 managed=true 安装相关Pod验证成功")
})
It("663-Ascend Device Plugin组件验证修改 managed=false 卸载相关Pod", func() {
verifyPodStateInfo := VerifyPodStateInfo{
Clientset: clientset,
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationNames: []string{"devicePlugin"},
PodNames: []string{"ascend-device-plugin"},
}
VerifyComponentManagedFalsePodState(&verifyPodStateInfo)
GinkgoWriter.Println("Ascend Device Plugin组件修改 managed=false 卸载相关Pod验证成功")
})
It("664-Ascend Device Plugin组件验证修改 managed=true 安装相关Pod", func() {
verifyPodStateInfo := VerifyPodStateInfo{
Clientset: clientset,
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationNames: []string{"devicePlugin"},
PodNames: []string{"ascend-device-plugin"},
}
VerifyComponentManagedTruePodState(&verifyPodStateInfo)
VerifyAscendDevicePlugin(clientset, ctx, nodesNPUSituation)
GinkgoWriter.Println("Ascend Device Plugin组件修改 managed=true 安装相关Pod验证成功")
})
It("665-Ascend Operator组件验证修改 managed=false 卸载相关Pod", func() {
verifyPodStateInfo := VerifyPodStateInfo{
Clientset: clientset,
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationNames: []string{"trainer"},
PodNames: []string{"ascend-operator-manager"},
}
VerifyComponentManagedFalsePodState(&verifyPodStateInfo)
GinkgoWriter.Println("Ascend Operator组件修改 managed=false 卸载相关Pod验证成功")
})
It("666-Ascend Operator组件验证修改 managed=true 安装相关Pod", func() {
verifyPodStateInfo := VerifyPodStateInfo{
Clientset: clientset,
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationNames: []string{"trainer"},
PodNames: []string{"ascend-operator-manager"},
}
VerifyComponentManagedTruePodState(&verifyPodStateInfo)
GinkgoWriter.Println("Ascend Operator组件修改 managed=true 安装相关Pod验证成功")
})
It("667-NodeD组件验证修改 managed=false 卸载相关Pod", func() {
verifyPodStateInfo := VerifyPodStateInfo{
Clientset: clientset,
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationNames: []string{"nodeD"},
PodNames: []string{"noded"},
}
VerifyComponentManagedFalsePodState(&verifyPodStateInfo)
GinkgoWriter.Println("NodeD组件修改 managed=false 卸载相关Pod验证成功")
})
It("668-NodeD组件验证修改 managed=true 安装相关Pod", func() {
verifyPodStateInfo := VerifyPodStateInfo{
Clientset: clientset,
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationNames: []string{"nodeD"},
PodNames: []string{"noded"},
}
VerifyComponentManagedTruePodState(&verifyPodStateInfo)
GinkgoWriter.Println("NodeD组件修改 managed=true 安装相关Pod验证成功")
})
It("673-Ascend Driver & Firmware组件验证修改 managed=false 卸载相关Pod", func() {
verifyPodStateInfo := VerifyPodStateInfo{
Clientset: clientset,
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationNames: []string{"driver"},
PodNames: []string{"npu-driver"},
}
VerifyComponentManagedFalsePodState(&verifyPodStateInfo)
GinkgoWriter.Println("Ascend Driver & Firmware组件修改 managed=false 卸载相关Pod验证成功")
})
It("674-Ascend Driver & Firmware组件验证修改 managed=true 安装相关Pod", func() {
verifyPodStateInfo := VerifyPodStateInfo{
Clientset: clientset,
DynamicClient: dynamicClient,
Ctx: ctx,
NPUOperatorCR: NPUOperatorCR,
Gvr: gvr,
ModificationNames: []string{"driver"},
PodNames: []string{"npu-driver"},
}
VerifyComponentManagedTruePodState(&verifyPodStateInfo)
GinkgoWriter.Println("Ascend Driver & Firmware组件修改 managed=true 安装相关Pod验证成功")
})
})
})
}