Skip to content

Commit

Permalink
test: add integration tests for maven repo verification check
Browse files Browse the repository at this point in the history
Signed-off-by: Mohammad Abdollahpour <[email protected]>
  • Loading branch information
mabdollahpour-ol committed Oct 7, 2024
1 parent a4255e7 commit c0cce14
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/integration/cases/maven_repo_verification/config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright (c) 2024 - 2024, Oracle and/or its affiliates. All rights reserved.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/.

[analysis.checks]
exclude =
include = mcn_maven_repo_verification_1
10 changes: 10 additions & 0 deletions tests/integration/cases/maven_repo_verification/policy_fail_1.dl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* Copyright (c) 2024 - 2024, Oracle and/or its affiliates. All rights reserved. */
/* Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/. */

#include "prelude.dl"

Policy("test_policy", component_id, "") :-
check_failed(component_id, "mcn_maven_repo_verification_1").

apply_policy_to("test_policy", component_id) :-
is_component(component_id, "pkg:maven/com.alibaba.ververica/[email protected]").
10 changes: 10 additions & 0 deletions tests/integration/cases/maven_repo_verification/policy_pass_1.dl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* Copyright (c) 2024 - 2024, Oracle and/or its affiliates. All rights reserved. */
/* Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/. */

#include "prelude.dl"

Policy("test_policy", component_id, "") :-
check_passed(component_id, "mcn_maven_repo_verification_1").

apply_policy_to("test_policy", component_id) :-
is_component(component_id, "pkg:maven/org.antlr/[email protected]").
10 changes: 10 additions & 0 deletions tests/integration/cases/maven_repo_verification/policy_pass_2.dl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* Copyright (c) 2024 - 2024, Oracle and/or its affiliates. All rights reserved. */
/* Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/. */

#include "prelude.dl"

Policy("test_policy", component_id, "") :-
check_passed(component_id, "mcn_maven_repo_verification_1").

apply_policy_to("test_policy", component_id) :-
is_component(component_id, "pkg:maven/org.neo4j/[email protected]").
44 changes: 44 additions & 0 deletions tests/integration/cases/maven_repo_verification/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright (c) 2024 - 2024, Oracle and/or its affiliates. All rights reserved.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/.

description: |
Integration tests for mcn_maven_repo_verification_1 check.
tags:
- macaron-python-package
- macaron-docker-image

steps:
- name: Run macaron analyze on passing case 1
kind: analyze
options:
ini: config.ini
command_args:
- -purl
- pkg:maven/org.antlr/[email protected]
- name: Verify that the check passsed
kind: verify
options:
policy: policy_pass_1.dl
- name: Run macaron analyze on passing case 2
kind: analyze
options:
ini: config.ini
command_args:
- -purl
- pkg:maven/org.neo4j/[email protected]
- name: Verify that the check passsed
kind: verify
options:
policy: policy_pass_2.dl
- name: Run macaron analyze on failing case 1
kind: analyze
options:
ini: config.ini
command_args:
- -purl
- pkg:maven/com.alibaba.ververica/[email protected]
- name: Verify that the check passsed
kind: verify
options:
policy: policy_fail_1.dl

0 comments on commit c0cce14

Please sign in to comment.