add e2e coverage analysis

Signed-off-by: Vacant2333 <vacant2333@gmail.com>
This commit is contained in:
Vacant2333 2023-11-26 01:33:00 +08:00
parent bf1098ba1c
commit d3a87c3c9c
13 changed files with 122 additions and 23 deletions

View File

@ -19,7 +19,7 @@ import (
testhelper "github.com/karmada-io/karmada/test/helper"
)
var _ = ginkgo.Describe("[BasicClusterOverridePolicy] basic cluster override policy testing", func() {
var _ = ginkgo.Describe("The basic ClusterOverridePolicy testing", func() {
ginkgo.Context("Namespace propagation testing", func() {
var (
randNamespace string
@ -70,7 +70,7 @@ var _ = ginkgo.Describe("[BasicClusterOverridePolicy] basic cluster override pol
})
})
ginkgo.It("Namespace testing", func() {
ginkgo.It("Namespace labelOverride testing", func() {
ginkgo.By(fmt.Sprintf("Check if namespace(%s) present on member clusters", ns.Name), func() {
for _, clusterName := range framework.ClusterNames() {
clusterClient := framework.GetClusterClient(clusterName)
@ -83,10 +83,9 @@ var _ = ginkgo.Describe("[BasicClusterOverridePolicy] basic cluster override pol
if apierrors.IsNotFound(err) {
return false, nil
}
return false, err
}
// Check if the cluster's customLabel is correct value
v, ok := clusterNs.Labels[customLabelKey]
if ok && v == customLabelVal {
return true, nil
@ -99,7 +98,7 @@ var _ = ginkgo.Describe("[BasicClusterOverridePolicy] basic cluster override pol
})
})
var _ = framework.SerialDescribe("Test clusterOverridePolicy with nil resourceSelectors", func() {
var _ = framework.SerialDescribe("The ClusterOverridePolicy with nil resourceSelectors testing", func() {
var deploymentNamespace, deploymentName string
var propagationPolicyNamespace, propagationPolicyName string
var clusterOverridePolicyName string

View File

@ -326,7 +326,6 @@ var _ = ginkgo.Describe("[AdvancedClusterPropagation] propagation testing", func
})
ginkgo.Context("Edit ClusterPropagationPolicy fields other than resourceSelector", func() {
ginkgo.When("namespace scope resource", func() {
var policy *policyv1alpha1.ClusterPropagationPolicy
var deployment *appsv1.Deployment
@ -549,7 +548,7 @@ var _ = ginkgo.Describe("[ExplicitPriority] propagation testing", func() {
})
})
ginkgo.It("high explicit/low priority/implicit priority ClusterPropagationPolicy testing", func() {
ginkgo.It("high explicit/low priority/implicit priority ClusterPropagationPolicy propagation testing", func() {
ginkgo.By("check whether the deployment uses the highest explicit priority ClusterPropagationPolicy", func() {
framework.WaitDeploymentPresentOnClustersFitWith(framework.ClusterNames(), deployment.Namespace, deployment.Name,
func(deployment *appsv1.Deployment) bool {

View File

@ -0,0 +1,11 @@
### cluster override policy e2e test coverage analysis
#### The basic ClusterOverridePolicy testing
| Test Case | E2E Describe Text | Comments |
|--------------------------------------------------------------------------|---------------------------------|-----------------------------------------------------------------------------------------|
| Check if the ClusterOverridePolicy will update the namespace label value | Namespace labelOverride testing | [Override Policy](https://karmada.io/zh/docs/next/userguide/scheduling/override-policy) |
#### The ClusterOverridePolicy with nil resourceSelectors testing
| Test Case | E2E Describe Text | Comments |
|-----------------------------------------------------------------------------------------------------|----------------------------------|-------------------------------------------------------------------------------------------------------------------------------------|
| Check if the ClusterOverridePolicy with nil resourceSelector will update the deployment image value | deployment imageOverride testing | [Override Policy with nil resourceSelector](https://karmada.io/zh/docs/next/userguide/scheduling/override-policy#resource-selector) |

View File

@ -0,0 +1,30 @@
### cluster propagation policy e2e test coverage analysis
#### Basic propagation testing
| Test Case | E2E Describe Text | Comments |
|----------------------------------------------------|----------------------------------------|------------------------------------------------------------------------------------------------|
| Test the propagation policy for CRD | crd propagation testing | [Resource propagating](https://karmada.io/docs/next/userguide/scheduling/resource-propagating) |
| Test the propagation policy for clusterRole | clusterRole propagation testing | |
| Test the propagation policy for clusterRoleBinding | clusterRoleBinding propagation testing | |
#### Advanced propagation testing
| Test Case | E2E Describe Text | Comments |
|----------------------------------------------------------------------------|------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------|
| Test add resourceSelector of the propagation policy for the deployment | add resourceSelectors item(namespace scope) | [Update propagationPolicy](https://karmada.io/docs/next/userguide/scheduling/resource-propagating#update-propagationpolicy) |
| Test update resourceSelector of the propagation policy for the deployment | update resourceSelectors item(namespace scope) | |
| Test add resourceSelector of the propagation policy for the clusterRole | add resourceSelectors item(cluster scope) | |
| Test update resourceSelector of the propagation policy for the clusterRole | update resourceSelectors item(cluster scope) | |
| Test update propagateDeps of the propagation policy for deployment | update policy propagateDeps(namespace scope) | |
| Test update placement of the propagation policy for deployment | update policy placement(namespace scope) | |
| Test update placement of the propagation policy for clusterRole | update policy placement(cluster scope) | |
#### ExplicitPriority propagation testing
| Test Case | E2E Describe Text | Comments |
|----------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Test the high explicit/low priority/implicit priority propagation for deployment | high explicit/low priority/implicit priority ClusterPropagationPolicy propagation testing | [Configure PropagationPolicy/ClusterPropagationPolicy priority](https://karmada.io/docs/next/userguide/scheduling/resource-propagating#configure-propagationpolicyclusterpropagationpolicy-priority) |
| Test the same explicit priority propagation for deployment | same explicit priority ClusterPropagationPolicy propagation testing | [Choose from same-priority PropagationPolicies](https://karmada.io/docs/next/userguide/scheduling/resource-propagating#choose-from-same-priority-propagationpolicies) |
#### TODO
1. May need add the test case when the [deployment updates](https://karmada.io/docs/next/userguide/scheduling/resource-propagating#update-deployment).
2. May need add the test case for the **same implicit priority** propagation.
3. May need add the test case for **delete** the clusterPropagationPolicy.

View File

@ -0,0 +1,9 @@
### dependencies distributor e2e test coverage analysis
| Test Case | E2E Describe Text | Comments |
|------------------------------------------------------|---------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------|
| Test the configmap will propagate automatically | configmap automatically propagation testing | [Propagate Dependencies](https://karmada.io/docs/next/userguide/scheduling/propagate-dependencies) |
| Test the secret will propagate automatically | secret automatically propagation testing | [Dependencies distributor](https://github.com/karmada-io/karmada/blob/master/docs/proposals/dependencies-automatically-propagation/README.md) |
| Test the PVC will propagate automatically | persistentVolumeClaim automatically propagation testing | |
| Test the serviceAccount will propagate automatically | serviceAccount automatically propagation testing | |
| Test the configmap will propagate automatically | configmap propagate automatically testing | |

View File

@ -0,0 +1,11 @@
### failover e2e test coverage analysis
| Test Case | E2E Describe Text | Comments |
|------------------------------------------------------------------------------------|------------------------------------------------|----------------------------------------------------------------------------------------------|
| Test if the deployment of failed cluster is rescheduled to other available cluster | deployment failover testing | [Failover](https://karmada.io/docs/next/userguide/failover/failover-overview) |
| Test if the deployment of taint cluster is rescheduled to other available cluster | taint cluster | |
| Test if the deployment will rescheduled to other available cluster | application failover with purgeMode graciously | [Application failover](https://karmada.io/docs/next/userguide/failover/application-failover) |
| Test if the deployment will never rescheduled to other available cluster | application failover with purgeMode never | |
#### TODO
1. There are 2 way to evict the deployment of the Graciously PurgeMode, the third case cover the first way only, we may add a test case [when the GracePeriodSeconds is reach out](https://karmada.io/docs/next/userguide/failover/application-failover/#:~:text=after%20a%20timeout%20is%20reached%20before%20evicting%20the%20application).

View File

@ -2,6 +2,6 @@
| Test Case | E2E Describe Text | Comments |
|-----------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------|
| Create a namespace that needs to be automatically synchronized across all member clusters | create a namespace in karmada-apiserver ||
| Delete a namespace, and all member clusters need to automatically synchronize the deletion | delete a namespace from karmada-apiserver ||
| Create a namespace that needs to be automatically synchronized across all member clusters | create a namespace in karmada-apiserver | |
| Delete a namespace, and all member clusters need to automatically synchronize the deletion | delete a namespace from karmada-apiserver | |
| When a new cluster joins, the namespaces on the Karmada control plane (excluding reserved namespaces) need to be synchronized to that cluster | joining new cluster | [Namespace Management](https://karmada.io/docs/next/userguide/bestpractices/namespace-management/#default-namespace-propagation) |

View File

@ -0,0 +1,35 @@
### propagation policy e2e test coverage analysis
#### Basic propagation testing
| Test Case | E2E Describe Text | Comments |
|----------------------------------------------------------------|----------------------------------------|------------------------------------------------------------------------------------------------|
| Test the propagationPolicy for deployment | deployment propagation testing | [Resource propagating](https://karmada.io/docs/next/userguide/scheduling/resource-propagating) |
| Test the propagationPolicy for service | service propagation testing | |
| Test the propagationPolicy for pod | pod propagation testing | |
| Test the propagationPolicy for namespace scope custom resource | namespaceScoped cr propagation testing | |
| Test the propagationPolicy for job | job propagation testing | |
| Test the propagationPolicy for role | role propagation testing | |
| Test the propagationPolicy for roleBinding | roleBinding propagation testing | |
#### ImplicitPriority propagation testing
| Test Case | E2E Describe Text | Comments |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------|------------------------------------------------------------------------------------------------------------------------------------|
| Test whether the deployment uses the highest priority propagationPolicy when there are three propagationPolicy | priorityMatchName testing | [Configure implicit priority](https://karmada.io/docs/next/userguide/scheduling/resource-propagating/#configure-implicit-priority) |
| Test whether the deployment uses the highest priority propagationPolicy when there are two propagation policies, one with a label selector and the other without | policyMatchLabelSelector testing | |
| Test whether the deployment uses the highest priority propagationPolicy when there is a propagationPolicy match all deployment | priorityMatchAll testing | |
#### ExplicitPriority propagation testing
| Test Case | E2E Describe Text | Comments |
|----------------------------------------------------------------------------------|------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Test the high explicit/low priority/implicit priority propagation for deployment | high explicit/low priority/implicit priority PropagationPolicy propagation testing | [Configure explicit priority](https://karmada.io/docs/next/userguide/scheduling/resource-propagating#configure-explicit-priority) |
| Test the same explicit priority propagation for deployment | same explicit priority PropagationPolicy propagation testing | [Choose from same-priority PropagationPolicies](https://karmada.io/docs/next/userguide/scheduling/resource-propagating#choose-from-same-priority-propagationpolicies) |
#### Advanced propagation testing
| Test Case | E2E Describe Text | Comments |
|--------------------------------------------------------------------------|-----------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------|
| Test add resourceSelector of the propagationPolicy for the deployment | add resourceSelectors item | [Update propagationPolicy](https://karmada.io/docs/next/userguide/scheduling/resource-propagating#update-propagationpolicy) |
| Test update resourceSelector of the propagationPolicy for the deployment | update resourceSelectors item | |
| Test update propagateDeps of the propagationPolicy for the deployment | update policy propagateDeps | |
| Test update placement of the propagationPolicy for the deployment | update policy placement | |
| Test modify the old propagationPolicy to unbind and create a new one | modify the old propagationPolicy to unbind and create a new one | |
| Test delete the old propagationPolicy to unbind and create a new one | delete the old propagationPolicy to unbind and create a new one | |

View File

@ -0,0 +1,8 @@
### resource deletion protection e2e test coverage analysis
| Test Case | E2E Describe Text | Comments |
|----------------------------------------------------------------------------|----------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------|
| Test the basic protection for deployment | Delete the protected deployment | [Resource Deletion Protection](https://karmada.io/docs/next/administrator/configuration/resource-deletion-protection/) |
| Test the basic protection for namespace | Delete the protected namespace | |
| Test delete the unprotected namespace that contains a protected Deployment | Delete the no protected namespace, the deployment is protected | |
| Test delete the namespace after the protection has been removed | Delete the namespace after the protection has been removed | |

View File

@ -14,7 +14,7 @@ import (
)
var _ = ginkgo.Describe("[DependenciesDistributor] automatically propagate relevant resources testing", func() {
ginkgo.Context("dependencies propagation with propagationpolicy testing", func() {
ginkgo.Context("dependencies propagation with propagationPolicy testing", func() {
var initClusterNames, updateClusterNames []string
var policyName string
var deploymentName string
@ -327,7 +327,7 @@ var _ = ginkgo.Describe("[DependenciesDistributor] automatically propagate relev
})
})
ginkgo.Context("dependencies propagation with clusterpropagationpolicy testing", func() {
ginkgo.Context("dependencies propagation with clusterPropagationPolicy testing", func() {
var initClusterNames, updateClusterNames []string
var policyName string
var deploymentName string

View File

@ -219,7 +219,7 @@ var _ = framework.SerialDescribe("failover testing", func() {
}
})
ginkgo.By("check whether deployment of failed cluster is rescheduled to other available cluster", func() {
ginkgo.By("check whether deployment of taint cluster is rescheduled to other available cluster", func() {
gomega.Eventually(func() int {
targetClusterNames = framework.ExtractTargetClustersFrom(controlPlaneClient, deployment)
for _, targetClusterName := range targetClusterNames {
@ -307,7 +307,7 @@ var _ = framework.SerialDescribe("failover testing", func() {
})
})
ginkgo.It("application failover", func() {
ginkgo.It("application failover with purgeMode graciously", func() {
disabledClusters := framework.ExtractTargetClustersFrom(controlPlaneClient, deployment)
ginkgo.By("create an error op", func() {
overridePolicy = testhelper.NewOverridePolicyByOverrideRules(policyNamespace, policyName, []policyv1alpha1.ResourceSelector{
@ -369,7 +369,6 @@ var _ = framework.SerialDescribe("failover testing", func() {
framework.RemoveOverridePolicy(karmadaClient, policyNamespace, policyName)
})
})
})
ginkgo.Context("Application failover testing with purgeMode never", func() {
@ -435,7 +434,7 @@ var _ = framework.SerialDescribe("failover testing", func() {
})
})
ginkgo.It("application failover", func() {
ginkgo.It("application failover with purgeMode never", func() {
disabledClusters := framework.ExtractTargetClustersFrom(controlPlaneClient, deployment)
ginkgo.By("create an error op", func() {
overridePolicy = testhelper.NewOverridePolicyByOverrideRules(policyNamespace, policyName, []policyv1alpha1.ResourceSelector{
@ -497,9 +496,7 @@ var _ = framework.SerialDescribe("failover testing", func() {
framework.RemoveOverridePolicy(karmadaClient, policyNamespace, policyName)
})
})
})
})
// disableCluster will set wrong API endpoint of current cluster

View File

@ -1076,7 +1076,7 @@ var _ = ginkgo.Describe("[AdvancedPropagation] propagation testing", func() {
})
})
ginkgo.It("modify the old PropagationPolicy to unbind and create a new one", func() {
ginkgo.It("modify the old propagationPolicy to unbind and create a new one", func() {
framework.CreatePropagationPolicy(karmadaClient, policy01)
framework.WaitConfigMapPresentOnClusterFitWith(member1, configmap.Namespace, configmap.Name,
func(configmap *corev1.ConfigMap) bool { return true })
@ -1103,7 +1103,7 @@ var _ = ginkgo.Describe("[AdvancedPropagation] propagation testing", func() {
framework.RemovePropagationPolicy(karmadaClient, policy02.Namespace, policy02.Name)
})
ginkgo.It("delete the old PropagationPolicy to unbind and create a new one", func() {
ginkgo.It("delete the old propagationPolicy to unbind and create a new one", func() {
framework.CreatePropagationPolicy(karmadaClient, policy01)
framework.WaitConfigMapPresentOnClusterFitWith(member1, configmap.Namespace, configmap.Name,
func(configmap *corev1.ConfigMap) bool { return true })

View File

@ -39,7 +39,7 @@ var _ = ginkgo.Describe("[resource deletion protection] deletion protection test
framework.CreateDeployment(kubeClient, deployment)
})
ginkgo.It("delete the protected deployment", func() {
ginkgo.It("Delete the protected deployment", func() {
framework.UpdateDeploymentLabels(kubeClient, deployment, protectedLabelValues)
// the deletion operation should return an error like:
@ -50,7 +50,7 @@ var _ = ginkgo.Describe("[resource deletion protection] deletion protection test
gomega.Expect(err).Should(gomega.MatchError(gomega.ContainSubstring(deletionProtectionErrorSubStr)))
})
ginkgo.It("delete the protected namespace", func() {
ginkgo.It("Delete the protected namespace", func() {
framework.UpdateNamespaceLabels(kubeClient, namespace, protectedLabelValues)
// the deletion operation should return an error too.
@ -58,7 +58,7 @@ var _ = ginkgo.Describe("[resource deletion protection] deletion protection test
gomega.Expect(err).Should(gomega.MatchError(gomega.ContainSubstring(deletionProtectionErrorSubStr)))
})
ginkgo.It("delete the no protected namespace, the deployment is protected", func() {
ginkgo.It("Delete the no protected namespace, the deployment is protected", func() {
framework.UpdateDeploymentLabels(kubeClient, deployment, protectedLabelValues)
// the deletion operation should not return an error, and the namespace
@ -69,7 +69,7 @@ var _ = ginkgo.Describe("[resource deletion protection] deletion protection test
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
})
ginkgo.It("delete the namespace after the protection has been removed", func() {
ginkgo.It("Delete the namespace after the protection has been removed", func() {
framework.UpdateNamespaceLabels(kubeClient, namespace, protectedLabelValues)
err := kubeClient.CoreV1().Namespaces().Delete(context.TODO(), namespaceName, metav1.DeleteOptions{})
gomega.Expect(err).Should(gomega.MatchError(gomega.ContainSubstring(deletionProtectionErrorSubStr)))