Skip to content

Commit 59771e5

Browse files
authored
fix(cli): export removed datasets in graph export --full (#3422)
1 parent 1d16a82 commit 59771e5

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

renku/command/graph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def get_graph_for_all_objects(
179179

180180
objects.append(project)
181181

182-
datasets = dataset_gateway.get_all_active_datasets()
182+
datasets = dataset_gateway.get_provenance_tails()
183183
objects.extend(datasets)
184184

185185
for dataset in datasets:

tests/cli/test_graph.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,21 @@ def test_graph_export_strict_dataset(tmpdir, runner, project, subdirectory):
111111
# check that all datasets are exported
112112
assert 2 == result.output.count("http://schema.org/Dataset")
113113

114+
# remove and readd dataset
115+
result = runner.invoke(cli, ["dataset", "rm", "my-dataset"])
116+
assert 0 == result.exit_code, format_result_exception(result)
117+
118+
result = runner.invoke(cli, ["dataset", "create", "my-dataset"])
119+
assert 0 == result.exit_code, format_result_exception(result)
120+
121+
result = runner.invoke(cli, ["graph", "export", "--strict", "--format=json-ld"])
122+
assert 0 == result.exit_code, format_result_exception(result)
123+
assert all(p in result.output for p in test_paths), result.output
124+
125+
# check that all datasets are exported
126+
assert 4 == result.output.count("http://schema.org/Dataset")
127+
assert 1 == result.output.count("invalidatedAtTime")
128+
114129

115130
def test_graph_export_dataset_mutability(runner, project_with_datasets, with_injection):
116131
"""Test export validation fails for datasets that have both same_as and derived_from."""

tests/core/commands/test_graph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def test_graph_export_full():
256256
"""Test getting full graph."""
257257

258258
dataset_gateway = MagicMock(spec=IDatasetGateway)
259-
dataset_gateway.get_all_active_datasets.return_value = [
259+
dataset_gateway.get_provenance_tails.return_value = [
260260
MagicMock(
261261
spec=Dataset,
262262
id="/datasets/abcdefg12345",

0 commit comments

Comments
 (0)