mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-08 03:33:56 +00:00
Merge pull request #122080 from SataQiu/clean-test-20231128
clean up unused parameters for volume zone unit test
This commit is contained in:
commit
7e4751964e
@ -35,7 +35,7 @@ import (
|
|||||||
tf "k8s.io/kubernetes/pkg/scheduler/testing/framework"
|
tf "k8s.io/kubernetes/pkg/scheduler/testing/framework"
|
||||||
)
|
)
|
||||||
|
|
||||||
func createPodWithVolume(pod, pv, pvc string) *v1.Pod {
|
func createPodWithVolume(pod, pvc string) *v1.Pod {
|
||||||
return st.MakePod().Name(pod).Namespace(metav1.NamespaceDefault).PVC(pvc).Obj()
|
return st.MakePod().Name(pod).Namespace(metav1.NamespaceDefault).PVC(pvc).Obj()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ func TestSingleZone(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "node without labels",
|
name: "node without labels",
|
||||||
Pod: createPodWithVolume("pod_1", "vol_1", "PVC_1"),
|
Pod: createPodWithVolume("pod_1", "PVC_1"),
|
||||||
Node: &v1.Node{
|
Node: &v1.Node{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "host1",
|
Name: "host1",
|
||||||
@ -121,7 +121,7 @@ func TestSingleZone(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "beta zone label matched",
|
name: "beta zone label matched",
|
||||||
Pod: createPodWithVolume("pod_1", "vol_1", "PVC_1"),
|
Pod: createPodWithVolume("pod_1", "PVC_1"),
|
||||||
Node: &v1.Node{
|
Node: &v1.Node{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "host1",
|
Name: "host1",
|
||||||
@ -131,7 +131,7 @@ func TestSingleZone(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "beta region label matched",
|
name: "beta region label matched",
|
||||||
Pod: createPodWithVolume("pod_1", "vol_1", "PVC_2"),
|
Pod: createPodWithVolume("pod_1", "PVC_2"),
|
||||||
Node: &v1.Node{
|
Node: &v1.Node{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "host1",
|
Name: "host1",
|
||||||
@ -141,7 +141,7 @@ func TestSingleZone(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "beta region label doesn't match",
|
name: "beta region label doesn't match",
|
||||||
Pod: createPodWithVolume("pod_1", "vol_1", "PVC_2"),
|
Pod: createPodWithVolume("pod_1", "PVC_2"),
|
||||||
Node: &v1.Node{
|
Node: &v1.Node{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "host1",
|
Name: "host1",
|
||||||
@ -152,7 +152,7 @@ func TestSingleZone(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "beta zone label doesn't match",
|
name: "beta zone label doesn't match",
|
||||||
Pod: createPodWithVolume("pod_1", "vol_1", "PVC_1"),
|
Pod: createPodWithVolume("pod_1", "PVC_1"),
|
||||||
Node: &v1.Node{
|
Node: &v1.Node{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "host1",
|
Name: "host1",
|
||||||
@ -163,7 +163,7 @@ func TestSingleZone(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "zone label matched",
|
name: "zone label matched",
|
||||||
Pod: createPodWithVolume("pod_1", "Vol_Stable_1", "PVC_Stable_1"),
|
Pod: createPodWithVolume("pod_1", "PVC_Stable_1"),
|
||||||
Node: &v1.Node{
|
Node: &v1.Node{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "host1",
|
Name: "host1",
|
||||||
@ -173,7 +173,7 @@ func TestSingleZone(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "region label matched",
|
name: "region label matched",
|
||||||
Pod: createPodWithVolume("pod_1", "Vol_Stable_2", "PVC_Stable_2"),
|
Pod: createPodWithVolume("pod_1", "PVC_Stable_2"),
|
||||||
Node: &v1.Node{
|
Node: &v1.Node{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "host1",
|
Name: "host1",
|
||||||
@ -183,7 +183,7 @@ func TestSingleZone(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "region label doesn't match",
|
name: "region label doesn't match",
|
||||||
Pod: createPodWithVolume("pod_1", "Vol_Stable_2", "PVC_Stable_2"),
|
Pod: createPodWithVolume("pod_1", "PVC_Stable_2"),
|
||||||
Node: &v1.Node{
|
Node: &v1.Node{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "host1",
|
Name: "host1",
|
||||||
@ -194,7 +194,7 @@ func TestSingleZone(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "zone label doesn't match",
|
name: "zone label doesn't match",
|
||||||
Pod: createPodWithVolume("pod_1", "Vol_Stable_1", "PVC_Stable_1"),
|
Pod: createPodWithVolume("pod_1", "PVC_Stable_1"),
|
||||||
Node: &v1.Node{
|
Node: &v1.Node{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "host1",
|
Name: "host1",
|
||||||
@ -205,7 +205,7 @@ func TestSingleZone(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "pv with zone and region, node with only zone",
|
name: "pv with zone and region, node with only zone",
|
||||||
Pod: createPodWithVolume("pod_1", "Vol_Stable_3", "PVC_Stable_3"),
|
Pod: createPodWithVolume("pod_1", "PVC_Stable_3"),
|
||||||
Node: &v1.Node{
|
Node: &v1.Node{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "host1",
|
Name: "host1",
|
||||||
@ -218,7 +218,7 @@ func TestSingleZone(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "pv with zone,node with beta zone",
|
name: "pv with zone,node with beta zone",
|
||||||
Pod: createPodWithVolume("pod_1", "Vol_Stable_1", "PVC_Stable_1"),
|
Pod: createPodWithVolume("pod_1", "PVC_Stable_1"),
|
||||||
Node: &v1.Node{
|
Node: &v1.Node{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "host1",
|
Name: "host1",
|
||||||
@ -231,7 +231,7 @@ func TestSingleZone(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "pv with beta label,node with ga label, matched",
|
name: "pv with beta label,node with ga label, matched",
|
||||||
Pod: createPodWithVolume("pod_1", "Vol_1", "PVC_1"),
|
Pod: createPodWithVolume("pod_1", "PVC_1"),
|
||||||
Node: &v1.Node{
|
Node: &v1.Node{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "host1",
|
Name: "host1",
|
||||||
@ -243,7 +243,7 @@ func TestSingleZone(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "pv with beta label,node with ga label, don't match",
|
name: "pv with beta label,node with ga label, don't match",
|
||||||
Pod: createPodWithVolume("pod_1", "vol_1", "PVC_1"),
|
Pod: createPodWithVolume("pod_1", "PVC_1"),
|
||||||
Node: &v1.Node{
|
Node: &v1.Node{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "host1",
|
Name: "host1",
|
||||||
@ -337,7 +337,7 @@ func TestMultiZone(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "node without labels",
|
name: "node without labels",
|
||||||
Pod: createPodWithVolume("pod_1", "Vol_3", "PVC_3"),
|
Pod: createPodWithVolume("pod_1", "PVC_3"),
|
||||||
Node: &v1.Node{
|
Node: &v1.Node{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "host1",
|
Name: "host1",
|
||||||
@ -346,7 +346,7 @@ func TestMultiZone(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "beta zone label matched",
|
name: "beta zone label matched",
|
||||||
Pod: createPodWithVolume("pod_1", "Vol_3", "PVC_3"),
|
Pod: createPodWithVolume("pod_1", "PVC_3"),
|
||||||
Node: &v1.Node{
|
Node: &v1.Node{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "host1",
|
Name: "host1",
|
||||||
@ -356,7 +356,7 @@ func TestMultiZone(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "beta zone label doesn't match",
|
name: "beta zone label doesn't match",
|
||||||
Pod: createPodWithVolume("pod_1", "vol_1", "PVC_1"),
|
Pod: createPodWithVolume("pod_1", "PVC_1"),
|
||||||
Node: &v1.Node{
|
Node: &v1.Node{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "host1",
|
Name: "host1",
|
||||||
@ -367,7 +367,7 @@ func TestMultiZone(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "zone label matched",
|
name: "zone label matched",
|
||||||
Pod: createPodWithVolume("pod_1", "Vol_Stable_2", "PVC_Stable_2"),
|
Pod: createPodWithVolume("pod_1", "PVC_Stable_2"),
|
||||||
Node: &v1.Node{
|
Node: &v1.Node{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "host1",
|
Name: "host1",
|
||||||
@ -377,7 +377,7 @@ func TestMultiZone(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "zone label doesn't match",
|
name: "zone label doesn't match",
|
||||||
Pod: createPodWithVolume("pod_1", "Vol_Stable_1", "PVC_Stable_1"),
|
Pod: createPodWithVolume("pod_1", "PVC_Stable_1"),
|
||||||
Node: &v1.Node{
|
Node: &v1.Node{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "host1",
|
Name: "host1",
|
||||||
@ -477,12 +477,12 @@ func TestWithBinding(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "label zone failure domain matched",
|
name: "label zone failure domain matched",
|
||||||
Pod: createPodWithVolume("pod_1", "vol_1", "PVC_1"),
|
Pod: createPodWithVolume("pod_1", "PVC_1"),
|
||||||
Node: testNode,
|
Node: testNode,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "unbound volume empty storage class",
|
name: "unbound volume empty storage class",
|
||||||
Pod: createPodWithVolume("pod_1", "vol_1", "PVC_EmptySC"),
|
Pod: createPodWithVolume("pod_1", "PVC_EmptySC"),
|
||||||
Node: testNode,
|
Node: testNode,
|
||||||
wantPreFilterStatus: framework.NewStatus(framework.UnschedulableAndUnresolvable,
|
wantPreFilterStatus: framework.NewStatus(framework.UnschedulableAndUnresolvable,
|
||||||
"PersistentVolumeClaim had no pv name and storageClass name"),
|
"PersistentVolumeClaim had no pv name and storageClass name"),
|
||||||
@ -491,7 +491,7 @@ func TestWithBinding(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "unbound volume no storage class",
|
name: "unbound volume no storage class",
|
||||||
Pod: createPodWithVolume("pod_1", "vol_1", "PVC_NoSC"),
|
Pod: createPodWithVolume("pod_1", "PVC_NoSC"),
|
||||||
Node: testNode,
|
Node: testNode,
|
||||||
wantPreFilterStatus: framework.NewStatus(framework.UnschedulableAndUnresolvable,
|
wantPreFilterStatus: framework.NewStatus(framework.UnschedulableAndUnresolvable,
|
||||||
`storageclasses.storage.k8s.io "Class_0" not found`),
|
`storageclasses.storage.k8s.io "Class_0" not found`),
|
||||||
@ -500,14 +500,14 @@ func TestWithBinding(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "unbound volume immediate binding mode",
|
name: "unbound volume immediate binding mode",
|
||||||
Pod: createPodWithVolume("pod_1", "vol_1", "PVC_ImmediateSC"),
|
Pod: createPodWithVolume("pod_1", "PVC_ImmediateSC"),
|
||||||
Node: testNode,
|
Node: testNode,
|
||||||
wantPreFilterStatus: framework.NewStatus(framework.UnschedulableAndUnresolvable, "VolumeBindingMode not set for StorageClass \"Class_Immediate\""),
|
wantPreFilterStatus: framework.NewStatus(framework.UnschedulableAndUnresolvable, "VolumeBindingMode not set for StorageClass \"Class_Immediate\""),
|
||||||
wantFilterStatus: framework.NewStatus(framework.UnschedulableAndUnresolvable, "VolumeBindingMode not set for StorageClass \"Class_Immediate\""),
|
wantFilterStatus: framework.NewStatus(framework.UnschedulableAndUnresolvable, "VolumeBindingMode not set for StorageClass \"Class_Immediate\""),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "unbound volume wait binding mode",
|
name: "unbound volume wait binding mode",
|
||||||
Pod: createPodWithVolume("pod_1", "vol_1", "PVC_WaitSC"),
|
Pod: createPodWithVolume("pod_1", "PVC_WaitSC"),
|
||||||
Node: testNode,
|
Node: testNode,
|
||||||
wantPreFilterStatus: framework.NewStatus(framework.Skip),
|
wantPreFilterStatus: framework.NewStatus(framework.Skip),
|
||||||
},
|
},
|
||||||
@ -550,7 +550,7 @@ func BenchmarkVolumeZone(b *testing.B) {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
Name: "with prefilter",
|
Name: "with prefilter",
|
||||||
Pod: createPodWithVolume("pod_0", "Vol_Stable_0", "PVC_Stable_0"),
|
Pod: createPodWithVolume("pod_0", "PVC_Stable_0"),
|
||||||
NumPV: 1000,
|
NumPV: 1000,
|
||||||
NumPVC: 1000,
|
NumPVC: 1000,
|
||||||
NumNodes: 1000,
|
NumNodes: 1000,
|
||||||
@ -558,7 +558,7 @@ func BenchmarkVolumeZone(b *testing.B) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "without prefilter",
|
Name: "without prefilter",
|
||||||
Pod: createPodWithVolume("pod_0", "Vol_Stable_0", "PVC_Stable_0"),
|
Pod: createPodWithVolume("pod_0", "PVC_Stable_0"),
|
||||||
NumPV: 1000,
|
NumPV: 1000,
|
||||||
NumPVC: 1000,
|
NumPVC: 1000,
|
||||||
NumNodes: 1000,
|
NumNodes: 1000,
|
||||||
|
Loading…
Reference in New Issue
Block a user