Skip to content

Commit

Permalink
Add TackleTestapp analysis with deps
Browse files Browse the repository at this point in the history
Signed-off-by: Marek Aufart <maufart@redhat.com>
  • Loading branch information
aufi committed Sep 15, 2023
1 parent ac53206 commit 97ee5e8
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 14 deletions.
3 changes: 3 additions & 0 deletions analysis/analysis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ func TestApplicationAnalysis(t *testing.T) {
if tc.Rules.Path != "" { // TODO: better rules handling
taskData.Rules = tc.Rules
}
if tc.WithDeps == true {
taskData.Mode.WithDeps = true
}
tc.Task.Data = taskData
assert.Should(t, RichClient.Task.Create(&tc.Task))

Expand Down
7 changes: 0 additions & 7 deletions analysis/analyzer_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ var defaultAnalyzerData = addon.Data{
Targets: []string{},
Scope: addon.Scope{
WithKnown: false,
//Packages: {
// Included: []string{},
// Excluded: []string{},
//},
},
Rules: addon.Rules{
Path: "",
Expand All @@ -36,9 +32,6 @@ var defaultAnalyzerData = addon.Data{
"cloud-readiness",
},
},
//Tags: {
// Excluded: []string{},
//},
},
Tagger: addon.Tagger{
Enabled: true,
Expand Down
1 change: 1 addition & 0 deletions analysis/pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type TC struct {
Targets []string
Labels addon.Labels
Rules addon.Rules
WithDeps bool
// After-analysis assertions.
ReportContent map[string][]string
Analysis api.Analysis
Expand Down
16 changes: 9 additions & 7 deletions analysis/tc_tackle_testapp_public.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ import (
"github.com/konveyor/tackle2-hub/api"
)

var TackleTestappPublic = TC{
var TackleTestApp = api.Application{
Name: "Tackle Testapp public",
Application: api.Application{
Name: "Tackle Testapp public",
Repository: &api.Repository{
Kind: "git",
URL: "https://github.com/konveyor/tackle-testapp-public",
},
Repository: &api.Repository{
Kind: "git",
URL: "https://github.com/konveyor/tackle-testapp-public",
},
}

var TackleTestappPublic = TC{
Name: "Tackle Testapp public",
Application: TackleTestApp,
Task: Analyze,
Labels: addon.Labels{
Included: []string{
Expand Down
104 changes: 104 additions & 0 deletions analysis/tc_tackle_testapp_public_deps.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
package analysis

import (
"github.com/konveyor/go-konveyor-tests/hack/addon"
"github.com/konveyor/tackle2-hub/api"
)

var TackleTestappPublicDeps = TC{
Name: "Tackle Testapp public with deps",
Application: TackleTestApp,
Task: Analyze,
WithDeps: true,
Labels: addon.Labels{
Included: []string{
"konveyor.io/target=linux",
"konveyor.io/target=cloud-readiness",
},
},
Analysis: api.Analysis{
Effort: 10,
Issues: []api.Issue{
{
Category: "mandatory",
Description: "Hardcoded IP Address\nWhen migrating environments, hard-coded IP addresses may need to be modified or eliminated.",
Effort: 1,
RuleSet: "discovery-rules",
Rule: "hardcoded-ip-address",
Incidents: []api.Incident{
{
File: "/addon/source/tackle-testapp-public/target/classes/persistence.properties",
Line: 0, // Fix.
Message: "When migrating environments, hard-coded IP addresses may need to be modified or eliminated.",
},
{
File: "/addon/source/tackle-testapp-public/src/main/resources/persistence.properties",
Line: 0, // Fix.
Message: "When migrating environments, hard-coded IP addresses may need to be modified or eliminated.",
},
},
},
{
Category: "mandatory",
Description: "File system - Java IO\nAn application running inside a container could lose access to a file in local storage.. Recommendations. The following recommendations depend on the function of the file in local storage:. * Logging: Log to standard output and use a centralized log collector to analyze the logs.. * Caching: Use a cache backing service.. * Configuration: Store configuration settings in environment variables so that they can be updated without code changes.. * Data storage: Use a database backing service for relational data or use a persistent data storage system.. * Temporary data storage: Use the file system of a running container as a brief, single-transaction cache.",
Effort: 1,
RuleSet: "openshift",
Rule: "local-storage-00001",
Incidents: []api.Incident{
{
File: "/addon/source/tackle-testapp-public/src/main/java/io/konveyor/demo/ordermanagement/config/PersistenceConfig.java",
Line: 0, // Fix.
Message: "An application running inside a container could lose access to a file in local storage.. Recommendations. The following recommendations depend on the function of the file in local storage:. * Logging: Log to standard output and use a centralized log collector to analyze the logs.. * Caching: Use a cache backing service.. * Configuration: Store configuration settings in environment variables so that they can be updated without code changes.. * Data storage: Use a database backing service for relational data or use a persistent data storage system.. * Temporary data storage: Use the file system of a running container as a brief, single-transaction cache.",
},
{
File: "/addon/source/tackle-testapp-public/src/main/java/io/konveyor/demo/ordermanagement/config/PersistenceConfig.java",
Line: 0, // Fix.
Message: "An application running inside a container could lose access to a file in local storage.. Recommendations. The following recommendations depend on the function of the file in local storage:. * Logging: Log to standard output and use a centralized log collector to analyze the logs.. * Caching: Use a cache backing service.. * Configuration: Store configuration settings in environment variables so that they can be updated without code changes.. * Data storage: Use a database backing service for relational data or use a persistent data storage system.. * Temporary data storage: Use the file system of a running container as a brief, single-transaction cache.",
},
{
File: "/addon/source/tackle-testapp-public/src/main/java/io/konveyor/demo/ordermanagement/config/PersistenceConfig.java",
Line: 0, // Fix.
Message: "An application running inside a container could lose access to a file in local storage.. Recommendations. The following recommendations depend on the function of the file in local storage:. * Logging: Log to standard output and use a centralized log collector to analyze the logs.. * Caching: Use a cache backing service.. * Configuration: Store configuration settings in environment variables so that they can be updated without code changes.. * Data storage: Use a database backing service for relational data or use a persistent data storage system.. * Temporary data storage: Use the file system of a running container as a brief, single-transaction cache.",
},
{
File: "/addon/source/tackle-testapp-public/src/main/java/io/konveyor/demo/ordermanagement/config/PersistenceConfig.java",
Line: 0, // Fix.
Message: "An application running inside a container could lose access to a file in local storage.. Recommendations. The following recommendations depend on the function of the file in local storage:. * Logging: Log to standard output and use a centralized log collector to analyze the logs.. * Caching: Use a cache backing service.. * Configuration: Store configuration settings in environment variables so that they can be updated without code changes.. * Data storage: Use a database backing service for relational data or use a persistent data storage system.. * Temporary data storage: Use the file system of a running container as a brief, single-transaction cache.",
},
{
File: "/addon/source/tackle-testapp-public/src/main/java/io/konveyor/demo/ordermanagement/config/PersistenceConfig.java",
Line: 0, // Fix.
Message: "An application running inside a container could lose access to a file in local storage.. Recommendations. The following recommendations depend on the function of the file in local storage:. * Logging: Log to standard output and use a centralized log collector to analyze the logs.. * Caching: Use a cache backing service.. * Configuration: Store configuration settings in environment variables so that they can be updated without code changes.. * Data storage: Use a database backing service for relational data or use a persistent data storage system.. * Temporary data storage: Use the file system of a running container as a brief, single-transaction cache.",
},
{
File: "/addon/source/tackle-testapp-public/src/main/java/io/konveyor/demo/ordermanagement/config/PersistenceConfig.java",
Line: 0, // Fix.
Message: "An application running inside a container could lose access to a file in local storage.. Recommendations. The following recommendations depend on the function of the file in local storage:. * Logging: Log to standard output and use a centralized log collector to analyze the logs.. * Caching: Use a cache backing service.. * Configuration: Store configuration settings in environment variables so that they can be updated without code changes.. * Data storage: Use a database backing service for relational data or use a persistent data storage system.. * Temporary data storage: Use the file system of a running container as a brief, single-transaction cache.",
},
{
File: "/addon/source/tackle-testapp-public/src/main/java/io/konveyor/demo/ordermanagement/config/PersistenceConfig.java",
Line: 0, // Fix.
Message: "An application running inside a container could lose access to a file in local storage.. Recommendations. The following recommendations depend on the function of the file in local storage:. * Logging: Log to standard output and use a centralized log collector to analyze the logs.. * Caching: Use a cache backing service.. * Configuration: Store configuration settings in environment variables so that they can be updated without code changes.. * Data storage: Use a database backing service for relational data or use a persistent data storage system.. * Temporary data storage: Use the file system of a running container as a brief, single-transaction cache.",
},
},
},
{
Category: "mandatory",
Description: "Windows file system path\nThis file system path is Microsoft Windows platform dependent. It needs to be replaced with a Linux-style path.",
Effort: 1,
RuleSet: "os/windows",
Rule: "os-specific-00001",
Incidents: []api.Incident{
{
File: "/addon/source/tackle-testapp-public/.git/hooks/fsmonitor-watchman.sample",
Line: 0, // Fix.
Message: "This file system path is Microsoft Windows platform dependent. It needs to be replaced with a Linux-style path.",
},
},
},
},
},
AnalysisTags: []api.Tag{
// Fix.
},
}

0 comments on commit 97ee5e8

Please sign in to comment.