generated from konveyor-ecosystem/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RFR] [TA] Add nodejs provider analysis test (#32)
- Loading branch information
Showing
8 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
function testFunction() { | ||
return "Hello, world!"; | ||
} | ||
|
||
testFunction(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"nodejs_app_project": { | ||
"app_name": "nodejs_app", | ||
"file_name": "nodejs_app", | ||
"target": "quarkus", | ||
"source": "" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
- message: python sample rule 001 | ||
ruleID: python-sample-rule-001 | ||
description: sample-rule-1 - this should appear as an issue | ||
effort: 1 | ||
when: | ||
python.referenced: | ||
pattern: "hello_world" | ||
- message: python sample rule 002 | ||
ruleID: python-sample-rule-002 | ||
description: sample-rule-2 - this should appear as an issue | ||
effort: 5 | ||
when: | ||
python.referenced: | ||
pattern: "speak" | ||
- message: python sample rule 003 | ||
ruleID: python-sample-rule-003 | ||
description: sample-rule-3 - this should appear as an insight | ||
when: | ||
python.referenced: | ||
pattern: "create_custom_resource_definition" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import os | ||
import subprocess | ||
|
||
from utils import constants | ||
from utils.command import build_analysis_command | ||
from utils.report import get_json_from_report_output_file | ||
|
||
|
||
# Polarion TC MTA-542 | ||
def test_nodejs_provider_analysis(nodejs_analysis_data): | ||
application_data = nodejs_analysis_data['nodejs_app_project'] | ||
custom_rules_path = os.path.join(os.getenv(constants.PROJECT_PATH), 'data/yaml', 'python_rules.yaml') | ||
command = build_analysis_command( | ||
application_data['file_name'], | ||
application_data['source'], | ||
application_data['target'], | ||
**{'rules': custom_rules_path, | ||
'provider': "nodejs"} | ||
) | ||
|
||
output = subprocess.run(command, shell=True, check=True, stdout=subprocess.PIPE, encoding='utf-8').stdout | ||
|
||
assert 'Static report created' in output |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import os | ||
import subprocess | ||
|
||
from utils import constants | ||
from utils.command import build_analysis_command | ||
|
||
|
||
# Polarion TC MTA-542 | ||
def test_nodejs_provider_analysis(nodejs_analysis_data): | ||
application_data = nodejs_analysis_data['nodejs_app_project'] | ||
# TODO: replace with a nodejs rule when available and validate them | ||
custom_rules_path = os.path.join(os.getenv(constants.PROJECT_PATH), 'data/yaml', 'python_rules.yaml') | ||
command = build_analysis_command( | ||
application_data['file_name'], | ||
application_data['source'], | ||
application_data['target'], | ||
**{'rules': custom_rules_path, | ||
'provider': "nodejs"} | ||
) | ||
|
||
output = subprocess.run(command, shell=True, check=True, stdout=subprocess.PIPE, encoding='utf-8').stdout | ||
|
||
assert 'Static report created' in output |