-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove prefixes from the sonar-scanner cli output
Fix typo
- Loading branch information
1 parent
035bce5
commit 4beb848
Showing
6 changed files
with
92 additions
and
24 deletions.
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 |
---|---|---|
|
@@ -8,3 +8,4 @@ Dockerfile | |
bin | ||
action-entrypoint.sh | ||
action.yml | ||
run.sh |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.idea | ||
.vscode | ||
bin | ||
run.sh |
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
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
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
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,66 @@ | ||
package sonarscanner | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/sirupsen/logrus" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestGetLevelAndMessage(t *testing.T) { | ||
assertLevelAndMessage( | ||
t, | ||
logrus.InfoLevel, | ||
"message with no level", | ||
logrus.InfoLevel, | ||
"message with no level", | ||
) | ||
assertLevelAndMessage( | ||
t, | ||
logrus.InfoLevel, | ||
"DEBUG: debug message", | ||
logrus.DebugLevel, | ||
"debug message", | ||
) | ||
assertLevelAndMessage( | ||
t, | ||
logrus.DebugLevel, | ||
"INFO: info message", | ||
logrus.InfoLevel, | ||
"info message", | ||
) | ||
assertLevelAndMessage( | ||
t, | ||
logrus.DebugLevel, | ||
"WARN: warning message", | ||
logrus.WarnLevel, | ||
"warning message", | ||
) | ||
assertLevelAndMessage( | ||
t, | ||
logrus.DebugLevel, | ||
"ERROR: error message", | ||
logrus.ErrorLevel, | ||
"error message", | ||
) | ||
assertLevelAndMessage( | ||
t, | ||
logrus.DebugLevel, | ||
"17:05:12.779 ERROR: error message with the timestamp", | ||
logrus.ErrorLevel, | ||
"error message with the timestamp", | ||
) | ||
} | ||
|
||
func assertLevelAndMessage( | ||
t *testing.T, | ||
level logrus.Level, | ||
message string, | ||
expectedLevel logrus.Level, | ||
expectedMessage string, | ||
) { | ||
actualLevel, actualMessage := getLevelAndMessage(level, message) | ||
|
||
assert.Equal(t, expectedLevel, actualLevel) | ||
assert.Equal(t, expectedMessage, actualMessage) | ||
} |