@@ -236,6 +236,36 @@ var _ = Describe("ocicni operations", func() {
236
236
ocicni .Shutdown ()
237
237
})
238
238
239
+ It ("should monitor the conf dir for changes" , func () {
240
+ _ , _ , err := writeConfig (tmpDir , "5-notdefault.conf" , "notdefault" , "myplugin" , "0.3.1" )
241
+ Expect (err ).NotTo (HaveOccurred ())
242
+ _ , _ , err = writeConfig (tmpDir , "10-test.conf" , "test" , "myplugin" , "0.3.1" )
243
+ Expect (err ).NotTo (HaveOccurred ())
244
+
245
+ ocicni , err := initCNI (& fakeExec {}, "" , "test" , tmpDir , false , "/opt/cni/bin" )
246
+ Expect (err ).NotTo (HaveOccurred ())
247
+ Expect (ocicni .Status ()).NotTo (HaveOccurred ())
248
+
249
+ // Ensure the default network is the one we expect
250
+ tmp := ocicni .(* cniNetworkPlugin )
251
+ net := tmp .getDefaultNetwork ()
252
+ Expect (net .name ).To (Equal ("test" ))
253
+ Expect (len (net .config .Plugins )).To (BeNumerically (">" , 0 ))
254
+ Expect (net .config .Plugins [0 ].Network .Type ).To (Equal ("myplugin" ))
255
+
256
+ _ , _ , err = writeConfig (tmpDir , "10-test.conf" , "update" , "testplugin" , "0.3.1" )
257
+ Expect (err ).NotTo (HaveOccurred ())
258
+
259
+ // Ensure the default network is the updated one
260
+ tmp = ocicni .(* cniNetworkPlugin )
261
+ net = tmp .getDefaultNetwork ()
262
+ Expect (net .name ).To (Equal ("update" ))
263
+ Expect (len (net .config .Plugins )).To (BeNumerically (">" , 0 ))
264
+ Expect (net .config .Plugins [0 ].Network .Type ).To (Equal ("testplugin" ))
265
+
266
+ ocicni .Shutdown ()
267
+ })
268
+
239
269
It ("finds an asynchronously written default network configuration" , func () {
240
270
ocicni , err := initCNI (& fakeExec {}, "" , "test" , tmpDir , true , "/opt/cni/bin" )
241
271
Expect (err ).NotTo (HaveOccurred ())
0 commit comments