summaryrefslogtreecommitdiff
path: root/tests/frontend
diff options
context:
space:
mode:
authorJames Ennis <james.ennis@codethink.com>2019-01-07 18:00:54 +0000
committerJames Ennis <james.ennis@codethink.com>2019-01-22 12:32:43 +0000
commita3fc350fdf64897ae386aa913a55318d6b048276 (patch)
tree088bfa82769eb6f72262b430f51936a8a9249c16 /tests/frontend
parentac13533300da75472e53d36ec03b4dddf4fe6c73 (diff)
downloadbuildstream-a3fc350fdf64897ae386aa913a55318d6b048276.tar.gz
Move push and pull to the new artifact subcommand group
This commit also ensures that if we try to use the 'old' commands, BuildStream will fail and instruct the user to use the new command.
Diffstat (limited to 'tests/frontend')
-rw-r--r--tests/frontend/completions.py14
-rw-r--r--tests/frontend/help.py3
-rw-r--r--tests/frontend/pull.py12
-rw-r--r--tests/frontend/push.py16
-rw-r--r--tests/frontend/workspace.py4
5 files changed, 25 insertions, 24 deletions
diff --git a/tests/frontend/completions.py b/tests/frontend/completions.py
index 0e4c6ad7e..b0e08a3f0 100644
--- a/tests/frontend/completions.py
+++ b/tests/frontend/completions.py
@@ -14,8 +14,6 @@ MAIN_COMMANDS = [
'checkout ',
'help ',
'init ',
- 'pull ',
- 'push ',
'shell ',
'show ',
'source ',
@@ -57,6 +55,12 @@ SOURCE_COMMANDS = [
'track ',
]
+ARTIFACT_COMMANDS = [
+ 'push ',
+ 'pull ',
+ 'log ',
+]
+
WORKSPACE_COMMANDS = [
'close ',
'list ',
@@ -120,8 +124,7 @@ def assert_completion_failed(cli, cmd, word_idx, expected, cwd=None):
@pytest.mark.parametrize("cmd,word_idx,expected", [
('bst', 0, []),
('bst ', 1, MAIN_COMMANDS),
- ('bst pu', 1, ['pull ', 'push ']),
- ('bst pul', 1, ['pull ']),
+ ('bst artifact ', 2, ARTIFACT_COMMANDS),
('bst source ', 2, SOURCE_COMMANDS),
('bst w ', 1, ['workspace ']),
('bst workspace ', 2, WORKSPACE_COMMANDS),
@@ -275,9 +278,8 @@ def test_argument_element_invalid(datafiles, cli, project, cmd, word_idx, expect
@pytest.mark.parametrize("cmd,word_idx,expected", [
('bst he', 1, ['help ']),
('bst help ', 2, MAIN_COMMANDS),
+ ('bst help artifact ', 3, ARTIFACT_COMMANDS),
('bst help in', 2, ['init ']),
- ('bst help p', 2, ['pull ', 'push ']),
- ('bst help p', 2, ['pull ', 'push ']),
('bst help source ', 3, SOURCE_COMMANDS),
('bst help w', 2, ['workspace ']),
('bst help workspace ', 3, WORKSPACE_COMMANDS),
diff --git a/tests/frontend/help.py b/tests/frontend/help.py
index e3b406f56..331eb43c0 100644
--- a/tests/frontend/help.py
+++ b/tests/frontend/help.py
@@ -18,10 +18,9 @@ def test_help_main(cli):
@pytest.mark.parametrize("command", [
+ ('artifact'),
('build'),
('checkout'),
- ('pull'),
- ('push'),
('shell'),
('show'),
('source'),
diff --git a/tests/frontend/pull.py b/tests/frontend/pull.py
index c883e2030..254b6d584 100644
--- a/tests/frontend/pull.py
+++ b/tests/frontend/pull.py
@@ -70,7 +70,7 @@ def test_push_pull_all(cli, tmpdir, datafiles):
assert cli.get_element_state(project, element_name) != 'cached'
# Now try bst pull
- result = cli.run(project=project, args=['pull', '--deps', 'all', 'target.bst'])
+ result = cli.run(project=project, args=['artifact', 'pull', '--deps', 'all', 'target.bst'])
result.assert_success()
# And assert that it's again in the local cache, without having built
@@ -111,7 +111,7 @@ def test_pull_secondary_cache(cli, tmpdir, datafiles):
assert cli.get_element_state(project, 'target.bst') != 'cached'
# Now try bst pull
- result = cli.run(project=project, args=['pull', 'target.bst'])
+ result = cli.run(project=project, args=['artifact', 'pull', 'target.bst'])
result.assert_success()
# And assert that it's again in the local cache, without having built,
@@ -146,7 +146,7 @@ def test_push_pull_specific_remote(cli, tmpdir, datafiles):
# Now try `bst push` to the good_share.
result = cli.run(project=project, args=[
- 'push', 'target.bst', '--remote', good_share.repo
+ 'artifact', 'push', 'target.bst', '--remote', good_share.repo
])
result.assert_success()
@@ -161,7 +161,7 @@ def test_push_pull_specific_remote(cli, tmpdir, datafiles):
artifacts = os.path.join(cli.directory, 'artifacts')
shutil.rmtree(artifacts)
- result = cli.run(project=project, args=['pull', 'target.bst', '--remote',
+ result = cli.run(project=project, args=['artifact', 'pull', 'target.bst', '--remote',
good_share.repo])
result.assert_success()
@@ -216,7 +216,7 @@ def test_push_pull_non_strict(cli, tmpdir, datafiles):
assert cli.get_element_state(project, 'target.bst') == 'waiting'
# Now try bst pull
- result = cli.run(project=project, args=['pull', '--deps', 'all', 'target.bst'])
+ result = cli.run(project=project, args=['artifact', 'pull', '--deps', 'all', 'target.bst'])
result.assert_success()
# And assert that the target is again in the local cache, without having built
@@ -291,7 +291,7 @@ def test_push_pull_cross_junction(cli, tmpdir, datafiles):
assert cli.get_element_state(project, 'junction.bst:import-etc.bst') == 'buildable'
# Now try bst pull
- result = cli.run(project=project, args=['pull', 'junction.bst:import-etc.bst'])
+ result = cli.run(project=project, args=['artifact', 'pull', 'junction.bst:import-etc.bst'])
result.assert_success()
# And assert that it's again in the local cache, without having built
diff --git a/tests/frontend/push.py b/tests/frontend/push.py
index 153d43340..6ed163a93 100644
--- a/tests/frontend/push.py
+++ b/tests/frontend/push.py
@@ -82,7 +82,7 @@ def test_push(cli, tmpdir, datafiles):
with create_artifact_share(os.path.join(str(tmpdir), 'artifactshare2')) as share2:
# Try pushing with no remotes configured. This should fail.
- result = cli.run(project=project, args=['push', 'target.bst'])
+ result = cli.run(project=project, args=['artifact', 'push', 'target.bst'])
result.assert_main_error(ErrorDomain.STREAM, None)
# Configure bst to pull but not push from a cache and run `bst push`.
@@ -90,7 +90,7 @@ def test_push(cli, tmpdir, datafiles):
cli.configure({
'artifacts': {'url': share1.repo, 'push': False},
})
- result = cli.run(project=project, args=['push', 'target.bst'])
+ result = cli.run(project=project, args=['artifact', 'push', 'target.bst'])
result.assert_main_error(ErrorDomain.STREAM, None)
# Configure bst to push to one of the caches and run `bst push`. This works.
@@ -100,7 +100,7 @@ def test_push(cli, tmpdir, datafiles):
{'url': share2.repo, 'push': True},
]
})
- result = cli.run(project=project, args=['push', 'target.bst'])
+ result = cli.run(project=project, args=['artifact', 'push', 'target.bst'])
assert_not_shared(cli, share1, project, 'target.bst')
assert_shared(cli, share2, project, 'target.bst')
@@ -114,7 +114,7 @@ def test_push(cli, tmpdir, datafiles):
{'url': share2.repo, 'push': True},
]
})
- result = cli.run(project=project, args=['push', 'target.bst'])
+ result = cli.run(project=project, args=['artifact', 'push', 'target.bst'])
assert_shared(cli, share1, project, 'target.bst')
assert_shared(cli, share2, project, 'target.bst')
@@ -156,7 +156,7 @@ def test_push_all(cli, tmpdir, datafiles):
# Now try bst push all the deps
result = cli.run(project=project, args=[
- 'push', 'target.bst',
+ 'artifact', 'push', 'target.bst',
'--deps', 'all'
])
result.assert_success()
@@ -346,7 +346,7 @@ def test_recently_pulled_artifact_does_not_expire(cli, datafiles, tmpdir):
assert cli.get_element_state(project, 'element1.bst') != 'cached'
# Pull the element1 from the remote cache (this should update its mtime)
- result = cli.run(project=project, args=['pull', 'element1.bst', '--remote',
+ result = cli.run(project=project, args=['artifact', 'pull', 'element1.bst', '--remote',
share.repo])
result.assert_success()
@@ -386,7 +386,7 @@ def test_push_cross_junction(cli, tmpdir, datafiles):
cli.configure({
'artifacts': {'url': share.repo, 'push': True},
})
- result = cli.run(project=project, args=['push', 'junction.bst:import-etc.bst'])
+ result = cli.run(project=project, args=['artifact', 'push', 'junction.bst:import-etc.bst'])
cache_key = cli.get_element_key(project, 'junction.bst:import-etc.bst')
assert share.has_artifact('subtest', 'import-etc.bst', cache_key)
@@ -407,7 +407,7 @@ def test_push_already_cached(caplog, cli, tmpdir, datafiles):
result.assert_success()
assert "SKIPPED Push" not in result.stderr
- result = cli.run(project=project, args=['push', 'target.bst'])
+ result = cli.run(project=project, args=['artifact', 'push', 'target.bst'])
result.assert_success()
assert not result.get_pushed_elements(), "No elements should have been pushed since the cache was populated"
diff --git a/tests/frontend/workspace.py b/tests/frontend/workspace.py
index 2995bf967..a6189458c 100644
--- a/tests/frontend/workspace.py
+++ b/tests/frontend/workspace.py
@@ -1106,10 +1106,10 @@ def test_external_push_pull(cli, datafiles, tmpdir_factory, guess_element):
'artifacts': {'url': share.repo, 'push': True}
})
- result = cli.run(project=project, args=['-C', workspace, 'push'] + arg_elm)
+ result = cli.run(project=project, args=['-C', workspace, 'artifact', 'push'] + arg_elm)
result.assert_success()
- result = cli.run(project=project, args=['-C', workspace, 'pull', '--deps', 'all'] + arg_elm)
+ result = cli.run(project=project, args=['-C', workspace, 'artifact', 'pull', '--deps', 'all'] + arg_elm)
result.assert_success()