diff options
author | James Ennis <james.ennis@codethink.co.uk> | 2019-08-15 17:00:10 +0100 |
---|---|---|
committer | James Ennis <james.ennis@codethink.co.uk> | 2019-08-15 17:00:10 +0100 |
commit | 0aca836471655e305ed075e374d04f0c657789ee (patch) | |
tree | 5dbd5d7479b4f8e2c25280611a47b41fa37429fe | |
parent | 8fb0075899437d6ca967eb4d727da3536b94b5ea (diff) | |
download | buildstream-danielsilverstone-ct/fix-node-provenance.tar.gz |
invalid_keys.py: Test compositied nodes are reported back usefullydanielsilverstone-ct/fix-node-provenance
Test that we get the correct provenance from a node which has
been compositied.
This tests asserts that if we forget to include one of the
local plugin's essential keys, we fail and see the appropriate
error message.
Tests issue described in #1059.
-rw-r--r-- | tests/format/invalid-keys/no-path-specified.bst | 4 | ||||
-rw-r--r-- | tests/format/invalid-keys/project.conf | 1 | ||||
-rw-r--r-- | tests/format/invalid_keys.py | 23 |
3 files changed, 28 insertions, 0 deletions
diff --git a/tests/format/invalid-keys/no-path-specified.bst b/tests/format/invalid-keys/no-path-specified.bst new file mode 100644 index 000000000..85570b64d --- /dev/null +++ b/tests/format/invalid-keys/no-path-specified.bst @@ -0,0 +1,4 @@ +kind: import + +sources: + - kind: local diff --git a/tests/format/invalid-keys/project.conf b/tests/format/invalid-keys/project.conf new file mode 100644 index 000000000..b32753625 --- /dev/null +++ b/tests/format/invalid-keys/project.conf @@ -0,0 +1 @@ +name: test diff --git a/tests/format/invalid_keys.py b/tests/format/invalid_keys.py new file mode 100644 index 000000000..12e07b01b --- /dev/null +++ b/tests/format/invalid_keys.py @@ -0,0 +1,23 @@ +# Pylint doesn't play well with fixtures and dependency injection from pytest +# pylint: disable=redefined-outer-name + +import os +import pytest +from buildstream._exceptions import ErrorDomain, LoadErrorReason +from buildstream.testing.runcli import cli # pylint: disable=unused-import + +# Project directory +DATA_DIR = os.path.join( + os.path.dirname(os.path.realpath(__file__)), + 'invalid-keys' +) + + +@pytest.mark.datafiles(DATA_DIR) +def test_compositied_node_fails_usefully(cli, datafiles): + project = str(datafiles) + result = cli.run(project=project, args=['show', 'no-path-specified.bst']) + result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_DATA) + + assert "synthetic node" not in result.stderr + assert "no-path-specified.bst [line 4 column 4]: Dictionary did not contain expected key 'path'" in result.stderr |