From 8f9d95694b22e79261e8edbbae2693fd205f33dc Mon Sep 17 00:00:00 2001 From: hamistao Date: Thu, 9 Jan 2025 23:19:11 -0300 Subject: [PATCH] integration/test_containers: Give containers some time before exec Signed-off-by: hamistao --- integration/test_containers.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/integration/test_containers.py b/integration/test_containers.py index 13619c5e..ca820ef4 100644 --- a/integration/test_containers.py +++ b/integration/test_containers.py @@ -11,6 +11,7 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +import time import unittest from integration.testing import IntegrationTestCase @@ -145,6 +146,9 @@ def test_execute(self): """A command is executed on the container.""" self.container.start(wait=True) self.addCleanup(self.container.stop, wait=True) + time.sleep( + 1 + ) # Wait a little to make sure the container is ready to exec since it has just been started. result = self.container.execute(["echo", "test"]) @@ -156,6 +160,9 @@ def test_execute_no_buffer(self): """A command is executed on the container without buffering the output.""" self.container.start(wait=True) self.addCleanup(self.container.stop, wait=True) + time.sleep( + 1 + ) # Wait a little to make sure the container is ready to exec since it has just been started. buffer = [] result = self.container.execute(["echo", "test"], stdout_handler=buffer.append) @@ -169,6 +176,9 @@ def test_execute_no_decode(self): """A command is executed on the container that isn't utf-8 decodable""" self.container.start(wait=True) self.addCleanup(self.container.stop, wait=True) + time.sleep( + 1 + ) # Wait a little to make sure the container is ready to exec since it has just been started. result = self.container.execute(["printf", "\\xff"], decode=None) @@ -180,6 +190,9 @@ def test_execute_force_decode(self): """A command is executed and force output to ascii""" self.container.start(wait=True) self.addCleanup(self.container.stop, wait=True) + time.sleep( + 1 + ) # Wait a little to make sure the container is ready to exec since it has just been started. result = self.container.execute( ["printf", "qu\\xe9"], decode=True, encoding="latin1" @@ -193,6 +206,9 @@ def test_execute_pipes(self): """A command receives data from stdin and write to stdout handler""" self.container.start(wait=True) self.addCleanup(self.container.stop, wait=True) + time.sleep( + 1 + ) # Wait a little to make sure the container is ready to exec since it has just been started. test_msg = "Hello world!\n" stdout_msgs = []