mirror of
https://github.com/containers/podman
synced 2024-10-20 01:03:51 +00:00
Merge pull request #3848 from giuseppe/enable-all-tests-crun
tests: enable all tests for crun
This commit is contained in:
commit
b1acc43481
|
@ -371,6 +371,8 @@ testing_crun_task:
|
|||
networking_script: '${CIRRUS_WORKING_DIR}/${SCRIPT_BASE}/networking.sh'
|
||||
setup_environment_script: '$SCRIPT_BASE/setup_environment.sh |& ${TIMESTAMP}'
|
||||
install_crun_script: 'dnf install -y crun'
|
||||
# FIXME: use the package once all the fixes are in a release
|
||||
override_crun_script: 'setenforce 0; yum builddep -y crun && (git clone --depth=1 https://github.com/containers/crun && cd crun && ./autogen.sh && ./configure --prefix=/usr && make -j4 && make install) && rm -rf crun'
|
||||
unit_test_script: '$SCRIPT_BASE/unit_test.sh |& ${TIMESTAMP}'
|
||||
integration_test_script: '$SCRIPT_BASE/integration_test.sh |& ${TIMESTAMP}'
|
||||
system_test_script: '$SCRIPT_BASE/system_test.sh |& ${TIMESTAMP}'
|
||||
|
|
|
@ -120,7 +120,7 @@ runtime = "runc"
|
|||
|
||||
# List of the OCI runtimes that support --format=json. When json is supported
|
||||
# libpod will use it for reporting nicer errors.
|
||||
runtime_supports_json = ["runc"]
|
||||
runtime_supports_json = ["crun", "runc"]
|
||||
|
||||
# Paths to look for a valid OCI runtime (runc, runv, etc)
|
||||
# If the paths are empty or no valid path was found, then the `$PATH`
|
||||
|
|
|
@ -449,6 +449,15 @@ func readConmonPipeData(pipe *os.File, ociLog string) (int, error) {
|
|||
select {
|
||||
case ss := <-ch:
|
||||
if ss.err != nil {
|
||||
if ociLog != "" {
|
||||
ociLogData, err := ioutil.ReadFile(ociLog)
|
||||
if err == nil {
|
||||
var ociErr ociError
|
||||
if err := json.Unmarshal(ociLogData, &ociErr); err == nil {
|
||||
return -1, getOCIRuntimeError(ociErr.Msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1, errors.Wrapf(ss.err, "error reading container (probably exited) json message")
|
||||
}
|
||||
logrus.Debugf("Received: %d", ss.si.Data)
|
||||
|
@ -476,10 +485,11 @@ func readConmonPipeData(pipe *os.File, ociLog string) (int, error) {
|
|||
}
|
||||
|
||||
func getOCIRuntimeError(runtimeMsg string) error {
|
||||
if match, _ := regexp.MatchString(".*permission denied.*", runtimeMsg); match {
|
||||
r := strings.ToLower(runtimeMsg)
|
||||
if match, _ := regexp.MatchString(".*permission denied.*|.*operation not permitted.*", r); match {
|
||||
return errors.Wrapf(define.ErrOCIRuntimePermissionDenied, "%s", strings.Trim(runtimeMsg, "\n"))
|
||||
}
|
||||
if match, _ := regexp.MatchString(".*executable file not found in.*", runtimeMsg); match {
|
||||
if match, _ := regexp.MatchString(".*executable file not found in.*|.*no such file or directory.*", r); match {
|
||||
return errors.Wrapf(define.ErrOCIRuntimeNotFound, "%s", strings.Trim(runtimeMsg, "\n"))
|
||||
}
|
||||
return errors.Wrapf(define.ErrOCIRuntime, "%s", strings.Trim(runtimeMsg, "\n"))
|
||||
|
|
|
@ -342,7 +342,8 @@ func (r *LocalRuntime) Run(ctx context.Context, c *cliconfig.RunValues, exitCode
|
|||
if err := ctr.Start(ctx, c.IsSet("pod")); err != nil {
|
||||
// This means the command did not exist
|
||||
exitCode = 127
|
||||
if strings.Contains(err.Error(), "permission denied") || strings.Contains(err.Error(), "file not found") {
|
||||
e := strings.ToLower(err.Error())
|
||||
if strings.Contains(e, "permission denied") || strings.Contains(e, "operation not permitted") || strings.Contains(e, "file not found") || strings.Contains(e, "no such file or directory") {
|
||||
exitCode = 126
|
||||
}
|
||||
return exitCode, err
|
||||
|
@ -405,12 +406,13 @@ func (r *LocalRuntime) Run(ctx context.Context, c *cliconfig.RunValues, exitCode
|
|||
}
|
||||
// This means the command did not exist
|
||||
exitCode = 127
|
||||
if strings.Contains(err.Error(), "permission denied") {
|
||||
e := strings.ToLower(err.Error())
|
||||
if strings.Contains(e, "permission denied") || strings.Contains(e, "operation not permitted") {
|
||||
exitCode = 126
|
||||
}
|
||||
if c.IsSet("rm") {
|
||||
if deleteError := r.Runtime.RemoveContainer(ctx, ctr, true, false); deleteError != nil {
|
||||
logrus.Errorf("unable to remove container %s after failing to start and attach to it", ctr.ID())
|
||||
logrus.Debugf("unable to remove container %s after failing to start and attach to it", ctr.ID())
|
||||
}
|
||||
}
|
||||
return exitCode, err
|
||||
|
|
|
@ -171,16 +171,14 @@ var _ = Describe("Podman exec", func() {
|
|||
|
||||
session := podmanTest.Podman([]string{"exec", "--workdir", "/missing", "test1", "pwd"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(1))
|
||||
Expect(session.ExitCode()).To(Not(Equal(0)))
|
||||
|
||||
session = podmanTest.Podman([]string{"exec", "-w", "/missing", "test1", "pwd"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(1))
|
||||
Expect(session.ExitCode()).To(Not(Equal(0)))
|
||||
})
|
||||
|
||||
It("podman exec cannot be invoked", func() {
|
||||
SkipIfNotRunc()
|
||||
|
||||
setup := podmanTest.RunTopContainer("test1")
|
||||
setup.WaitWithDefaultTimeout()
|
||||
Expect(setup.ExitCode()).To(Equal(0))
|
||||
|
@ -191,8 +189,6 @@ var _ = Describe("Podman exec", func() {
|
|||
})
|
||||
|
||||
It("podman exec command not found", func() {
|
||||
SkipIfNotRunc()
|
||||
|
||||
setup := podmanTest.RunTopContainer("test1")
|
||||
setup.WaitWithDefaultTimeout()
|
||||
Expect(setup.ExitCode()).To(Equal(0))
|
||||
|
|
|
@ -28,13 +28,6 @@ func SkipIfRootless() {
|
|||
}
|
||||
}
|
||||
|
||||
func SkipIfNotRunc() {
|
||||
runtime := os.Getenv("OCI_RUNTIME")
|
||||
if runtime != "" && filepath.Base(runtime) != "runc" {
|
||||
ginkgo.Skip("Not using runc as runtime")
|
||||
}
|
||||
}
|
||||
|
||||
// Podman is the exec call to podman on the filesystem
|
||||
func (p *PodmanTestIntegration) Podman(args []string) *PodmanSessionIntegration {
|
||||
podmanSession := p.PodmanBase(args, false, false)
|
||||
|
|
|
@ -21,13 +21,6 @@ func SkipIfRootless() {
|
|||
}
|
||||
}
|
||||
|
||||
func SkipIfNotRunc() {
|
||||
runtime := os.Getenv("OCI_RUNTIME")
|
||||
if runtime != "" && filepath.Base(runtime) != "runc" {
|
||||
ginkgo.Skip("Not using runc as runtime")
|
||||
}
|
||||
}
|
||||
|
||||
// Podman is the exec call to podman on the filesystem
|
||||
func (p *PodmanTestIntegration) Podman(args []string) *PodmanSessionIntegration {
|
||||
podmanSession := p.PodmanBase(args, false, false)
|
||||
|
|
|
@ -41,16 +41,12 @@ var _ = Describe("Podman run exit", func() {
|
|||
})
|
||||
|
||||
It("podman run exit 126", func() {
|
||||
SkipIfNotRunc()
|
||||
|
||||
result := podmanTest.Podman([]string{"run", ALPINE, "/etc"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result.ExitCode()).To(Equal(126))
|
||||
})
|
||||
|
||||
It("podman run exit 127", func() {
|
||||
SkipIfNotRunc()
|
||||
|
||||
result := podmanTest.Podman([]string{"run", ALPINE, "foobar"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result.ExitCode()).To(Equal(127))
|
||||
|
|
|
@ -417,7 +417,6 @@ var _ = Describe("Podman run", func() {
|
|||
|
||||
It("podman run notify_socket", func() {
|
||||
SkipIfRemote()
|
||||
SkipIfNotRunc()
|
||||
|
||||
host := GetHostDistributionInfo()
|
||||
if host.Distribution != "rhel" && host.Distribution != "centos" && host.Distribution != "fedora" {
|
||||
|
@ -629,7 +628,6 @@ var _ = Describe("Podman run", func() {
|
|||
})
|
||||
|
||||
It("podman run exit code on failure to exec", func() {
|
||||
SkipIfNotRunc()
|
||||
session := podmanTest.Podman([]string{"run", ALPINE, "/etc"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(126))
|
||||
|
|
|
@ -101,8 +101,6 @@ var _ = Describe("Podman start", func() {
|
|||
})
|
||||
|
||||
It("podman failed to start with --rm should delete the container", func() {
|
||||
SkipIfNotRunc()
|
||||
|
||||
session := podmanTest.Podman([]string{"create", "-it", "--rm", ALPINE, "foo"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
|
@ -116,8 +114,6 @@ var _ = Describe("Podman start", func() {
|
|||
})
|
||||
|
||||
It("podman failed to start without --rm should NOT delete the container", func() {
|
||||
SkipIfNotRunc()
|
||||
|
||||
session := podmanTest.Podman([]string{"create", "-it", ALPINE, "foo"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
|
|
Loading…
Reference in a new issue