Skip to content

Commit 6503cb7

Browse files
Long Nguyendanielfor
authored andcommitted
Updating bpm to runc v1.1.0
- With the new release of runc 1.1.0 there were a couple of adjustments to be done in bpm: 1. An error message text changed in the event of a non existent container, adjusted tests and code according to the new text. 2. In the event of open files limit being reached at startup, runc failed asynchronously before, making bpm fail asynchronously. Now failures are immediate. [#180789274] Signed-off-by: Daniel Felipe Ochoa <danielfelipo@vmware.com>
1 parent 0d882cf commit 6503cb7

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

src/bpm/integration/resource_limits_test.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,8 @@ var _ = Describe("resource limits", func() {
144144
session, err := gexec.Start(command, GinkgoWriter, GinkgoWriter)
145145
Expect(err).NotTo(HaveOccurred())
146146
<-session.Exited
147-
Expect(session).To(gexec.Exit(0))
148-
149-
Eventually(func() specs.ContainerState { return runcState(runcRoot, containerID).Status }).Should(Equal(specs.StateRunning))
150-
Expect(runcCommand(runcRoot, "kill", containerID).Run()).To(Succeed())
151-
Eventually(fileContents(stderr)).Should(ContainSubstring("Too many open files"))
147+
Expect(session).To(gexec.Exit(1))
148+
Eventually(fileContents(stderr)).Should(ContainSubstring("too many open files"))
152149
})
153150
})
154151

src/bpm/runc/client/client.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"os"
2323
"os/exec"
2424
"path/filepath"
25-
"regexp"
25+
"strings"
2626
"syscall"
2727

2828
specs "github.com/opencontainers/runtime-spec/specs-go"
@@ -182,8 +182,7 @@ func decodeContainerStateErr(b []byte, err error) error {
182182
if e != nil {
183183
return err
184184
}
185-
r := regexp.MustCompile(`\s*container "[^"]*" does not exist\s*`)
186-
if r.MatchString(jsonErr.Msg) {
185+
if strings.Contains(jsonErr.Msg, "container does not exist") {
187186
return nil
188187
}
189188
return err

src/bpm/runc/client/client_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ fi
276276
Context("when the error message indicates the container is not running", func() {
277277
BeforeEach(func() {
278278
contents := []byte(`#!/bin/sh
279-
echo -n '{"msg": "container \"foo\" does not exist"}'
279+
echo -n '{"msg": "container does not exist"}'
280280
exit 1
281281
`)
282282

@@ -295,7 +295,7 @@ exit 1
295295
BeforeEach(func() {
296296
// Note the echo also purposefully prints a newline as well as spaces
297297
contents := []byte(`#!/bin/sh
298-
echo ' {"msg":"container \"foo\" does not exist"} '
298+
echo ' {"msg":"container does not exist"} '
299299
exit 1
300300
`)
301301

0 commit comments

Comments
 (0)