diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2019-01-17 13:46:04 -0500 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2019-01-18 10:59:28 -0500 |
commit | a8713ed27006138c36bd917fdfadbf6ed32b3bac (patch) | |
tree | caf05cc3582108ecc695c65d3b7a42a37c1d2709 /tests | |
parent | 42a2fe3c2e22885ddc6a7f43f4a735100e886c99 (diff) | |
download | buildstream-a8713ed27006138c36bd917fdfadbf6ed32b3bac.tar.gz |
testutils/runcli.py: Added cli.get_element_states()
With get_element_state(), you need to invoke BuildStream once
for every element state you want to observe in a pipeline.
The new get_element_states() reports a dictionary with
the element state hashed by element name and is better to use
if you have more than one element to observe the state of.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testutils/runcli.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/testutils/runcli.py b/tests/testutils/runcli.py index 770f6289a..d3f5113a0 100644 --- a/tests/testutils/runcli.py +++ b/tests/testutils/runcli.py @@ -375,6 +375,9 @@ class Cli(): # Fetch an element state by name by # invoking bst show on the project with the CLI # + # If you need to get the states of multiple elements, + # then use get_element_states(s) instead. + # def get_element_state(self, project, element_name): result = self.run(project=project, silent=True, args=[ 'show', @@ -385,6 +388,25 @@ class Cli(): result.assert_success() return result.output.strip() + # Fetch the states of elements for a given target / deps + # + # Returns a dictionary with the element names as keys + # + def get_element_states(self, project, target, deps='all'): + result = self.run(project=project, silent=True, args=[ + 'show', + '--deps', deps, + '--format', '%{name}||%{state}', + target + ]) + result.assert_success() + lines = result.output.splitlines() + states = {} + for line in lines: + split = line.split(sep='||') + states[split[0]] = split[1] + return states + # Fetch an element's cache key by invoking bst show # on the project with the CLI # |