From 304402533d2214c2a4d18014ad7825c294481651 Mon Sep 17 00:00:00 2001 From: DmitriyLewen Date: Mon, 22 Jan 2024 17:33:30 +0600 Subject: [PATCH] test: check properties for nested depManagement --- pkg/golang/mod/testdata/no-go-version/go.mod | 43 ++++++++++++++++++- pkg/java/pom/parse_test.go | 6 +-- .../example-dependency-management-3.3.3.pom | 10 ++++- .../example-dependency-management2-3.3.3.pom | 27 ++++++++++++ .../example-dependency-management3-2.2.2.pom | 26 +++++++++++ 5 files changed, 107 insertions(+), 5 deletions(-) create mode 100644 pkg/java/pom/testdata/repository/org/example/example-dependency-management2/3.3.3/example-dependency-management2-3.3.3.pom create mode 100644 pkg/java/pom/testdata/repository/org/example/example-dependency-management3/2.2.2/example-dependency-management3-2.2.2.pom diff --git a/pkg/golang/mod/testdata/no-go-version/go.mod b/pkg/golang/mod/testdata/no-go-version/go.mod index a95a8f7e..2d1f5546 100644 --- a/pkg/golang/mod/testdata/no-go-version/go.mod +++ b/pkg/golang/mod/testdata/no-go-version/go.mod @@ -1,3 +1,44 @@ module github.com/org/repo -require github.com/aquasecurity/go-dep-parser v0.0.0-20211224170007-df43bca6b6ff \ No newline at end of file +go 1.21.1 + +require github.com/aquasecurity/go-dep-parser v0.0.0-20211224170007-df43bca6b6ff + +require ( + github.com/BurntSushi/toml v0.4.1 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/google/renameio v0.1.0 // indirect + github.com/hashicorp/errwrap v1.0.0 // indirect + github.com/hashicorp/go-cleanhttp v0.5.1 // indirect + github.com/hashicorp/go-hclog v0.9.2 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect + github.com/hashicorp/go-retryablehttp v0.7.0 // indirect + github.com/kisielk/gotool v1.0.0 // indirect + github.com/kr/pretty v0.1.0 // indirect + github.com/kr/pty v1.1.1 // indirect + github.com/kr/text v0.1.0 // indirect + github.com/pkg/errors v0.8.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/rogpeppe/go-internal v1.3.0 // indirect + github.com/stretchr/objx v0.1.0 // indirect + github.com/stretchr/testify v1.7.0 // indirect + go.uber.org/atomic v1.6.0 // indirect + go.uber.org/multierr v1.5.0 // indirect + go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee // indirect + go.uber.org/zap v1.16.0 // indirect + golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529 // indirect + golang.org/x/lint v0.0.0-20190930215403-16217165b5de // indirect + golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e // indirect + golang.org/x/net v0.0.0-20210119194325-5f4716e94777 // indirect + golang.org/x/sync v0.0.0-20190423024810-112230192c58 // indirect + golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 // indirect + golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect + golang.org/x/text v0.3.3 // indirect + golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5 // indirect + golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect + gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect + gopkg.in/errgo.v2 v2.1.0 // indirect + gopkg.in/yaml.v2 v2.2.2 // indirect + gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect + honnef.co/go/tools v0.0.1-2019.2.3 // indirect +) diff --git a/pkg/java/pom/parse_test.go b/pkg/java/pom/parse_test.go index b3fe122d..1af6deb8 100644 --- a/pkg/java/pom/parse_test.go +++ b/pkg/java/pom/parse_test.go @@ -562,16 +562,16 @@ func TestPom_Parse(t *testing.T) { License: "Apache 2.0", }, { - ID: "org.example:example-api:1.1.1", + ID: "org.example:example-api:2.2.2", Name: "org.example:example-api", - Version: "1.1.1", + Version: "2.2.2", }, }, wantDeps: []types.Dependency{ { ID: "com.example:import:2.0.0", DependsOn: []string{ - "org.example:example-api:1.1.1", + "org.example:example-api:2.2.2", }, }, }, diff --git a/pkg/java/pom/testdata/repository/org/example/example-dependency-management/3.3.3/example-dependency-management-3.3.3.pom b/pkg/java/pom/testdata/repository/org/example/example-dependency-management/3.3.3/example-dependency-management-3.3.3.pom index b7fc92f4..eba546a3 100644 --- a/pkg/java/pom/testdata/repository/org/example/example-dependency-management/3.3.3/example-dependency-management-3.3.3.pom +++ b/pkg/java/pom/testdata/repository/org/example/example-dependency-management/3.3.3/example-dependency-management-3.3.3.pom @@ -17,11 +17,19 @@ org.example example-dependency-management2 - 1.1.1 + ${project.version} import pom + + + org.example + example-dependency + 1.2.3 + + + \ No newline at end of file diff --git a/pkg/java/pom/testdata/repository/org/example/example-dependency-management2/3.3.3/example-dependency-management2-3.3.3.pom b/pkg/java/pom/testdata/repository/org/example/example-dependency-management2/3.3.3/example-dependency-management2-3.3.3.pom new file mode 100644 index 00000000..a06e16c3 --- /dev/null +++ b/pkg/java/pom/testdata/repository/org/example/example-dependency-management2/3.3.3/example-dependency-management2-3.3.3.pom @@ -0,0 +1,27 @@ + + + + 4.0.0 + + org.example + example-dependency-management2 + 3.3.3 + + pom + Example API Dependency Management + The example API + + + + + org.example + example-dependency-management3 + 2.2.2 + import + pom + + + + + diff --git a/pkg/java/pom/testdata/repository/org/example/example-dependency-management3/2.2.2/example-dependency-management3-2.2.2.pom b/pkg/java/pom/testdata/repository/org/example/example-dependency-management3/2.2.2/example-dependency-management3-2.2.2.pom new file mode 100644 index 00000000..29e3ed5b --- /dev/null +++ b/pkg/java/pom/testdata/repository/org/example/example-dependency-management3/2.2.2/example-dependency-management3-2.2.2.pom @@ -0,0 +1,26 @@ + + + + 4.0.0 + + org.example + example-dependency-management3 + 2.2.2 + + pom + Example API Dependency Management + The example API + + + + + + org.example + example-api + ${project.version} + + + + +