summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2019-01-13 13:52:55 -0500
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2019-01-16 14:28:14 -0500
commit04ba59bcedb2ff60187bd853667b2d26e7a5c06c (patch)
tree1a42ff48975553ea4ba7dcd7cdb6fa482fdd4ffd
parent6991d6d6f8519cb8a6188238d1735dca8536da81 (diff)
downloadbuildstream-04ba59bcedb2ff60187bd853667b2d26e7a5c06c.tar.gz
tests/frontend/order.py: Enable the test for build and fix the fetch tests
With the scheduler changes, fetch jobs get automatically skipped so the output is changed, using a separate repo for each element fixes the test such that every fetch job gets a job launched.
-rw-r--r--tests/frontend/order.py37
1 files changed, 19 insertions, 18 deletions
diff --git a/tests/frontend/order.py b/tests/frontend/order.py
index 4922116a8..97ebc2bf6 100644
--- a/tests/frontend/order.py
+++ b/tests/frontend/order.py
@@ -12,7 +12,21 @@ DATA_DIR = os.path.join(
)
-def create_element(repo, name, path, dependencies, ref=None):
+# create_element()
+#
+# Args:
+# project (str): The project directory where testing is happening
+# name (str): The element name to create
+# dependencies (list): The list of dependencies to dump into YAML format
+#
+# Returns:
+# (Repo): The corresponding git repository created for the element
+def create_element(project, name, dependencies):
+ dev_files_path = os.path.join(project, 'files', 'dev-files')
+ element_path = os.path.join(project, 'elements')
+ repo = create_repo('git', project, "{}-repo".format(name))
+ ref = repo.create(dev_files_path)
+
element = {
'kind': 'import',
'sources': [
@@ -20,7 +34,9 @@ def create_element(repo, name, path, dependencies, ref=None):
],
'depends': dependencies
}
- _yaml.dump(element, os.path.join(path, name))
+ _yaml.dump(element, os.path.join(element_path, name))
+
+ return repo
# This tests a variety of scenarios and checks that the order in
@@ -59,18 +75,6 @@ def create_element(repo, name, path, dependencies, ref=None):
@pytest.mark.parametrize("operation", [('show'), ('fetch'), ('build')])
def test_order(cli, datafiles, tmpdir, operation, target, template, expected):
project = os.path.join(datafiles.dirname, datafiles.basename)
- dev_files_path = os.path.join(project, 'files', 'dev-files')
- element_path = os.path.join(project, 'elements')
-
- # FIXME: Remove this when the test passes reliably.
- #
- # There is no reason why the order should not
- # be preserved when the builders is set to 1,
- # the scheduler queue processing still seems to
- # be losing the order.
- #
- if operation == 'build':
- pytest.skip("FIXME: This still only sometimes passes")
# Configure to only allow one fetcher at a time, make it easy to
# determine what is being planned in what order.
@@ -84,11 +88,8 @@ def test_order(cli, datafiles, tmpdir, operation, target, template, expected):
# Build the project from the template, make import elements
# all with the same repo
#
- repo = create_repo('git', str(tmpdir))
- ref = repo.create(dev_files_path)
for element, dependencies in template.items():
- create_element(repo, element, element_path, dependencies, ref=ref)
- repo.add_commit()
+ create_element(project, element, dependencies)
# Run test and collect results
if operation == 'show':