mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-29 21:29:24 +00:00
Move host_path, downwardapi_volume and empty_dir into common directory.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2015 The Kubernetes Authors.
|
||||
Copyright 2016 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package e2e
|
||||
package common
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@@ -32,8 +32,12 @@ import (
|
||||
var _ = framework.KubeDescribe("Downward API volume", func() {
|
||||
// How long to wait for a log pod to be displayed
|
||||
const podLogTimeout = 45 * time.Second
|
||||
|
||||
f := framework.NewDefaultFramework("downward-api")
|
||||
var podClient *framework.PodClient
|
||||
BeforeEach(func() {
|
||||
podClient = f.PodClient()
|
||||
})
|
||||
|
||||
It("should provide podname only [Conformance]", func() {
|
||||
podName := "downwardapi-volume-" + string(uuid.NewUUID())
|
||||
pod := downwardAPIVolumePodForSimpleTest(podName, "/etc/podname")
|
||||
@@ -67,13 +71,10 @@ var _ = framework.KubeDescribe("Downward API volume", func() {
|
||||
containerName := "client-container"
|
||||
defer func() {
|
||||
By("Deleting the pod")
|
||||
f.Client.Pods(f.Namespace.Name).Delete(pod.Name, api.NewDeleteOptions(0))
|
||||
podClient.Delete(pod.Name, api.NewDeleteOptions(0))
|
||||
}()
|
||||
By("Creating the pod")
|
||||
pod, err := f.Client.Pods(f.Namespace.Name).Create(pod)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
framework.ExpectNoError(framework.WaitForPodRunningInNamespace(f.Client, pod))
|
||||
podClient.CreateSync(pod)
|
||||
|
||||
Eventually(func() (string, error) {
|
||||
return framework.GetPodLogs(f.Client, f.Namespace.Name, podName, containerName)
|
||||
@@ -81,7 +82,7 @@ var _ = framework.KubeDescribe("Downward API volume", func() {
|
||||
podLogTimeout, framework.Poll).Should(ContainSubstring("key1=\"value1\"\n"))
|
||||
|
||||
//modify labels
|
||||
f.PodClient().Update(podName, func(pod *api.Pod) {
|
||||
podClient.Update(podName, func(pod *api.Pod) {
|
||||
pod.Labels["key3"] = "value3"
|
||||
})
|
||||
|
||||
@@ -100,14 +101,12 @@ var _ = framework.KubeDescribe("Downward API volume", func() {
|
||||
containerName := "client-container"
|
||||
defer func() {
|
||||
By("Deleting the pod")
|
||||
f.Client.Pods(f.Namespace.Name).Delete(pod.Name, api.NewDeleteOptions(0))
|
||||
podClient.Delete(pod.Name, api.NewDeleteOptions(0))
|
||||
}()
|
||||
By("Creating the pod")
|
||||
pod, err := f.Client.Pods(f.Namespace.Name).Create(pod)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
framework.ExpectNoError(framework.WaitForPodRunningInNamespace(f.Client, pod))
|
||||
podClient.CreateSync(pod)
|
||||
|
||||
pod, err = f.Client.Pods(f.Namespace.Name).Get(pod.Name)
|
||||
pod, err := podClient.Get(pod.Name)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Eventually(func() (string, error) {
|
||||
@@ -116,7 +115,7 @@ var _ = framework.KubeDescribe("Downward API volume", func() {
|
||||
podLogTimeout, framework.Poll).Should(ContainSubstring("builder=\"bar\"\n"))
|
||||
|
||||
//modify annotations
|
||||
f.PodClient().Update(podName, func(pod *api.Pod) {
|
||||
podClient.Update(podName, func(pod *api.Pod) {
|
||||
pod.Annotations["builder"] = "foo"
|
||||
})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2015 The Kubernetes Authors.
|
||||
Copyright 2016 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package e2e
|
||||
package common
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2015 The Kubernetes Authors.
|
||||
Copyright 2016 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package e2e
|
||||
package common
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@@ -24,7 +24,6 @@ import (
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||
"k8s.io/kubernetes/pkg/apimachinery/registered"
|
||||
client "k8s.io/kubernetes/pkg/client/unversioned"
|
||||
"k8s.io/kubernetes/test/e2e/framework"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
@@ -32,15 +31,10 @@ import (
|
||||
|
||||
//TODO : Consolidate this code with the code for emptyDir.
|
||||
//This will require some smart.
|
||||
var _ = framework.KubeDescribe("hostPath", func() {
|
||||
var _ = framework.KubeDescribe("HostPath", func() {
|
||||
f := framework.NewDefaultFramework("hostpath")
|
||||
var c *client.Client
|
||||
var namespace *api.Namespace
|
||||
|
||||
BeforeEach(func() {
|
||||
c = f.Client
|
||||
namespace = f.Namespace
|
||||
|
||||
//cleanup before running the test.
|
||||
_ = os.Remove("/tmp/test-file")
|
||||
})
|
||||
Reference in New Issue
Block a user