Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 36 additions & 5 deletions src/tests/ftest/container/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

SPDX-License-Identifier: BSD-2-Clause-Patent
'''
import queue
import threading

from apricot import TestWithServers


Expand All @@ -20,6 +23,22 @@ class ListContainerTest(TestWithServers):

:avocado: recursive
"""
def __container_create(self, pool, result_queue):
"""
Create a container in the given pool and put the result in the result queue.

Args:
pool (TestPool): The pool in which to create the container.
result_queue (queue.Queue): Queue to store the result of the container creation.
"""
try:
container = self.get_container(pool, create=False)
container.silent.value = True
result = container.create()
result_queue.put(
(result["response"]["container_uuid"], result["response"]["container_label"]))
except Exception as error: # pylint: disable=broad-except
result_queue.put(error)

def create_list(self, count, pool, expected_uuids_labels):
"""Create container and call daos pool list-cont to list and verify.
Expand All @@ -30,12 +49,24 @@ def create_list(self, count, pool, expected_uuids_labels):
expected_uuids_labels (list): list of tuples containing expected (uuid, label) for
all containers in the pool
"""
# Create containers and store the container UUIDs and labels
result_queue = queue.Queue()

# Create containers in parallel and store the container UUIDs and labels
threads = []
for _ in range(count):
container = self.get_container(pool, create=False)
result = container.create()
expected_uuids_labels.append(
(result["response"]["container_uuid"], result["response"]["container_label"]))
thread = threading.Thread(target=self.__container_create, args=(pool, result_queue))
thread.start()
threads.append(thread)

for thread in threads:
thread.join()

while not result_queue.empty():
result = result_queue.get()
if isinstance(result, Exception):
self.fail(f"Container creation failed with error: {result}")
expected_uuids_labels.append(result)

expected_uuids_labels.sort()

# Call container list and collect the UUIDs.
Expand Down
2 changes: 1 addition & 1 deletion src/tests/ftest/container/list.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ hosts:
test_servers: 1
test_clients: 1

timeout: 480
timeout: 420

server_config:
name: daos_server
Expand Down
Loading