Skip to content

Commit 3014540

Browse files
committed
test: add integration tests for the gen-build-spec error
1 parent ce60a13 commit 3014540

File tree

5 files changed

+175
-1
lines changed

5 files changed

+175
-1
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright (c) 2025, Oracle and/or its affiliates.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/.
3+
# Generated by Macaron version 0.15.0
4+
5+
# Input PURL - pkg:github/behnazh-w/example-maven-app@1.0
6+
# Initial default JDK version 8 and default build command [['mvn', '-DskipTests=true', '-Dmaven.test.skip=true', '-Dmaven.site.skip=true', '-Drat.skip=true', '-Dmaven.javadoc.skip=true', 'clean', 'package']].
7+
# The lookup build command: ['./mvnw', 'clean', 'package']
8+
# Jdk version from lookup build command 17.
9+
10+
groupId=behnazh-w
11+
artifactId=example-maven-app
12+
version=1.0
13+
14+
gitRepo=https://github.com/behnazh-w/example-maven-app
15+
16+
gitTag=2deca75ed5dd365eaf1558a82347b1f11306135f
17+
18+
tool=mvn
19+
jdk=17
20+
21+
newline=lf
22+
23+
command="./mvnw -DskipTests=true -Dmaven.test.skip=true -Dmaven.site.skip=true -Drat.skip=true -Dmaven.javadoc.skip=true clean package"
24+
25+
buildinfo=target/example-maven-app-1.0.buildinfo
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright (c) 2025 - 2025, Oracle and/or its affiliates. All rights reserved.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/.
3+
4+
description: |
5+
Test the build spec generation on a Maven project with JDK version obtained
6+
from the github action worfklow.
7+
8+
tags:
9+
- macaron-python-package
10+
- macaron-docker-image
11+
- macaron-gen-build-spec
12+
13+
steps:
14+
- name: Run macaron analyze
15+
kind: analyze
16+
options:
17+
command_args:
18+
- -purl
19+
- pkg:github/behnazh-w/example-maven-app@1.0
20+
- name: Run Reproducible-central build spec generation
21+
kind: gen-build-spec
22+
options:
23+
command_args:
24+
- -purl
25+
- pkg:github/behnazh-w/example-maven-app@1.0
26+
- --output-format
27+
- rc-buildspec
28+
- name: Compare Buildspec.
29+
kind: compare
30+
options:
31+
kind: rc_build_spec
32+
result: ./output/macaron.buildspec
33+
expected: expected_macaron.buildspec
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Copyright (c) 2024 - 2025, Oracle and/or its affiliates. All rights reserved.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/.
3+
4+
description: |
5+
Running macaron gen-build-spec with invalid arguments.
6+
7+
tags:
8+
- macaron-python-package
9+
- macaron-docker-image
10+
- macaron-gen-build-spec
11+
12+
steps:
13+
- name: Run macaron analyze on the remote repository.
14+
kind: analyze
15+
options:
16+
command_args:
17+
- --package-url
18+
- pkg:maven/io.github.behnazh-w.demo/example-maven-app@2.0?type=jar
19+
- -rp
20+
- https://github.com/behnazh-w/example-maven-app
21+
- name: Using a format that we don't support.
22+
kind: gen-build-spec
23+
options:
24+
command_args:
25+
- -purl
26+
- pkg:maven/io.github.behnazh-w.demo/example-maven-app@2.0?type=jar
27+
- --output-format
28+
- this-format-is-not-supported
29+
expect_fail: true
30+
- name: Generate the RC Buildspec for a PURL that we haven't analyzed.
31+
kind: gen-build-spec
32+
options:
33+
command_args:
34+
- -purl
35+
- pkg:maven/io.micronaut/micronaut-core@4.2.3
36+
- --output-format
37+
- rc-buildspec
38+
expect_fail: true
39+
- name: Generate the RC Buildspec for a PURL that doesn't have namespace information.
40+
kind: gen-build-spec
41+
options:
42+
command_args:
43+
- -purl
44+
- pkg:maven/io.micronaut@4.2.3
45+
- --output-format
46+
- rc-buildspec
47+
expect_fail: true
48+
- name: Generate the RC Buildspec for a PURL that doesn't have version information.
49+
kind: gen-build-spec
50+
options:
51+
command_args:
52+
- -purl
53+
- pkg:maven/io.micronaut/micronaut-core
54+
- --output-format
55+
- rc-buildspec
56+
expect_fail: true
57+
- name: Generate the RC Buildspec using a database that doesn't exist.
58+
kind: gen-build-spec
59+
options:
60+
database: output/some_database.db
61+
command_args:
62+
- -purl
63+
- pkg:maven/io.github.behnazh-w.demo/example-maven-app@2.0?type=jar
64+
- --output-format
65+
- rc-buildspec
66+
expect_fail: true
67+
- name: Generate the RC Buildspec using an invalid PURL.
68+
kind: gen-build-spec
69+
options:
70+
command_args:
71+
- -purl
72+
- invalid_purl
73+
- --output-format
74+
- rc-buildspec
75+
expect_fail: true
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright (c) 2025, Oracle and/or its affiliates.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/.
3+
# Generated by Macaron version 0.15.0
4+
5+
# Input PURL - pkg:maven/io.micronaut/micronaut-core@4.2.3
6+
# Initial default JDK version 8 and default build command [['./gradlew', '-x', 'test', '-Pskip.signing', '-PskipSigning', '-Pgnupg.skip', 'clean', 'assemble']].
7+
# The lookup build command: ['./gradlew', 'publishToSonatype', 'closeAndReleaseSonatypeStagingRepository']
8+
# Jdk version from lookup build command 17.
9+
10+
groupId=io.micronaut
11+
artifactId=micronaut-core
12+
version=4.2.3
13+
14+
gitRepo=https://github.com/micronaut-projects/micronaut-core
15+
16+
gitTag=36dcaf0539536dce5fc753677341609ff7f273ca
17+
18+
tool=gradle
19+
jdk=17
20+
21+
newline=lf
22+
23+
command="./gradlew -x test -Pskip.signing -PskipSigning -Pgnupg.skip clean assemble"
24+
25+
buildinfo=target/micronaut-core-4.2.3.buildinfo

tests/integration/cases/micronaut-projects_micronaut-core/test.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
# Copyright (c) 2024 - 2024, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2024 - 2025, Oracle and/or its affiliates. All rights reserved.
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/.
33

44
description: |
55
Analyzing the PURL when automatic dependency resolution is skipped.
66
Run policy CLI with micronaut-core results to test deploy command information.
7+
Also generate a build spec for this PURL and validate the build spec content.
78
89
tags:
910
- macaron-python-package
11+
- macaron-gen-build-spec
1012

1113
steps:
1214
- name: Run macaron analyze
@@ -30,3 +32,17 @@ steps:
3032
kind: policy_report
3133
result: output/policy_report.json
3234
expected: policy_report.json
35+
- name: Run Reproducible-central build spec generation
36+
kind: gen-build-spec
37+
options:
38+
command_args:
39+
- -purl
40+
- pkg:maven/io.micronaut/micronaut-core@4.2.3
41+
- --output-format
42+
- rc-buildspec
43+
- name: Compare Buildspec.
44+
kind: compare
45+
options:
46+
kind: rc_build_spec
47+
result: ./output/macaron.buildspec
48+
expected: expected_macaron.buildspec

0 commit comments

Comments
 (0)