gtristan commented on code in PR #1890:
URL: https://github.com/apache/buildstream/pull/1890#discussion_r1512556940
##########
tests/frontend/mirror.py:
##########
@@ -807,3 +807,93 @@ def test_mirror_expand_project_and_toplevel_root(cli,
tmpdir):
# Success if the expanded %{project-root} is found
assert foo_str in contents
assert bar_str in contents
+
+
+# Test a simple SourceMirror implementation which reads
+# plugin configuration and behaves in the same way as default
+# mirrors but using data in the plugin configuration instead.
+#
[email protected](DATA_DIR)
[email protected]("datafiles")
+def test_source_mirror_plugin(cli, tmpdir):
+ output_file = os.path.join(str(tmpdir), "output.txt")
+ project_dir = str(tmpdir)
+ element_dir = os.path.join(project_dir, "elements")
+ os.makedirs(element_dir, exist_ok=True)
+ element_name = "test.bst"
+ element_path = os.path.join(element_dir, element_name)
+ element = generate_element(output_file)
+ _yaml.roundtrip_dump(element, element_path)
+
+ project_file = os.path.join(project_dir, "project.conf")
+ project = {
+ "name": "test",
+ "min-version": "2.0",
+ "element-path": "elements",
+ "aliases": {
+ "foo": "FOO/",
+ "bar": "BAR/",
+ },
+ "mirrors": [
+ {
+ "name": "middle-earth",
+ "kind": "mirror",
+ "aliases": {
+ "foo": ["<invalid>"],
Review Comment:
This is just a test case, and the `"<invalid>"` URLs set to the aliases are
only there to indicate that it would be impossible for the test case to _work_
using the traditional mirror configuration keys, but that it works _only_ by
virtue of the `SourceMirror` plugin parsing the additional data set in the
plugin configuration (`config:` section)
The API changes in the YAML, compared to before, are only the following:
* When defining `mirrors:`
* The `mirror` definition now has an optional `kind:`, which can be used
to refer to a plugin (defaulting to the default `SourceMirror` base plugin in
the core)
* The `mirror` definition now has an optional `config:` section, which can
be parsed and validated by the plugin, in `Plugin.configure()` in the normal
way.
Does this answer your questions ? I think you are misunderstanding this test
case and I hope I've clarified it, otherwise I am perhaps misunderstanding the
issue you are raising.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]