Skip to content

Commit

Permalink
Merge pull request #19182 from Luap99/slow-remote-version
Browse files Browse the repository at this point in the history
test/e2e: wait for socket
  • Loading branch information
openshift-merge-robot authored Jul 10, 2023
2 parents 7cd1fb7 + 97fd03c commit 79d3453
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 34 deletions.
35 changes: 12 additions & 23 deletions pkg/api/handlers/compat/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/containers/podman/v4/pkg/domain/entities"
"github.com/containers/podman/v4/pkg/domain/entities/types"
"github.com/containers/podman/v4/version"
"github.com/sirupsen/logrus"
)

func VersionHandler(w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -45,30 +44,20 @@ func VersionHandler(w http.ResponseWriter, r *http.Request) {
"MinAPIVersion": version.APIVersion[version.Libpod][version.MinimalAPI].String(),
"Os": goRuntime.GOOS,
},
}, {
Name: "Conmon",
Version: info.Host.Conmon.Version,
Details: map[string]string{
"Package": info.Host.Conmon.Package,
},
}, {
Name: fmt.Sprintf("OCI Runtime (%s)", info.Host.OCIRuntime.Name),
Version: info.Host.OCIRuntime.Version,
Details: map[string]string{
"Package": info.Host.OCIRuntime.Package,
},
}}

if conmon, oci, err := runtime.DefaultOCIRuntime().RuntimeInfo(); err != nil {
logrus.Warnf("Failed to retrieve Conmon and OCI Information: %q", err.Error())
} else {
additional := []types.ComponentVersion{
{
Name: "Conmon",
Version: conmon.Version,
Details: map[string]string{
"Package": conmon.Package,
},
},
{
Name: fmt.Sprintf("OCI Runtime (%s)", oci.Name),
Version: oci.Version,
Details: map[string]string{
"Package": oci.Package,
},
},
}
components = append(components, additional...)
}

apiVersion := version.APIVersion[version.Compat][version.CurrentAPI]
minVersion := version.APIVersion[version.Compat][version.MinimalAPI]

Expand Down
1 change: 0 additions & 1 deletion test/e2e/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ type PodmanTestIntegration struct {
CgroupManager string
Host HostOS
TmpDir string
RemoteStartErr error
}

var LockTmpDir string
Expand Down
21 changes: 11 additions & 10 deletions test/e2e/libpod_suite_remote_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package integration
import (
"errors"
"fmt"
"net"
"os"
"os/exec"
"path/filepath"
Expand Down Expand Up @@ -94,7 +95,8 @@ func (p *PodmanTestIntegration) StartRemoteService() {
command.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
p.RemoteCommand = command
p.RemoteSession = command.Process
p.RemoteStartErr = p.DelayForService()
err = p.DelayForService()
Expect(err).ToNot(HaveOccurred())
}

func (p *PodmanTestIntegration) StopRemoteService() {
Expand Down Expand Up @@ -145,16 +147,15 @@ func (p *PodmanTestIntegration) RestoreArtifact(image string) error {
}

func (p *PodmanTestIntegration) DelayForService() error {
var session *PodmanSessionIntegration
for i := 0; i < 5; i++ {
session = p.Podman([]string{"info"})
session.WaitWithDefaultTimeout()
if session.ExitCode() == 0 {
var err error
var conn net.Conn
for i := 0; i < 100; i++ {
conn, err = net.Dial("unix", strings.TrimPrefix(p.RemoteSocket, "unix:"))
if err == nil {
conn.Close()
return nil
} else if i == 4 {
break
}
time.Sleep(2 * time.Second)
time.Sleep(100 * time.Millisecond)
}
return fmt.Errorf("service not detected, exit code(%d)", session.ExitCode())
return fmt.Errorf("service socket not detected, timeout after 10 seconds: %w", err)
}

0 comments on commit 79d3453

Please sign in to comment.