@@ -301,4 +301,133 @@ Removed:
301301 Expect (volInspect2 ).Should (ExitCleanly ())
302302 Expect (volInspect2 .OutputToString ()).To (ContainSubstring ("3" ))
303303 })
304+
305+ It ("unrelated command after refresh does not log plugin errors for plugin volumes" , func () {
306+ podmanTest .AddImageToRWStore (volumeTest )
307+
308+ pluginStatePath := filepath .Join (podmanTest .TempDir , "volumes" )
309+ err := os .Mkdir (pluginStatePath , 0o755 )
310+ Expect (err ).ToNot (HaveOccurred ())
311+
312+ pluginName := "testvol7"
313+ ctrName := "pluginCtrRefresh"
314+ plugin := podmanTest .Podman ([]string {
315+ "run" , "--name" , ctrName , "--security-opt" , "label=disable" ,
316+ "-v" , "/run/docker/plugins:/run/docker/plugins" ,
317+ "-v" , fmt .Sprintf ("%v:%v" , pluginStatePath , pluginStatePath ),
318+ "-d" , volumeTest , "--sock-name" , pluginName , "--path" , pluginStatePath ,
319+ })
320+ plugin .WaitWithDefaultTimeout ()
321+ Expect (plugin ).Should (ExitCleanly ())
322+
323+ err = WaitForFile (fmt .Sprintf ("/run/docker/plugins/%s.sock" , pluginName ))
324+ Expect (err ).ToNot (HaveOccurred ())
325+
326+ vol1 := "refreshVol1-" + stringid .GenerateRandomID ()
327+ vol2 := "refreshVol2-" + stringid .GenerateRandomID ()
328+ create1 := podmanTest .Podman ([]string {"volume" , "create" , "--driver" , pluginName , vol1 })
329+ create1 .WaitWithDefaultTimeout ()
330+ Expect (create1 ).Should (ExitCleanly ())
331+ create2 := podmanTest .Podman ([]string {"volume" , "create" , "--driver" , pluginName , vol2 })
332+ create2 .WaitWithDefaultTimeout ()
333+ Expect (create2 ).Should (ExitCleanly ())
334+
335+ // Create the libpod alive file (runtime already initialized).
336+ init := podmanTest .Podman ([]string {"volume" , "ls" , "-q" })
337+ init .WaitWithDefaultTimeout ()
338+ Expect (init ).Should (ExitCleanly ())
339+
340+ podmanTest .StopContainer (ctrName )
341+
342+ alivePath := filepath .Join (podmanTest .TmpDir , "alive" )
343+ err = os .Remove (alivePath )
344+ Expect (err ).ToNot (HaveOccurred ())
345+
346+ netName := "refresh-net-" + stringid .GenerateRandomID ()
347+ session := podmanTest .Podman ([]string {"--log-level=error" , "network" , "create" , netName })
348+ session .WaitWithDefaultTimeout ()
349+ Expect (session .ExitCode ()).To (Equal (0 ))
350+ Expect (session .ErrorToString ()).NotTo (ContainSubstring ("some functionality may not be available" ))
351+ Expect (session .ErrorToString ()).NotTo (ContainSubstring ("uses volume plugin" ))
352+
353+ cleanup := podmanTest .Podman ([]string {"network" , "rm" , netName })
354+ cleanup .WaitWithDefaultTimeout ()
355+ Expect (cleanup ).Should (ExitCleanly ())
356+ })
357+
358+ It ("volume inspect with stopped plugin errors without finalize spam" , func () {
359+ podmanTest .AddImageToRWStore (volumeTest )
360+
361+ pluginStatePath := filepath .Join (podmanTest .TempDir , "volumes" )
362+ err := os .Mkdir (pluginStatePath , 0o755 )
363+ Expect (err ).ToNot (HaveOccurred ())
364+
365+ pluginName := "testvol8"
366+ ctrName := "pluginCtrInspect"
367+ plugin := podmanTest .Podman ([]string {
368+ "run" , "--name" , ctrName , "--security-opt" , "label=disable" ,
369+ "-v" , "/run/docker/plugins:/run/docker/plugins" ,
370+ "-v" , fmt .Sprintf ("%v:%v" , pluginStatePath , pluginStatePath ),
371+ "-d" , volumeTest , "--sock-name" , pluginName , "--path" , pluginStatePath ,
372+ })
373+ plugin .WaitWithDefaultTimeout ()
374+ Expect (plugin ).Should (ExitCleanly ())
375+
376+ err = WaitForFile (fmt .Sprintf ("/run/docker/plugins/%s.sock" , pluginName ))
377+ Expect (err ).ToNot (HaveOccurred ())
378+
379+ volName := "inspectVol-" + stringid .GenerateRandomID ()
380+ create := podmanTest .Podman ([]string {"volume" , "create" , "--driver" , pluginName , volName })
381+ create .WaitWithDefaultTimeout ()
382+ Expect (create ).Should (ExitCleanly ())
383+
384+ init := podmanTest .Podman ([]string {"volume" , "ls" , "-q" })
385+ init .WaitWithDefaultTimeout ()
386+ Expect (init ).Should (ExitCleanly ())
387+
388+ podmanTest .StopContainer (ctrName )
389+
390+ inspect := podmanTest .Podman ([]string {"volume" , "inspect" , volName })
391+ inspect .WaitWithDefaultTimeout ()
392+ Expect (inspect ).To (ExitWithErrorRegex (125 , "cannot inspect" ))
393+ Expect (inspect .ErrorToString ()).NotTo (ContainSubstring ("some functionality may not be available" ))
394+ })
395+
396+ It ("volume ls with stopped plugin fails on inspect without finalize spam" , func () {
397+ podmanTest .AddImageToRWStore (volumeTest )
398+
399+ pluginStatePath := filepath .Join (podmanTest .TempDir , "volumes" )
400+ err := os .Mkdir (pluginStatePath , 0o755 )
401+ Expect (err ).ToNot (HaveOccurred ())
402+
403+ pluginName := "testvol9"
404+ ctrName := "pluginCtrLs"
405+ plugin := podmanTest .Podman ([]string {
406+ "run" , "--name" , ctrName , "--security-opt" , "label=disable" ,
407+ "-v" , "/run/docker/plugins:/run/docker/plugins" ,
408+ "-v" , fmt .Sprintf ("%v:%v" , pluginStatePath , pluginStatePath ),
409+ "-d" , volumeTest , "--sock-name" , pluginName , "--path" , pluginStatePath ,
410+ })
411+ plugin .WaitWithDefaultTimeout ()
412+ Expect (plugin ).Should (ExitCleanly ())
413+
414+ err = WaitForFile (fmt .Sprintf ("/run/docker/plugins/%s.sock" , pluginName ))
415+ Expect (err ).ToNot (HaveOccurred ())
416+
417+ volName := "lsVol-" + stringid .GenerateRandomID ()
418+ create := podmanTest .Podman ([]string {"volume" , "create" , "--driver" , pluginName , volName })
419+ create .WaitWithDefaultTimeout ()
420+ Expect (create ).Should (ExitCleanly ())
421+
422+ init := podmanTest .Podman ([]string {"volume" , "ls" , "-q" })
423+ init .WaitWithDefaultTimeout ()
424+ Expect (init ).Should (ExitCleanly ())
425+
426+ podmanTest .StopContainer (ctrName )
427+
428+ ls := podmanTest .Podman ([]string {"--log-level=error" , "volume" , "ls" , "-q" })
429+ ls .WaitWithDefaultTimeout ()
430+ Expect (ls ).To (ExitWithErrorRegex (125 , "cannot inspect" ))
431+ Expect (ls .ErrorToString ()).NotTo (ContainSubstring ("some functionality may not be available" ))
432+ })
304433})
0 commit comments