Skip to content

Commit

Permalink
Add optional groups explicitly in pipeline tests
Browse files Browse the repository at this point in the history
Signed-off-by: Ayan Sinha Mahapatra <[email protected]>
  • Loading branch information
AyanSinhaMahapatra committed Nov 12, 2024
1 parent ba1c001 commit f346e22
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 8 deletions.
4 changes: 3 additions & 1 deletion scanpipe/tests/data/d2d/about_files/expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
{
"pipeline_name": "map_deploy_to_develop",
"status": "not_started",
"selected_groups": null,
"selected_groups": [
"Java"
],
"selected_steps": null,
"scancodeio_version": "",
"task_id": null,
Expand Down
4 changes: 3 additions & 1 deletion scanpipe/tests/data/d2d/flume-ng-node-d2d.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
{
"pipeline_name": "map_deploy_to_develop",
"status": "not_started",
"selected_groups": null,
"selected_groups": [
"Java"
],
"selected_steps": null,
"scancodeio_version": "",
"task_id": null,
Expand Down
30 changes: 24 additions & 6 deletions scanpipe/tests/test_pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -1237,8 +1237,11 @@ def test_scanpipe_find_vulnerabilities_pipeline_integration(
def test_scanpipe_resolve_dependencies_pipeline_integration(self):
pipeline_name = "resolve_dependencies"
project1 = Project.objects.create(name="Analysis")
selected_groups = ["DynamicResolver"]

run = project1.add_pipeline(pipeline_name)
run = project1.add_pipeline(
pipeline_name=pipeline_name, selected_groups=selected_groups
)
pipeline = run.make_pipeline_instance()

project1.move_input_from(tempfile.mkstemp()[1])
Expand All @@ -1252,8 +1255,11 @@ def test_scanpipe_resolve_dependencies_pipeline_integration(self):
def test_scanpipe_resolve_dependencies_pipeline_integration_empty_manifest(self):
pipeline_name = "resolve_dependencies"
project1 = Project.objects.create(name="Analysis")
selected_groups = ["DynamicResolver"]

run = project1.add_pipeline(pipeline_name)
run = project1.add_pipeline(
pipeline_name=pipeline_name, selected_groups=selected_groups
)
pipeline = run.make_pipeline_instance()

project1.move_input_from(tempfile.mkstemp(suffix="requirements.txt")[1])
Expand All @@ -1267,11 +1273,14 @@ def test_scanpipe_resolve_dependencies_pipeline_integration_empty_manifest(self)
def test_scanpipe_resolve_dependencies_pipeline_integration_misc(self):
pipeline_name = "resolve_dependencies"
project1 = Project.objects.create(name="Analysis")
selected_groups = ["DynamicResolver"]

input_location = self.data / "manifests" / "requirements.txt"
project1.copy_input_from(input_location)

run = project1.add_pipeline(pipeline_name)
run = project1.add_pipeline(
pipeline_name=pipeline_name, selected_groups=selected_groups
)
pipeline = run.make_pipeline_instance()

exitcode, out = pipeline.execute()
Expand All @@ -1284,8 +1293,11 @@ def test_scanpipe_resolve_dependencies_pipeline_pypi_integration(
):
pipeline_name = "resolve_dependencies"
project1 = Project.objects.create(name="Analysis")
selected_groups = ["DynamicResolver"]

run = project1.add_pipeline(pipeline_name)
run = project1.add_pipeline(
pipeline_name=pipeline_name, selected_groups=selected_groups
)
pipeline = run.make_pipeline_instance()

project1.move_input_from(tempfile.mkstemp(suffix="requirements.txt")[1])
Expand Down Expand Up @@ -1445,12 +1457,15 @@ def test_scanpipe_deploy_to_develop_pipeline_integration(
mock_request.return_value = None
pipeline_name = "map_deploy_to_develop"
project1 = Project.objects.create(name="Analysis", uuid=forced_uuid)
selected_groups = ["Java"]

jar_location = self.data / "d2d" / "jars"
project1.copy_input_from(jar_location / "from-flume-ng-node-1.9.0.zip")
project1.copy_input_from(jar_location / "to-flume-ng-node-1.9.0.zip")

run = project1.add_pipeline(pipeline_name)
run = project1.add_pipeline(
pipeline_name=pipeline_name, selected_groups=selected_groups
)
pipeline = run.make_pipeline_instance()

exitcode, out = pipeline.execute()
Expand Down Expand Up @@ -1499,12 +1514,15 @@ def test_scanpipe_deploy_to_develop_pipeline_with_about_file(
mock_request.return_value = None
pipeline_name = "map_deploy_to_develop"
project1 = Project.objects.create(name="Analysis", uuid=forced_uuid)
selected_groups = ["Java"]

data_dir = self.data / "d2d" / "about_files"
project1.copy_input_from(data_dir / "from-with-about-file.zip")
project1.copy_input_from(data_dir / "to-with-jar.zip")

run = project1.add_pipeline(pipeline_name)
run = project1.add_pipeline(
pipeline_name=pipeline_name, selected_groups=selected_groups
)
pipeline = run.make_pipeline_instance()

exitcode, out = pipeline.execute()
Expand Down

0 comments on commit f346e22

Please sign in to comment.