mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
Merge pull request #103002 from TeweiLuo/remove-unmanaged-zone-tests
Remove gcepd unmanaged zone test.
This commit is contained in:
commit
513ae557a3
@ -38,7 +38,6 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
"k8s.io/apimachinery/pkg/util/rand"
|
"k8s.io/apimachinery/pkg/util/rand"
|
||||||
"k8s.io/apimachinery/pkg/util/sets"
|
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
"k8s.io/apiserver/pkg/authentication/serviceaccount"
|
"k8s.io/apiserver/pkg/authentication/serviceaccount"
|
||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
@ -418,66 +417,6 @@ var _ = utils.SIGDescribe("Dynamic Provisioning", func() {
|
|||||||
framework.ExpectNoError(e2epv.WaitForPersistentVolumeDeleted(c, pv.Name, 1*time.Second, 30*time.Second))
|
framework.ExpectNoError(e2epv.WaitForPersistentVolumeDeleted(c, pv.Name, 1*time.Second, 30*time.Second))
|
||||||
})
|
})
|
||||||
|
|
||||||
ginkgo.It("should not provision a volume in an unmanaged GCE zone.", func() {
|
|
||||||
e2eskipper.SkipUnlessProviderIs("gce", "gke")
|
|
||||||
|
|
||||||
ginkgo.By("Discovering an unmanaged zone")
|
|
||||||
allZones := sets.NewString() // all zones in the project
|
|
||||||
|
|
||||||
gceCloud, err := gce.GetGCECloud()
|
|
||||||
framework.ExpectNoError(err)
|
|
||||||
|
|
||||||
// Get all k8s managed zones (same as zones with nodes in them for test)
|
|
||||||
managedZones, err := gceCloud.GetAllZonesFromCloudProvider()
|
|
||||||
framework.ExpectNoError(err)
|
|
||||||
|
|
||||||
// Get a list of all zones in the project
|
|
||||||
zones, err := gceCloud.ComputeServices().GA.Zones.List(framework.TestContext.CloudConfig.ProjectID).Do()
|
|
||||||
framework.ExpectNoError(err)
|
|
||||||
for _, z := range zones.Items {
|
|
||||||
allZones.Insert(z.Name)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the subset of zones not managed by k8s
|
|
||||||
var unmanagedZone string
|
|
||||||
var popped bool
|
|
||||||
unmanagedZones := allZones.Difference(managedZones)
|
|
||||||
// And select one of them at random.
|
|
||||||
if unmanagedZone, popped = unmanagedZones.PopAny(); !popped {
|
|
||||||
e2eskipper.Skipf("No unmanaged zones found.")
|
|
||||||
}
|
|
||||||
|
|
||||||
ginkgo.By("Creating a StorageClass for the unmanaged zone")
|
|
||||||
test := testsuites.StorageClassTest{
|
|
||||||
Name: "unmanaged_zone",
|
|
||||||
Provisioner: "kubernetes.io/gce-pd",
|
|
||||||
Timeouts: f.Timeouts,
|
|
||||||
Parameters: map[string]string{"zone": unmanagedZone},
|
|
||||||
ClaimSize: "1Gi",
|
|
||||||
}
|
|
||||||
sc := newStorageClass(test, ns, "unmanaged")
|
|
||||||
sc, err = c.StorageV1().StorageClasses().Create(context.TODO(), sc, metav1.CreateOptions{})
|
|
||||||
framework.ExpectNoError(err)
|
|
||||||
defer deleteStorageClass(c, sc.Name)
|
|
||||||
|
|
||||||
ginkgo.By("Creating a claim and expecting it to timeout")
|
|
||||||
pvc := e2epv.MakePersistentVolumeClaim(e2epv.PersistentVolumeClaimConfig{
|
|
||||||
ClaimSize: test.ClaimSize,
|
|
||||||
StorageClassName: &sc.Name,
|
|
||||||
VolumeMode: &test.VolumeMode,
|
|
||||||
}, ns)
|
|
||||||
pvc, err = c.CoreV1().PersistentVolumeClaims(ns).Create(context.TODO(), pvc, metav1.CreateOptions{})
|
|
||||||
framework.ExpectNoError(err)
|
|
||||||
defer func() {
|
|
||||||
framework.ExpectNoError(e2epv.DeletePersistentVolumeClaim(c, pvc.Name, ns), "Failed to delete PVC ", pvc.Name)
|
|
||||||
}()
|
|
||||||
|
|
||||||
// The claim should timeout phase:Pending
|
|
||||||
err = e2epv.WaitForPersistentVolumeClaimPhase(v1.ClaimBound, c, ns, pvc.Name, 2*time.Second, timeouts.ClaimProvisionShort)
|
|
||||||
framework.ExpectError(err)
|
|
||||||
framework.Logf(err.Error())
|
|
||||||
})
|
|
||||||
|
|
||||||
ginkgo.It("should test that deleting a claim before the volume is provisioned deletes the volume.", func() {
|
ginkgo.It("should test that deleting a claim before the volume is provisioned deletes the volume.", func() {
|
||||||
// This case tests for the regressions of a bug fixed by PR #21268
|
// This case tests for the regressions of a bug fixed by PR #21268
|
||||||
// REGRESSION: Deleting the PVC before the PV is provisioned can result in the PV
|
// REGRESSION: Deleting the PVC before the PV is provisioned can result in the PV
|
||||||
|
Loading…
Reference in New Issue
Block a user