feedback
This commit is contained in:
Родитель
a537451ab1
Коммит
d6fedcb57e
|
@ -62,12 +62,15 @@ const (
|
|||
"memoryLimitInBytes": {
|
||||
"description": "Optional - specifies the max memory that vmwatch can use",
|
||||
"type": "integer",
|
||||
"default": 80000000
|
||||
"default": 80000000,
|
||||
"minimum": 30000000
|
||||
},
|
||||
"macCpuPercentage": {
|
||||
"maxCpuPercentage": {
|
||||
"description": "Optional - specifies the max cpu that the vmwatch process is allowed to consume",
|
||||
"type": "integer",
|
||||
"default": 1
|
||||
"default": 1,
|
||||
"minimum": 1,
|
||||
"maximum": 100
|
||||
},
|
||||
"signalFilters" : {
|
||||
"description": "Optional - specify filtering for signals, if not specified, all core signals will be enabled",
|
||||
|
|
|
@ -154,3 +154,22 @@ func TestValidatePublicSettings_gracePeriod(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidatePublicSettings_vmwatch(t *testing.T) {
|
||||
require.Nil(t, validatePublicSettings(`{"port": 1, "vmWatchSettings" : { "enabled" : false }}`), "valid settings")
|
||||
require.Nil(t, validatePublicSettings(`{"port": 1, "vmWatchSettings" : { "enabled" : true }}`), "valid settings")
|
||||
require.Nil(t, validatePublicSettings(`{"port": 1, "vmWatchSettings" : { "enabled" : true, "memoryLimitInBytes" : 30000000 }}`), "valid settings")
|
||||
|
||||
err := validatePublicSettings(`{"port": 1, "vmWatchSettings" : { "enabled" : true, "memoryLimitInBytes" : 20000000 }}`)
|
||||
require.NotNil(t, err)
|
||||
require.Contains(t, err.Error(), "vmWatchSettings.memoryLimitInBytes: Must be greater than or equal to 30000000")
|
||||
|
||||
err = validatePublicSettings(`{"port": 1, "vmWatchSettings" : { "enabled" : true, "maxCpuPercentage" : 0 }}`)
|
||||
require.NotNil(t, err)
|
||||
require.Contains(t, err.Error(), "vmWatchSettings.maxCpuPercentage: Must be greater than or equal to 1")
|
||||
|
||||
err = validatePublicSettings(`{"port": 1, "vmWatchSettings" : { "enabled" : true, "maxCpuPercentage" : 101 }}`)
|
||||
require.NotNil(t, err)
|
||||
require.Contains(t, err.Error(), "vmWatchSettings.maxCpuPercentage: Must be less than or equal to 100")
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче