@@ -40,6 +40,8 @@ var _ = Describe("RuncAdapter", func() {
4040 procName ,
4141 systemRoot string
4242 user specs.User
43+
44+ cfg * bpm.Config
4345 )
4446
4547 BeforeEach (func () {
@@ -52,6 +54,13 @@ var _ = Describe("RuncAdapter", func() {
5254 var err error
5355 systemRoot , err = ioutil .TempDir ("" , "runc-adapter-system-files" )
5456 Expect (err ).NotTo (HaveOccurred ())
57+
58+ cfg = & bpm.Config {
59+ Volumes : []string {
60+ filepath .Join (systemRoot , "some" , "directory" ),
61+ filepath .Join (systemRoot , "another" , "location" ),
62+ },
63+ }
5564 })
5665
5766 AfterEach (func () {
@@ -60,7 +69,7 @@ var _ = Describe("RuncAdapter", func() {
6069
6170 Describe ("CreateJobPrerequisites" , func () {
6271 It ("creates the job prerequisites" , func () {
63- pidDir , stdout , stderr , err := runcAdapter .CreateJobPrerequisites (systemRoot , jobName , procName , user )
72+ pidDir , stdout , stderr , err := runcAdapter .CreateJobPrerequisites (systemRoot , jobName , procName , cfg , user )
6473 Expect (err ).NotTo (HaveOccurred ())
6574
6675 logDir := filepath .Join (systemRoot , "sys" , "log" , jobName )
@@ -100,12 +109,19 @@ var _ = Describe("RuncAdapter", func() {
100109 Expect (dataDirInfo .Mode () & os .ModePerm ).To (Equal (os .FileMode (0700 )))
101110 Expect (dataDirInfo .Sys ().(* syscall.Stat_t ).Uid ).To (Equal (uint32 (200 )))
102111 Expect (dataDirInfo .Sys ().(* syscall.Stat_t ).Gid ).To (Equal (uint32 (300 )))
112+
113+ //Volumes
114+ for _ , vol := range cfg .Volumes {
115+ volDirInfo , err := os .Stat (vol )
116+ Expect (err ).NotTo (HaveOccurred ())
117+ Expect (volDirInfo .Mode () & os .ModePerm ).To (Equal (os .FileMode (0700 )))
118+ Expect (volDirInfo .Sys ().(* syscall.Stat_t ).Uid ).To (Equal (uint32 (200 )))
119+ Expect (volDirInfo .Sys ().(* syscall.Stat_t ).Gid ).To (Equal (uint32 (300 )))
120+ }
103121 })
104122 })
105123
106124 Describe ("BuildSpec" , func () {
107- var cfg * bpm.Config
108-
109125 BeforeEach (func () {
110126 cfg = & bpm.Config {
111127 Executable : "/var/vcap/packages/example/bin/example" ,
@@ -117,6 +133,10 @@ var _ = Describe("RuncAdapter", func() {
117133 "RAVE=true" ,
118134 "ONE=two" ,
119135 },
136+ Volumes : []string {
137+ "/path/to/volume/1" ,
138+ "/path/to/volume/2" ,
139+ },
120140 }
121141 })
122142
@@ -246,6 +266,18 @@ var _ = Describe("RuncAdapter", func() {
246266 Source : filepath .Join (systemRoot , "sys" , "log" , jobName ),
247267 Options : []string {"rbind" , "rw" },
248268 },
269+ {
270+ Destination : "/path/to/volume/1" ,
271+ Type : "bind" ,
272+ Source : "/path/to/volume/1" ,
273+ Options : []string {"rbind" , "rw" },
274+ },
275+ {
276+ Destination : "/path/to/volume/2" ,
277+ Type : "bind" ,
278+ Source : "/path/to/volume/2" ,
279+ Options : []string {"rbind" , "rw" },
280+ },
249281 }))
250282
251283 Expect (spec .Linux .RootfsPropagation ).To (Equal ("private" ))
0 commit comments