Skip to content

Commit

Permalink
Adding binary analysis to TIER3
Browse files Browse the repository at this point in the history
Signed-off-by: Maayan Hadasi <mguetta@redhat.com>
  • Loading branch information
mguetta1 committed Jan 17, 2024
1 parent 69fb77f commit e48f285
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ test-tier3:
$(MAKE) test-jira
$(MAKE) test-migrationwave

mguetta-test:
TIER3=1 $(MAKE) test-analysis

#
# Feature tests.
#
Expand Down
7 changes: 7 additions & 0 deletions analysis/analysis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ func TestApplicationAnalysis(t *testing.T) {
if tier2 {
testCases = Tier2TestCases
}
_, tier3 := os.LookupEnv("TIER3")
if tier3 {
testCases = Tier3TestCases
}
// Run test cases.
for _, testcase := range testCases {
t.Run(testcase.Name, func(t *testing.T) {
Expand Down Expand Up @@ -106,6 +110,9 @@ func TestApplicationAnalysis(t *testing.T) {
if tc.WithDeps == true {
taskData.Mode.WithDeps = true
}
if tc.Binary {
taskData.Mode.Binary = true
}
if tc.Scope != nil {
taskData.Scope = *tc.Scope
}
Expand Down
1 change: 1 addition & 0 deletions analysis/pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type TC struct {
Rules addon.Rules
Scope *addon.Scope
WithDeps bool
Binary bool
// After-analysis assertions.
ReportContent map[string][]string
Analysis api.Analysis
Expand Down
31 changes: 31 additions & 0 deletions analysis/tc_tackle_testapp_private.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package analysis

import (
"github.com/konveyor/go-konveyor-tests/data"
"github.com/konveyor/go-konveyor-tests/data/identity"
"github.com/konveyor/tackle2-hub/api"
)

var TackleTestappPrivateBinary = TC{
Name: "tackle-testapp-binary",
Application: data.TackleTestapp,
Identities: []api.Identity{
identity.TackleTestappMaven,
},
Task: Analyze,
Targets: []string{
"cloud-readiness",
},
Analysis: api.Analysis{
Effort: 16,
Issues: []api.Issue{
{Category: "mandatory", Description: "Java native libraries (JNI, JNA)", Effort: 7, Rule: "jni-native-code-00000"},
{Category: "mandatory", Description: "File system - Java IO", Effort: 1, Rule: "local-storage-00001"},
{Category: "potential", Description: "Java Servlet", Effort: 0, Rule: "javaee-technology-usage-00120"},
},
},
AnalysisTags: []api.Tag{
{Name: "Servlet"},
{Name: "Java Threads"},
},
}
6 changes: 6 additions & 0 deletions analysis/test_cases.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,9 @@ var Tier2TestCases = []TC{
ApacheWicket,
SeamBooking,
}

// Tier 3 Analysis test cases - should work
// List of applications with expected analysis outputs.
var Tier3TestCases = []TC {
TackleTestappPrivateBinary,
}
3 changes: 1 addition & 2 deletions config/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"KUBECONFIG": "",
"RETRY_NUM": "10",
"KEEP": "0"
"RETRY_NUM": "10"
}
2 changes: 2 additions & 0 deletions config/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ type Configuration struct {
JIRA_SERVER_USERNAME string `env:"JIRA_SERVER_USERNAME"`
JIRA_SERVER_PASSWORD string `env:"JIRA_SERVER_PASSWORD"`
JIRA_SERVER_TOKEN string `env:"JIRA_SERVER_TOKEN"`
MAVEN_TESTAPP_USER string `env:"MAVEN_TESTAPP_USER"`
MAVEN_TESTAPP_TOKEN string `env:"MAVEN_TESTAPP_TOKEN"`

RETRY_NUM string `env:"RETRY_NUM"`
KEEP string `env:"KEEP"`
Expand Down
4 changes: 2 additions & 2 deletions data/application_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ var (
URL: "https://github.com/ibraginsky/book-server",
},
}
tackleTestapp = api.Application{
TackleTestapp = api.Application{
Name: "tackle-testapp",
Repository: &api.Repository{
Kind: "subversion",
URL: "https://github.com/konveyor/tackle-testapp",
},
Binary: "io.konveyor.demo:customers-tomcat:0.0.1-SNAPSHOT:war",
}
ApplicationSamples = []api.Application{Minimal, PathfinderGit, BookServer, tackleTestapp}
ApplicationSamples = []api.Application{Minimal, PathfinderGit, BookServer, TackleTestapp}
)
58 changes: 58 additions & 0 deletions data/identity/identity_data.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package identity

import "github.com/konveyor/tackle2-hub/api"

var TackleTestappMaven = api.Identity{
Kind: "maven",
Name: "maven-creds",
Settings: `<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 http://maven.apache.org/xsd/settings-1.2.0.xsd">
<pluginGroups>
</pluginGroups>
<proxies>
</proxies>
<servers>
<server>
<id>tackle-testapp</id>
<username>GITHUB_USER</username>
<password>GITHUB_TOKEN</password>
</server>
</servers>
<mirrors>
<mirror>
<id>maven-default-http-blocker</id>
<mirrorOf>external:http:*</mirrorOf>
<name>Pseudo repository to mirror external repositories initially using HTTP.</name>
<url>http://0.0.0.0/</url>
<blocked>true</blocked>
</mirror>
</mirrors>
<profiles>
<profile>
<id>github</id>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
</repository>
<repository>
<id>tackle-testapp</id>
<url>https://maven.pkg.github.com/konveyor/tackle-testapp</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>github</activeProfile>
</activeProfiles>
</settings>`,
}

0 comments on commit e48f285

Please sign in to comment.