mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
Add GKE coverage for e2e tests that support both GCE and GKE
This commit is contained in:
parent
3f2ac7864b
commit
a885166890
@ -60,7 +60,7 @@ var _ = Describe("Pod Disks", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("should schedule a pod w/ a RW PD, remove it, then schedule it on another host", func() {
|
It("should schedule a pod w/ a RW PD, remove it, then schedule it on another host", func() {
|
||||||
SkipUnlessProviderIs("gce", "aws")
|
SkipUnlessProviderIs("gce", "gke", "aws")
|
||||||
|
|
||||||
By("creating PD")
|
By("creating PD")
|
||||||
diskName, err := createPD()
|
diskName, err := createPD()
|
||||||
@ -113,7 +113,7 @@ var _ = Describe("Pod Disks", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("should schedule a pod w/ a readonly PD on two hosts, then remove both.", func() {
|
It("should schedule a pod w/ a readonly PD on two hosts, then remove both.", func() {
|
||||||
SkipUnlessProviderIs("gce")
|
SkipUnlessProviderIs("gce", "gke")
|
||||||
|
|
||||||
By("creating PD")
|
By("creating PD")
|
||||||
diskName, err := createPD()
|
diskName, err := createPD()
|
||||||
@ -166,6 +166,7 @@ var _ = Describe("Pod Disks", func() {
|
|||||||
Logf("Couldn't delete PD. Sleeping 5 seconds")
|
Logf("Couldn't delete PD. Sleeping 5 seconds")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
Logf("Successfully deleted PD %q", diskName)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
expectNoError(err, "Error deleting PD")
|
expectNoError(err, "Error deleting PD")
|
||||||
@ -173,7 +174,7 @@ var _ = Describe("Pod Disks", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
func createPD() (string, error) {
|
func createPD() (string, error) {
|
||||||
if testContext.Provider == "gce" {
|
if testContext.Provider == "gce" || testContext.Provider == "gke" {
|
||||||
pdName := fmt.Sprintf("%s-%s", testContext.prefix, string(util.NewUUID()))
|
pdName := fmt.Sprintf("%s-%s", testContext.prefix, string(util.NewUUID()))
|
||||||
|
|
||||||
zone := testContext.CloudConfig.Zone
|
zone := testContext.CloudConfig.Zone
|
||||||
@ -195,7 +196,7 @@ func createPD() (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func deletePD(pdName string) error {
|
func deletePD(pdName string) error {
|
||||||
if testContext.Provider == "gce" {
|
if testContext.Provider == "gce" || testContext.Provider == "gke" {
|
||||||
zone := testContext.CloudConfig.Zone
|
zone := testContext.CloudConfig.Zone
|
||||||
|
|
||||||
// TODO: make this hit the compute API directly.
|
// TODO: make this hit the compute API directly.
|
||||||
@ -215,7 +216,7 @@ func deletePD(pdName string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func detachPD(hostName, pdName string) error {
|
func detachPD(hostName, pdName string) error {
|
||||||
if testContext.Provider == "gce" {
|
if testContext.Provider == "gce" || testContext.Provider == "gke" {
|
||||||
instanceName := strings.Split(hostName, ".")[0]
|
instanceName := strings.Split(hostName, ".")[0]
|
||||||
|
|
||||||
zone := testContext.CloudConfig.Zone
|
zone := testContext.CloudConfig.Zone
|
||||||
@ -257,7 +258,7 @@ func testPDPod(diskName, targetHost string, readOnly bool) *api.Pod {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if testContext.Provider == "gce" {
|
if testContext.Provider == "gce" || testContext.Provider == "gke" {
|
||||||
pod.Spec.Volumes = []api.Volume{
|
pod.Spec.Volumes = []api.Volume{
|
||||||
{
|
{
|
||||||
Name: "testpd",
|
Name: "testpd",
|
||||||
|
@ -51,11 +51,11 @@ var _ = Describe("Reboot", func() {
|
|||||||
c, err = loadClient()
|
c, err = loadClient()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
// These tests requires SSH, so the provider check should be identical to there
|
// These tests requires SSH to nodes, so the provider check should be identical to there
|
||||||
// (the limiting factor is the implementation of util.go's getSigner(...)).
|
// (the limiting factor is the implementation of util.go's getSigner(...)).
|
||||||
|
|
||||||
// Cluster must support node reboot
|
// Cluster must support node reboot
|
||||||
SkipUnlessProviderIs("gce", "aws")
|
SkipUnlessProviderIs("gce", "gke", "aws")
|
||||||
})
|
})
|
||||||
|
|
||||||
It("each node by ordering clean reboot and ensure they function upon restart", func() {
|
It("each node by ordering clean reboot and ensure they function upon restart", func() {
|
||||||
|
@ -61,7 +61,7 @@ var _ = Describe("Restart", func() {
|
|||||||
// This test requires the ability to restart all nodes, so the provider
|
// This test requires the ability to restart all nodes, so the provider
|
||||||
// check must be identical to that call.
|
// check must be identical to that call.
|
||||||
skipped = true
|
skipped = true
|
||||||
SkipUnlessProviderIs("gce")
|
SkipUnlessProviderIs("gce", "gke")
|
||||||
skipped = false
|
skipped = false
|
||||||
|
|
||||||
ps = newPodStore(c, api.NamespaceDefault, labels.Everything(), fields.Everything())
|
ps = newPodStore(c, api.NamespaceDefault, labels.Everything(), fields.Everything())
|
||||||
@ -214,7 +214,7 @@ func checkNodesReady(c *client.Client, nt time.Duration, expect int) ([]string,
|
|||||||
// allowing up to nt per node.
|
// allowing up to nt per node.
|
||||||
func restartNodes(provider string, nt time.Duration) error {
|
func restartNodes(provider string, nt time.Duration) error {
|
||||||
switch provider {
|
switch provider {
|
||||||
case "gce":
|
case "gce", "gke":
|
||||||
return migRollingUpdateSelf(nt)
|
return migRollingUpdateSelf(nt)
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("restartNodes(...) not implemented for %s", provider)
|
return fmt.Errorf("restartNodes(...) not implemented for %s", provider)
|
||||||
|
Loading…
Reference in New Issue
Block a user