diff --git a/.github/workflows/main-tier0.yml b/.github/workflows/main-tier0.yml index a1a892a..41086b2 100644 --- a/.github/workflows/main-tier0.yml +++ b/.github/workflows/main-tier0.yml @@ -28,3 +28,6 @@ jobs: run: | go install github.com/onsi/ginkgo/v2/ginkgo - run: HUB_BASE_URL="http://$(minikube ip)/hub" DEBUG=1 make test-tier0 + env: + MAVEN_TESTAPP_USER: ${{ secrets.MAVEN_TESTAPP_USER }} + MAVEN_TESTAPP_TOKEN: ${{ secrets.MAVEN_TESTAPP_TOKEN }} diff --git a/.github/workflows/nightly-tier0.yml b/.github/workflows/nightly-tier0.yml index 01b509d..81f8797 100644 --- a/.github/workflows/nightly-tier0.yml +++ b/.github/workflows/nightly-tier0.yml @@ -22,3 +22,6 @@ jobs: run: | go install github.com/onsi/ginkgo/v2/ginkgo - run: HUB_BASE_URL="http://$(minikube ip)/hub" DEBUG=1 make test-tier0 + env: + MAVEN_TESTAPP_USER: ${{ secrets.MAVEN_TESTAPP_USER }} + MAVEN_TESTAPP_TOKEN: ${{ secrets.MAVEN_TESTAPP_TOKEN }} diff --git a/analysis/analysis_test.go b/analysis/analysis_test.go index 5573f71..f5cf0c5 100644 --- a/analysis/analysis_test.go +++ b/analysis/analysis_test.go @@ -36,6 +36,16 @@ func TestApplicationAnalysis(t *testing.T) { t.Parallel() } + // Prepare Identities, e.g. for Maven repo + for _, identity := range tc.Identities { + if identity.Kind == "maven" { + strings.Replace(identity.Settings, "GITHUB_USER", os.Getenv("MAVEN_TESTAPP_USER"), 1) + strings.Replace(identity.Settings, "GITHUB_TOKEN", os.Getenv("MAVEN_TESTAPP_TOKEN"), 1) + } + assert.Should(t, RichClient.Identity.Create(&identity)) + tc.Application.Identities = append(tc.Application.Identities, api.Ref{ID: identity.ID}) + } + // Create the application. uniq.ApplicationName(&tc.Application) assert.Should(t, RichClient.Application.Create(&tc.Application)) @@ -226,6 +236,12 @@ func TestApplicationAnalysis(t *testing.T) { if keep { return } + + // Cleanup Identities. + for _, r := range tc.Application.Identities { + assert.Should(t, RichClient.Identity.Delete(r.ID)) + } + // Cleanup Application. assert.Must(t, RichClient.Application.Delete(tc.Application.ID)) diff --git a/analysis/pkg.go b/analysis/pkg.go index 718c588..86e6049 100644 --- a/analysis/pkg.go +++ b/analysis/pkg.go @@ -35,6 +35,7 @@ type TC struct { // Application and other test data declaration. Application api.Application // Required. CustomRules []api.RuleSet + Identities []api.Identity // Analysis parameters. Task api.Task TaskData string diff --git a/analysis/tc_tackle_testapp_public_deps.go b/analysis/tc_tackle_testapp_public_deps.go index d28a71c..d8cb20a 100644 --- a/analysis/tc_tackle_testapp_public_deps.go +++ b/analysis/tc_tackle_testapp_public_deps.go @@ -3,8 +3,11 @@ package analysis import ( "github.com/konveyor/go-konveyor-tests/hack/addon" "github.com/konveyor/tackle2-hub/api" + "github.com/konveyor/tackle2-hub/test/api/identity" ) +var MavenPublic = identity.Mvn + var TackleTestappPublicWithDeps = TC{ Name: "Tackle Testapp public with deps", Application: TackleTestApp, @@ -16,6 +19,9 @@ var TackleTestappPublicWithDeps = TC{ "konveyor.io/target=cloud-readiness", }, }, + Identities: []api.Identity{ + MavenPublic, // Tackle Testapp public Maven registry expects MAVEN_TESTAPP_USER and MAVEN_TESTAPP_TOKEN env variables. + }, Analysis: api.Analysis{ Effort: 9, Issues: []api.Issue{ @@ -84,49 +90,24 @@ var TackleTestappPublicWithDeps = TC{ }, }, Dependencies: []api.TechDependency{ - { - Name: "com.fasterxml.jackson.jackson-bom", - Version: "${jackson.version}", - Provider: "", - }, - { - Name: "org.springframework.data.spring-data-bom", - Version: "${spring-data.version}", - Provider: "", - }, { Name: "org.apache.tomcat.tomcat-servlet-api", - Version: "${tomcat.version}", - Provider: "", - }, - { - Name: "com.fasterxml.jackson.core.jackson-core", - Version: "", - Provider: "", - }, - { - Name: "com.fasterxml.jackson.core.jackson-databind", - Version: "", - Provider: "", - }, - { - Name: "org.springframework.data.spring-data-jpa", - Version: "", + Version: "9.0.46", Provider: "", }, { Name: "org.springframework.spring-jdbc", - Version: "${spring-framework.version}", + Version: "5.3.7", Provider: "", }, { Name: "org.springframework.spring-webmvc", - Version: "${spring-framework.version}", + Version: "5.3.7", Provider: "", }, { Name: "org.springframework.spring-web", - Version: "${spring-framework.version}", + Version: "5.3.7", Provider: "", }, { @@ -136,17 +117,17 @@ var TackleTestappPublicWithDeps = TC{ }, { Name: "org.apache.tomcat.tomcat-jdbc", - Version: "${tomcat.version}", + Version: "9.0.46", Provider: "", }, { Name: "org.hibernate.hibernate-entitymanager", - Version: "${hibernate.version}", + Version: "5.4.32.Final", Provider: "", }, { Name: "org.hibernate.validator.hibernate-validator", - Version: "${hibernate-validator.version}", + Version: "6.2.0.Final", Provider: "", }, { @@ -174,6 +155,16 @@ var TackleTestappPublicWithDeps = TC{ Version: "1.0.0", Provider: "", }, + { + Name: "com.fasterxml.jackson.jackson-bom", + Version: "2.12.3", + Provider: "", + }, + { + Name: "org.springframework.data.spring-data-bom", + Version: "2021.0.1", + Provider: "", + }, }, }, AnalysisTags: []api.Tag{ @@ -181,13 +172,16 @@ var TackleTestappPublicWithDeps = TC{ {Name: "Servlet", Category: api.Ref{Name: "HTTP"}}, {Name: "Properties", Category: api.Ref{Name: "Other"}}, {Name: "Java EE Batch", Category: api.Ref{Name: "Processing"}}, - {Name: "Java EE Batch", Category: api.Ref{Name: "Java EE"}}, + {Name: "Spring Web", Category: api.Ref{Name: "Web"}}, + {Name: "EJB XML", Category: api.Ref{Name: "Connect"}}, {Name: "Servlet", Category: api.Ref{Name: "Java EE"}}, {Name: "EJB XML", Category: api.Ref{Name: "Java EE"}}, {Name: "Properties", Category: api.Ref{Name: "Sustain"}}, {Name: "Properties", Category: api.Ref{Name: "Embedded"}}, {Name: "Java EE Batch", Category: api.Ref{Name: "Execute"}}, - {Name: "EJB XML", Category: api.Ref{Name: "Connect"}}, + {Name: "Java EE Batch", Category: api.Ref{Name: "Java EE"}}, {Name: "Servlet", Category: api.Ref{Name: "Connect"}}, + {Name: "Spring Web", Category: api.Ref{Name: "View"}}, + {Name: "Spring Web", Category: api.Ref{Name: "Embedded"}}, }, } diff --git a/analysis/test_cases.go b/analysis/test_cases.go index 79750f9..e5741ea 100644 --- a/analysis/test_cases.go +++ b/analysis/test_cases.go @@ -5,6 +5,7 @@ package analysis // List of applications with expected analysis outputs. var Tier0TestCases = []TC{ TackleTestappPublic, + TackleTestappPublicWithDeps, } // @@ -18,7 +19,6 @@ var Tier1TestCases = []TC{ // Tier 2 Analysis test cases - great if works. // List of applications with expected analysis outputs. var Tier2TestCases = []TC{ - TackleTestappPublicWithDeps, Tomcat, Daytrader, PetclinicHazelcast,