Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
dc20f64d
Unverified
Commit
dc20f64d
authored
Feb 12, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Feb 12, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #73523 from pontiyaraja/shared_volumes
test case for shared volumes between the containers in pod
parents
41d2445f
6d7a7073
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
74 additions
and
0 deletions
+74
-0
empty_dir.go
test/e2e/common/empty_dir.go
+74
-0
No files found.
test/e2e/common/empty_dir.go
View file @
dc20f64d
...
...
@@ -19,6 +19,7 @@ package common
import
(
"fmt"
"path"
"time"
.
"github.com/onsi/ginkgo"
"k8s.io/api/core/v1"
...
...
@@ -205,6 +206,79 @@ var _ = Describe("[sig-storage] EmptyDir volumes", func() {
framework
.
ConformanceIt
(
"should support (non-root,0777,default) [LinuxOnly] [NodeConformance]"
,
func
()
{
doTest0777
(
f
,
testImageNonRootUid
,
v1
.
StorageMediumDefault
)
})
It
(
"pod should support shared volumes between containers"
,
func
()
{
var
(
volumeName
=
"shared-data"
busyBoxMainVolumeMountPath
=
"/usr/share/volumeshare"
busyBoxSubVolumeMountPath
=
"/pod-data"
busyBoxMainVolumeFilePath
=
fmt
.
Sprintf
(
"%s/shareddata.txt"
,
busyBoxMainVolumeMountPath
)
busyBoxSubVolumeFilePath
=
fmt
.
Sprintf
(
"%s/shareddata.txt"
,
busyBoxSubVolumeMountPath
)
message
=
"Hello from the busy-box sub-container"
busyBoxMainContainerName
=
"busybox-main-container"
busyBoxSubContainerName
=
"busybox-sub-container"
resultString
=
""
)
pod
:=
&
v1
.
Pod
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"pod-sharedvolume-"
+
string
(
uuid
.
NewUUID
()),
},
Spec
:
v1
.
PodSpec
{
Volumes
:
[]
v1
.
Volume
{
{
Name
:
volumeName
,
VolumeSource
:
v1
.
VolumeSource
{
EmptyDir
:
new
(
v1
.
EmptyDirVolumeSource
),
},
},
},
Containers
:
[]
v1
.
Container
{
{
Name
:
busyBoxMainContainerName
,
Image
:
imageutils
.
GetE2EImage
(
imageutils
.
BusyBox
),
Command
:
[]
string
{
"/bin/sh"
},
Args
:
[]
string
{
"-c"
,
"sleep 10"
},
VolumeMounts
:
[]
v1
.
VolumeMount
{
{
Name
:
volumeName
,
MountPath
:
busyBoxMainVolumeMountPath
,
},
},
},
{
Name
:
busyBoxSubContainerName
,
Image
:
imageutils
.
GetE2EImage
(
imageutils
.
BusyBox
),
Command
:
[]
string
{
"/bin/sh"
},
Args
:
[]
string
{
"-c"
,
fmt
.
Sprintf
(
"echo %s > %s"
,
message
,
busyBoxSubVolumeFilePath
)},
VolumeMounts
:
[]
v1
.
VolumeMount
{
{
Name
:
volumeName
,
MountPath
:
busyBoxSubVolumeMountPath
,
},
},
},
},
RestartPolicy
:
v1
.
RestartPolicyNever
,
},
}
var
err
error
By
(
"Creating Pod"
)
pod
=
f
.
PodClient
()
.
CreateSync
(
pod
)
By
(
"Waiting for the pod running"
)
err
=
f
.
WaitForPodRunning
(
pod
.
Name
)
framework
.
ExpectNoError
(
err
,
"failed to deploy pod %s"
,
pod
.
Name
)
By
(
"Geting the pod"
)
pod
,
err
=
f
.
PodClient
()
.
Get
(
pod
.
Name
,
metav1
.
GetOptions
{})
framework
.
ExpectNoError
(
err
,
"failed to get pod %s"
,
pod
.
Name
)
By
(
"Reading file content from the nginx-container"
)
resultString
,
err
=
framework
.
LookForStringInFile
(
f
.
Namespace
.
Name
,
pod
.
Name
,
busyBoxMainContainerName
,
busyBoxMainVolumeFilePath
,
message
,
30
*
time
.
Second
)
framework
.
ExpectNoError
(
err
,
"failed to match expected string %s with %s"
,
message
,
resultString
)
})
})
const
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment