-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dfbcc9b
commit f65dfc5
Showing
13 changed files
with
390 additions
and
116 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
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 |
---|---|---|
@@ -1,11 +1,15 @@ | ||
# Server configurations | ||
server: | ||
host: "127.0.0.1" | ||
port: 8080 | ||
gin_mode: "release" # Set to "debug" for development | ||
# General system configurations | ||
system: | ||
log_level: "info" | ||
|
||
# API configurations | ||
# API related configurations | ||
api: | ||
server: | ||
host: "127.0.0.1" | ||
port: 8080 | ||
base_path: "/api" | ||
register_versions: | ||
- v1 | ||
|
||
# Faultdetector configurations | ||
fault_detector: |
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 was deleted.
Oops, something went wrong.
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,56 @@ | ||
package api | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/LiskHQ/op-fault-detector/pkg/log" | ||
"github.com/gin-gonic/gin" | ||
"github.com/magiconair/properties/assert" | ||
) | ||
|
||
func TestGetGinModeFromSysLogLevel(t *testing.T) { | ||
testCases := []struct { | ||
name string | ||
logLevel string | ||
wantGinMode string | ||
}{ | ||
{ | ||
name: "should return debug gin_mode with trace log_level", | ||
logLevel: log.LevelTrace, | ||
wantGinMode: gin.DebugMode, | ||
}, | ||
{ | ||
name: "should return debug gin_mode with debug log_level", | ||
logLevel: log.LevelDebug, | ||
wantGinMode: gin.DebugMode, | ||
}, | ||
{ | ||
name: "should return release gin_mode with info log_level", | ||
logLevel: log.LevelInfo, | ||
wantGinMode: gin.ReleaseMode, | ||
}, | ||
{ | ||
name: "should return release gin_mode with warn log_level", | ||
logLevel: log.LevelWarn, | ||
wantGinMode: gin.ReleaseMode, | ||
}, | ||
{ | ||
name: "should return release gin_mode with error log_level", | ||
logLevel: log.LevelError, | ||
wantGinMode: gin.ReleaseMode, | ||
}, | ||
{ | ||
name: "should return release gin_mode with fatal log_level", | ||
logLevel: log.LevelFatal, | ||
wantGinMode: gin.ReleaseMode, | ||
}, | ||
} | ||
|
||
t.Parallel() | ||
for _, tc := range testCases { | ||
t.Run(tc.name, func(t *testing.T) { | ||
gotGinMode := getGinModeFromSysLogLevel(tc.logLevel) | ||
assert.Equal(t, gotGinMode, tc.wantGinMode) | ||
}) | ||
} | ||
} |
Oops, something went wrong.