Add ability to configure object reaper interval for different executor types (#2543)

Added properties to configure object reaper interval, global and specific to exec type.

OBJECT_REAPER_INTERVAL - global
NEWDEPLOY_OBJECT_REAPER_INTERVAL - for new deploy type
CONTAINER_OBJECT_REAPER_INTERVAL - for container type
POOLMGR_OBJECT_REAPER_INTERVAL - for poolmgr
This commit is contained in:
Andrey Dudin
2022-09-23 11:35:13 +05:30
committed by GitHub
parent da50c3759d
commit 1102999b4d
9 changed files with 251 additions and 27 deletions
+81
View File
@@ -19,6 +19,7 @@ package utils
import (
"bytes"
"io"
"os"
"reflect"
"testing"
@@ -81,3 +82,83 @@ func TestGetChecksum(t *testing.T) {
})
}
}
func TestGetStringValueFromEnv(t *testing.T) {
varName := "TEST_VAR"
tests := []struct {
name string
value string
want string
wantErr bool
}{
{
name: "empty string case",
value: "",
want: "",
wantErr: true,
},
{
name: "string case",
value: "test sting",
want: "test sting",
wantErr: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
os.Setenv(varName, tt.value)
got, err := GetStringValueFromEnv(varName)
if (err != nil) != tt.wantErr {
t.Errorf("GetStringValueFromEnv() error = %v, wantErr %v, got %s", err, tt.wantErr, got)
return
}
})
}
}
func TestGetUIntValueFromEnv(t *testing.T) {
varName := "TEST_VAR"
tests := []struct {
name string
value string
want uint
wantErr bool
}{
{
name: "empty string case",
value: "",
want: 0,
wantErr: true,
},
{
name: "string case",
value: "test sting",
want: 0,
wantErr: true,
},
{
name: "not uint case",
value: "-100",
want: 0,
wantErr: true,
},
{
name: "uint case",
value: "7",
want: 7,
wantErr: false,
}}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
os.Setenv(varName, tt.value)
got, err := GetUIntValueFromEnv(varName)
if (err != nil) != tt.wantErr {
t.Errorf("GetUIntValueFromEnv() error = %v, wantErr %v, got %d", err, tt.wantErr, got)
return
}
})
}
}