Skip to content

Commit

Permalink
fix(cli): export removed datasets in graph export --full (#3422)
Browse files Browse the repository at this point in the history
  • Loading branch information
Panaetius committed May 12, 2023
1 parent 1d16a82 commit 59771e5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion renku/command/graph.py
Expand Up @@ -179,7 +179,7 @@ def get_graph_for_all_objects(

objects.append(project)

datasets = dataset_gateway.get_all_active_datasets()
datasets = dataset_gateway.get_provenance_tails()
objects.extend(datasets)

for dataset in datasets:
Expand Down
15 changes: 15 additions & 0 deletions tests/cli/test_graph.py
Expand Up @@ -111,6 +111,21 @@ def test_graph_export_strict_dataset(tmpdir, runner, project, subdirectory):
# check that all datasets are exported
assert 2 == result.output.count("http://schema.org/Dataset")

# remove and readd dataset
result = runner.invoke(cli, ["dataset", "rm", "my-dataset"])
assert 0 == result.exit_code, format_result_exception(result)

result = runner.invoke(cli, ["dataset", "create", "my-dataset"])
assert 0 == result.exit_code, format_result_exception(result)

result = runner.invoke(cli, ["graph", "export", "--strict", "--format=json-ld"])
assert 0 == result.exit_code, format_result_exception(result)
assert all(p in result.output for p in test_paths), result.output

# check that all datasets are exported
assert 4 == result.output.count("http://schema.org/Dataset")
assert 1 == result.output.count("invalidatedAtTime")


def test_graph_export_dataset_mutability(runner, project_with_datasets, with_injection):
"""Test export validation fails for datasets that have both same_as and derived_from."""
Expand Down
2 changes: 1 addition & 1 deletion tests/core/commands/test_graph.py
Expand Up @@ -256,7 +256,7 @@ def test_graph_export_full():
"""Test getting full graph."""

dataset_gateway = MagicMock(spec=IDatasetGateway)
dataset_gateway.get_all_active_datasets.return_value = [
dataset_gateway.get_provenance_tails.return_value = [
MagicMock(
spec=Dataset,
id="/datasets/abcdefg12345",
Expand Down

0 comments on commit 59771e5

Please sign in to comment.