mirror of
https://github.com/containers/podman.git
synced 2025-05-18 15:47:51 +08:00
Inline PodmanBase into callers
Eliminate this helper / indirection, and pass around PodmanExecOptions explicitly. Should not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
@ -441,7 +441,10 @@ func (p *PodmanTestIntegration) pullImage(image string, toCache bool) {
|
|||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
for try := 0; try < 3; try++ {
|
for try := 0; try < 3; try++ {
|
||||||
podmanSession := p.PodmanBase([]string{"pull", image}, toCache, true)
|
podmanSession := p.PodmanExecBaseWithOptions([]string{"pull", image}, PodmanExecOptions{
|
||||||
|
NoEvents: toCache,
|
||||||
|
NoCache: true,
|
||||||
|
})
|
||||||
pull := PodmanSessionIntegration{podmanSession}
|
pull := PodmanSessionIntegration{podmanSession}
|
||||||
pull.Wait(440)
|
pull.Wait(440)
|
||||||
if pull.ExitCode() == 0 {
|
if pull.ExitCode() == 0 {
|
||||||
@ -1124,7 +1127,9 @@ func rmAll(podmanBin string, path string) {
|
|||||||
|
|
||||||
// PodmanNoCache calls the podman command with no configured imagecache
|
// PodmanNoCache calls the podman command with no configured imagecache
|
||||||
func (p *PodmanTestIntegration) PodmanNoCache(args []string) *PodmanSessionIntegration {
|
func (p *PodmanTestIntegration) PodmanNoCache(args []string) *PodmanSessionIntegration {
|
||||||
podmanSession := p.PodmanBase(args, false, true)
|
podmanSession := p.PodmanExecBaseWithOptions(args, PodmanExecOptions{
|
||||||
|
NoCache: true,
|
||||||
|
})
|
||||||
return &PodmanSessionIntegration{podmanSession}
|
return &PodmanSessionIntegration{podmanSession}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1135,7 +1140,10 @@ func PodmanTestSetup(tempDir string) *PodmanTestIntegration {
|
|||||||
// PodmanNoEvents calls the Podman command without an imagecache and without an
|
// PodmanNoEvents calls the Podman command without an imagecache and without an
|
||||||
// events backend. It is used mostly for caching and uncaching images.
|
// events backend. It is used mostly for caching and uncaching images.
|
||||||
func (p *PodmanTestIntegration) PodmanNoEvents(args []string) *PodmanSessionIntegration {
|
func (p *PodmanTestIntegration) PodmanNoEvents(args []string) *PodmanSessionIntegration {
|
||||||
podmanSession := p.PodmanBase(args, true, true)
|
podmanSession := p.PodmanExecBaseWithOptions(args, PodmanExecOptions{
|
||||||
|
NoEvents: true,
|
||||||
|
NoCache: true,
|
||||||
|
})
|
||||||
return &PodmanSessionIntegration{podmanSession}
|
return &PodmanSessionIntegration{podmanSession}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ func IsRemote() bool {
|
|||||||
// Podman is the exec call to podman on the filesystem
|
// Podman is the exec call to podman on the filesystem
|
||||||
func (p *PodmanTestIntegration) Podman(args []string) *PodmanSessionIntegration {
|
func (p *PodmanTestIntegration) Podman(args []string) *PodmanSessionIntegration {
|
||||||
args = p.makeOptions(args, PodmanExecOptions{})
|
args = p.makeOptions(args, PodmanExecOptions{})
|
||||||
podmanSession := p.PodmanBase(args, false, false)
|
podmanSession := p.PodmanExecBaseWithOptions(args, PodmanExecOptions{})
|
||||||
return &PodmanSessionIntegration{podmanSession}
|
return &PodmanSessionIntegration{podmanSession}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ func IsRemote() bool {
|
|||||||
|
|
||||||
// Podman is the exec call to podman on the filesystem
|
// Podman is the exec call to podman on the filesystem
|
||||||
func (p *PodmanTestIntegration) Podman(args []string) *PodmanSessionIntegration {
|
func (p *PodmanTestIntegration) Podman(args []string) *PodmanSessionIntegration {
|
||||||
podmanSession := p.PodmanBase(args, false, false)
|
podmanSession := p.PodmanExecBaseWithOptions(args, PodmanExecOptions{})
|
||||||
return &PodmanSessionIntegration{podmanSession}
|
return &PodmanSessionIntegration{podmanSession}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,14 +157,6 @@ func (p *PodmanTest) PodmanExecBaseWithOptions(args []string, options PodmanExec
|
|||||||
return &PodmanSession{session}
|
return &PodmanSession{session}
|
||||||
}
|
}
|
||||||
|
|
||||||
// PodmanBase exec podman with default env.
|
|
||||||
func (p *PodmanTest) PodmanBase(args []string, noEvents, noCache bool) *PodmanSession {
|
|
||||||
return p.PodmanExecBaseWithOptions(args, PodmanExecOptions{
|
|
||||||
NoEvents: noEvents,
|
|
||||||
NoCache: noCache,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// WaitForContainer waits on a started container
|
// WaitForContainer waits on a started container
|
||||||
func (p *PodmanTest) WaitForContainer() bool {
|
func (p *PodmanTest) WaitForContainer() bool {
|
||||||
for i := 0; i < 10; i++ {
|
for i := 0; i < 10; i++ {
|
||||||
@ -181,7 +173,9 @@ func (p *PodmanTest) WaitForContainer() bool {
|
|||||||
// containers are currently running.
|
// containers are currently running.
|
||||||
func (p *PodmanTest) NumberOfContainersRunning() int {
|
func (p *PodmanTest) NumberOfContainersRunning() int {
|
||||||
var containers []string
|
var containers []string
|
||||||
ps := p.PodmanBase([]string{"ps", "-q"}, false, true)
|
ps := p.PodmanExecBaseWithOptions([]string{"ps", "-q"}, PodmanExecOptions{
|
||||||
|
NoCache: true,
|
||||||
|
})
|
||||||
ps.WaitWithDefaultTimeout()
|
ps.WaitWithDefaultTimeout()
|
||||||
Expect(ps).Should(Exit(0))
|
Expect(ps).Should(Exit(0))
|
||||||
for _, i := range ps.OutputToStringArray() {
|
for _, i := range ps.OutputToStringArray() {
|
||||||
@ -196,7 +190,9 @@ func (p *PodmanTest) NumberOfContainersRunning() int {
|
|||||||
// containers are currently defined.
|
// containers are currently defined.
|
||||||
func (p *PodmanTest) NumberOfContainers() int {
|
func (p *PodmanTest) NumberOfContainers() int {
|
||||||
var containers []string
|
var containers []string
|
||||||
ps := p.PodmanBase([]string{"ps", "-aq"}, false, true)
|
ps := p.PodmanExecBaseWithOptions([]string{"ps", "-aq"}, PodmanExecOptions{
|
||||||
|
NoCache: true,
|
||||||
|
})
|
||||||
ps.WaitWithDefaultTimeout()
|
ps.WaitWithDefaultTimeout()
|
||||||
Expect(ps.ExitCode()).To(Equal(0))
|
Expect(ps.ExitCode()).To(Equal(0))
|
||||||
for _, i := range ps.OutputToStringArray() {
|
for _, i := range ps.OutputToStringArray() {
|
||||||
@ -211,7 +207,9 @@ func (p *PodmanTest) NumberOfContainers() int {
|
|||||||
// pods are currently defined.
|
// pods are currently defined.
|
||||||
func (p *PodmanTest) NumberOfPods() int {
|
func (p *PodmanTest) NumberOfPods() int {
|
||||||
var pods []string
|
var pods []string
|
||||||
ps := p.PodmanBase([]string{"pod", "ps", "-q"}, false, true)
|
ps := p.PodmanExecBaseWithOptions([]string{"pod", "ps", "-q"}, PodmanExecOptions{
|
||||||
|
NoCache: true,
|
||||||
|
})
|
||||||
ps.WaitWithDefaultTimeout()
|
ps.WaitWithDefaultTimeout()
|
||||||
Expect(ps.ExitCode()).To(Equal(0))
|
Expect(ps.ExitCode()).To(Equal(0))
|
||||||
for _, i := range ps.OutputToStringArray() {
|
for _, i := range ps.OutputToStringArray() {
|
||||||
@ -227,7 +225,9 @@ func (p *PodmanTest) NumberOfPods() int {
|
|||||||
func (p *PodmanTest) GetContainerStatus() string {
|
func (p *PodmanTest) GetContainerStatus() string {
|
||||||
var podmanArgs = []string{"ps"}
|
var podmanArgs = []string{"ps"}
|
||||||
podmanArgs = append(podmanArgs, "--all", "--format={{.Status}}")
|
podmanArgs = append(podmanArgs, "--all", "--format={{.Status}}")
|
||||||
session := p.PodmanBase(podmanArgs, false, true)
|
session := p.PodmanExecBaseWithOptions(podmanArgs, PodmanExecOptions{
|
||||||
|
NoCache: true,
|
||||||
|
})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
return session.OutputToString()
|
return session.OutputToString()
|
||||||
}
|
}
|
||||||
@ -235,7 +235,9 @@ func (p *PodmanTest) GetContainerStatus() string {
|
|||||||
// WaitContainerReady waits process or service inside container start, and ready to be used.
|
// WaitContainerReady waits process or service inside container start, and ready to be used.
|
||||||
func (p *PodmanTest) WaitContainerReady(id string, expStr string, timeout int, step int) bool {
|
func (p *PodmanTest) WaitContainerReady(id string, expStr string, timeout int, step int) bool {
|
||||||
startTime := time.Now()
|
startTime := time.Now()
|
||||||
s := p.PodmanBase([]string{"logs", id}, false, true)
|
s := p.PodmanExecBaseWithOptions([]string{"logs", id}, PodmanExecOptions{
|
||||||
|
NoCache: true,
|
||||||
|
})
|
||||||
s.WaitWithDefaultTimeout()
|
s.WaitWithDefaultTimeout()
|
||||||
|
|
||||||
for {
|
for {
|
||||||
@ -248,7 +250,9 @@ func (p *PodmanTest) WaitContainerReady(id string, expStr string, timeout int, s
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
time.Sleep(time.Duration(step) * time.Second)
|
time.Sleep(time.Duration(step) * time.Second)
|
||||||
s = p.PodmanBase([]string{"logs", id}, false, true)
|
s = p.PodmanExecBaseWithOptions([]string{"logs", id}, PodmanExecOptions{
|
||||||
|
NoCache: true,
|
||||||
|
})
|
||||||
s.WaitWithDefaultTimeout()
|
s.WaitWithDefaultTimeout()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user