test: update tests with new expections

Signed-off-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com>
This commit is contained in:
Christopher Phillips 2026-02-02 12:49:03 -05:00
parent cb62054eed
commit 67986a9279
No known key found for this signature in database
6 changed files with 21 additions and 5 deletions

View File

@ -34,6 +34,8 @@ application: # AUTO-GENERATED - application-level config keys
description: search for go package licences by retrieving the package from a network proxy
- key: golang.use-packages-lib
description: use the golang.org/x/tools/go/packages library, which executes golang tooling found on the path in addition to potential network access to get the most accurate results
- key: java.detect-contained-packages
description: collect all Java package names contained within JAR files. This extracts package information from class file paths within the archive
- key: java.maven-local-repository-dir
description: override the default location of the local Maven repository. the default is the subdirectory '.m2/repository' in your home directory
- key: java.maven-url

View File

@ -27,7 +27,7 @@
},
{
"name": "files-analyzed-true",
"SPDXID": "SPDXRef-Package-files-analyzed-true-035066c2086b8bb4",
"SPDXID": "SPDXRef-Package-files-analyzed-true-716e193286ab5f0a",
"versionInfo": "v1",
"supplier": "NOASSERTION",
"downloadLocation": "NOASSERTION",
@ -77,7 +77,7 @@
],
"relationships": [
{
"spdxElementId": "SPDXRef-Package-files-analyzed-true-035066c2086b8bb4",
"spdxElementId": "SPDXRef-Package-files-analyzed-true-716e193286ab5f0a",
"relatedSpdxElement": "SPDXRef-File-some-file-2c5bc344430decac",
"relationshipType": "CONTAINS"
},
@ -88,7 +88,7 @@
},
{
"spdxElementId": "SPDXRef-DocumentRoot-Unknown-",
"relatedSpdxElement": "SPDXRef-Package-files-analyzed-true-035066c2086b8bb4",
"relatedSpdxElement": "SPDXRef-Package-files-analyzed-true-716e193286ab5f0a",
"relationshipType": "CONTAINS"
},
{

View File

@ -1,6 +1,7 @@
package binary
import (
"runtime"
"testing"
"github.com/anchore/syft/syft/pkg/cataloger/internal/pkgtest"
@ -10,6 +11,7 @@ func Test_JavaBinaryImage(t *testing.T) {
tests := []struct {
image string
expected []string
skipOnArch string // skip test when running on this architecture (e.g., "arm64")
}{
{
image: "image-java-binary",
@ -25,12 +27,14 @@ func Test_JavaBinaryImage(t *testing.T) {
expected: []string{
"zulu @ 1.8.0_462-b08 (/usr/lib/jvm/zulu8-ca-amd64/bin/jdb)",
},
skipOnArch: "arm64", // image uses amd64-specific paths
},
{
image: "image-java-zulu-21",
expected: []string{
"zulu @ 21.0.8+9-LTS (/usr/lib/jvm/zulu21-ca-amd64/bin/java)",
},
skipOnArch: "arm64", // image uses amd64-specific paths
},
{
image: "image-java-ibm-8",
@ -43,6 +47,7 @@ func Test_JavaBinaryImage(t *testing.T) {
expected: []string{
"java @ 1.8.0-_2025_04_14_02_37-b00 (/opt/ibm/java/jre/bin/java)",
},
skipOnArch: "arm64", // base image has no arm64 manifest
},
{
image: "image-java-ibm-sdk-8",
@ -54,6 +59,9 @@ func Test_JavaBinaryImage(t *testing.T) {
for _, tt := range tests {
t.Run(tt.image, func(t *testing.T) {
if tt.skipOnArch != "" && runtime.GOARCH == tt.skipOnArch {
t.Skipf("skipping test on %s architecture", tt.skipOnArch)
}
c := NewClassifierCataloger(ClassifierCatalogerConfig{
Classifiers: defaultJavaClassifiers(),
})

View File

@ -237,6 +237,7 @@ func TestParseJar(t *testing.T) {
"net.bytebuddy.jar.asm",
"net.bytebuddy.jar.asm.commons",
"net.bytebuddy.jar.asm.signature",
"net.bytebuddy.jar.asmjdkbridge",
"net.bytebuddy.matcher",
"net.bytebuddy.pool",
"net.bytebuddy.utility",
@ -431,6 +432,7 @@ func TestParseJar(t *testing.T) {
"net.bytebuddy.jar.asm",
"net.bytebuddy.jar.asm.commons",
"net.bytebuddy.jar.asm.signature",
"net.bytebuddy.jar.asmjdkbridge",
"net.bytebuddy.matcher",
"net.bytebuddy.pool",
"net.bytebuddy.utility",

View File

@ -25,6 +25,9 @@ configs: # AUTO-GENERATED - config structs and their fields
- key: ResolveTransitiveDependencies
description: ResolveTransitiveDependencies enables resolving transitive dependencies for java packages found within archives.
app_key: java.resolve-transitive-dependencies
- key: DetectContainedPackages
description: DetectContainedPackages enables collecting all package names contained in a jar.
app_key: java.detect-contained-packages
catalogers:
- ecosystem: java # MANUAL
name: java-archive-cataloger # AUTO-GENERATED

View File

@ -39,6 +39,7 @@ func Test_parseTarWrappedJavaArchive(t *testing.T) {
expected: []string{
"example-java-app-maven",
"joda-time",
"byte-buddy",
},
},
}