diff options
author | Jürg Billeter <j@bitron.ch> | 2019-01-22 07:51:32 +0100 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2019-01-24 14:38:50 +0100 |
commit | ce1c10ec2925b3f1c30a166dee23088a64b2d473 (patch) | |
tree | e4a97e6b8dd0a75abdbbaa898bedfd3a7f9c3c03 | |
parent | 774145187ffd9b3c81652e103886e22153055413 (diff) | |
download | buildstream-ce1c10ec2925b3f1c30a166dee23088a64b2d473.tar.gz |
tests/frontend/fetch.py: Add default target test for bst source fetch
-rw-r--r-- | tests/frontend/fetch.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/frontend/fetch.py b/tests/frontend/fetch.py index 96c4a9335..24d9a36a6 100644 --- a/tests/frontend/fetch.py +++ b/tests/frontend/fetch.py @@ -49,6 +49,41 @@ def test_fetch(cli, tmpdir, datafiles, kind): assert cli.get_element_state(project, element_name) == 'buildable' +@pytest.mark.datafiles(os.path.join(TOP_DIR, 'project_world')) +def test_fetch_default_targets(cli, tmpdir, datafiles): + project = os.path.join(datafiles.dirname, datafiles.basename) + element_path = os.path.join(project, 'elements') + element_name = 'fetch-test.bst' + + # Create our repo object of the given source type with + # the bin files, and then collect the initial ref. + # + repo = create_repo('git', str(tmpdir)) + ref = repo.create(project) + + # Write out our test target + element = { + 'kind': 'import', + 'sources': [ + repo.source_config(ref=ref) + ] + } + _yaml.dump(element, + os.path.join(element_path, + element_name)) + + # Assert that a fetch is needed + assert cli.get_element_state(project, element_name) == 'fetch needed' + + # Now try to fetch it, using the default target feature + result = cli.run(project=project, args=['source', 'fetch']) + result.assert_success() + + # Assert that we are now buildable because the source is + # now cached. + assert cli.get_element_state(project, element_name) == 'buildable' + + @pytest.mark.datafiles(os.path.join(TOP_DIR, 'consistencyerror')) def test_fetch_consistency_error(cli, tmpdir, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) |