From 608cfe13f14a8fdecacd85b5a370a10127dc894b Mon Sep 17 00:00:00 2001 From: Ben Selwyn-Smith Date: Thu, 19 Dec 2024 10:23:13 +1000 Subject: [PATCH] chore: add comparison test case for source finder vs analyzer Signed-off-by: Ben Selwyn-Smith --- .../latest_repo_comparison/check_output.sh | 6 ++++ .../cases/latest_repo_comparison/test.yaml | 36 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100755 tests/integration/cases/latest_repo_comparison/check_output.sh create mode 100644 tests/integration/cases/latest_repo_comparison/test.yaml diff --git a/tests/integration/cases/latest_repo_comparison/check_output.sh b/tests/integration/cases/latest_repo_comparison/check_output.sh new file mode 100755 index 000000000..c8e9cbf2e --- /dev/null +++ b/tests/integration/cases/latest_repo_comparison/check_output.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# 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/. + +[[ "$(jq -r '.commit' output/reports/maven/io_avaje/avaje-prisms/avaje-prisms.source.json)" = "1f6f953df0b58f0c35b5e136f62f63ba7a22bc03" ]] && +[[ "$(jq -r '.repo' output/reports/maven/io_avaje/avaje-prisms/avaje-prisms.source.json)" = "https://github.com/avaje/avaje-prisms" ]] diff --git a/tests/integration/cases/latest_repo_comparison/test.yaml b/tests/integration/cases/latest_repo_comparison/test.yaml new file mode 100644 index 000000000..3731b88c8 --- /dev/null +++ b/tests/integration/cases/latest_repo_comparison/test.yaml @@ -0,0 +1,36 @@ +# 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: | + Check that the find-source and analyze commands behave the same for a given artifact. + +tags: +- macaron-python-package +- macaron-docker-image + +steps: +- name: Run macaron find source + kind: find-source + options: + command_args: + - -purl + - pkg:maven/io.avaje/avaje-prisms@1.1 +- name: Check that the repository was not cloned + kind: shell + options: + cmd: ls output/git_repos/github.com/avaje/avaje-prisms/ + expect_fail: true +- name: Check the report contents + kind: shell + options: + cmd: ./check_output.sh +- name: Run macaron analyze + kind: analyze + options: + command_args: + - -purl + - pkg:maven/io.avaje/avaje-prisms@1.1 +- name: Check that correct repository was cloned + kind: shell + options: + cmd: ls output/git_repos/github.com/avaje/avaje-prisms/