diff --git a/test/integration/java_no_main_package_test.go b/test/integration/java_no_main_package_test.go new file mode 100644 index 000000000..e330a78fb --- /dev/null +++ b/test/integration/java_no_main_package_test.go @@ -0,0 +1,20 @@ +package integration + +import ( + "github.com/anchore/stereoscope/pkg/imagetest" + "github.com/anchore/syft/syft" + "github.com/anchore/syft/syft/source" + "testing" +) + +func TestJavaNoMainPackage(t *testing.T) { // Regression: https://github.com/anchore/syft/issues/252 + fixtureImageName := "image-java-no-main-package" + _, cleanup := imagetest.GetFixtureImage(t, "docker-archive", fixtureImageName) + tarPath := imagetest.GetFixtureImageTarPath(t, fixtureImageName) + defer cleanup() + + _, _, _, err := syft.Catalog("docker-archive:"+tarPath, source.SquashedScope) + if err != nil { + t.Fatalf("failed to catalog image: %+v", err) + } +} diff --git a/test/integration/test-fixtures/image-java-no-main-package/Dockerfile b/test/integration/test-fixtures/image-java-no-main-package/Dockerfile new file mode 100644 index 000000000..c6100ae44 --- /dev/null +++ b/test/integration/test-fixtures/image-java-no-main-package/Dockerfile @@ -0,0 +1,23 @@ +FROM jenkins:2.60.3 + +USER root + +WORKDIR /usr/share/jenkins + +RUN mkdir tmp + +WORKDIR /usr/share/jenkins/tmp + +RUN apt-get update 2>&1 > /dev/null && apt-get install -y less zip 2>&1 > /dev/null + +RUN unzip ../jenkins.war 2>&1 > /dev/null + +RUN rm -f ./META-INF/MANIFEST.MF + +WORKDIR /usr/share/jenkins + +RUN rm -rf jenkins.war + +RUN cd ./tmp && zip -r ../jenkins.war . && cd .. + +RUN rm -rf ./tmp