def test_removal_with_linked_runs(self): """ One run's output is used as another's input, watch for dups. """ app = ContainerApp(id=42) run1 = app.runs.create(id=43, state=ContainerRun.COMPLETE) dataset = Dataset.objects.create(id=44) run_dataset1 = run1.datasets.create( id=45, run=run1, dataset=dataset, argument=ContainerArgument(type=ContainerArgument.OUTPUT)) run2 = app.runs.create(id=46, state=ContainerRun.COMPLETE) run_dataset2 = run2.datasets.create( id=47, run=run2, dataset=dataset, argument=ContainerArgument(type=ContainerArgument.INPUT)) dataset.containers.add(run_dataset1) dataset.containers.add(run_dataset2) expected_plan = { 'ContainerApps': {app}, 'ContainerRuns': {run1, run2}, 'Datasets': {dataset} } plan = app.build_removal_plan() self.assertEqual(expected_plan, strip_removal_plan(plan))
def test_removal(self): app = ContainerApp(id=42) expected_plan = {'ContainerApps': {app}} plan = app.build_removal_plan() self.assertEqual(expected_plan, strip_removal_plan(plan))
def test_removal_with_linked_runs(self): """ One run's output is used as another's input, watch for dups. """ app = ContainerApp(id=42) run1 = app.runs.create(id=43, state=ContainerRun.COMPLETE) dataset = Dataset.objects.create(id=44) run_dataset1 = run1.datasets.create( id=45, run=run1, dataset=dataset, argument=ContainerArgument(type=ContainerArgument.OUTPUT)) run2 = app.runs.create(id=46, state=ContainerRun.COMPLETE) run_dataset2 = run2.datasets.create( id=47, run=run2, dataset=dataset, argument=ContainerArgument(type=ContainerArgument.INPUT)) dataset.containers.add(run_dataset1) dataset.containers.add(run_dataset2) expected_plan = {'ContainerApps': {app}, 'ContainerRuns': {run1, run2}, 'Datasets': {dataset}} plan = app.build_removal_plan() self.assertEqual(expected_plan, strip_removal_plan(plan))
def test_removal_with_run(self): app = ContainerApp(id=42) run = app.runs.create(id=43, state=ContainerRun.COMPLETE) expected_plan = {'ContainerApps': {app}, 'ContainerRuns': {run}} plan = app.build_removal_plan() self.assertEqual(expected_plan, strip_removal_plan(plan))