Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
44e0e686
authored
Jun 22, 2026
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add channel test env toggle
parent
0b7ae4ea
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
0 deletions
+49
-0
setting/operation_setting/monitor_setting.go
+6
-0
setting/operation_setting/monitor_setting_test.go
+43
-0
No files found.
setting/operation_setting/monitor_setting.go
View file @
44e0e686
...
@@ -31,5 +31,11 @@ func GetMonitorSetting() *MonitorSetting {
...
@@ -31,5 +31,11 @@ func GetMonitorSetting() *MonitorSetting {
monitorSetting
.
AutoTestChannelMinutes
=
float64
(
frequency
)
monitorSetting
.
AutoTestChannelMinutes
=
float64
(
frequency
)
}
}
}
}
if
enabled
,
ok
:=
os
.
LookupEnv
(
"CHANNEL_TEST_ENABLED"
);
ok
{
parsed
,
err
:=
strconv
.
ParseBool
(
enabled
)
if
err
==
nil
{
monitorSetting
.
AutoTestChannelEnabled
=
parsed
}
}
return
&
monitorSetting
return
&
monitorSetting
}
}
setting/operation_setting/monitor_setting_test.go
0 → 100644
View file @
44e0e686
package
operation_setting
import
(
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func
TestGetMonitorSetting_ChannelTestEnabledEnvOverridesEnabledConfig
(
t
*
testing
.
T
)
{
orig
:=
monitorSetting
t
.
Cleanup
(
func
()
{
monitorSetting
=
orig
})
t
.
Setenv
(
"CHANNEL_TEST_ENABLED"
,
"false"
)
t
.
Setenv
(
"CHANNEL_TEST_FREQUENCY"
,
"5"
)
monitorSetting
=
MonitorSetting
{
AutoTestChannelEnabled
:
true
,
AutoTestChannelMinutes
:
20
,
}
setting
:=
GetMonitorSetting
()
require
.
NotNil
(
t
,
setting
)
assert
.
False
(
t
,
setting
.
AutoTestChannelEnabled
)
assert
.
Equal
(
t
,
float64
(
5
),
setting
.
AutoTestChannelMinutes
)
}
func
TestGetMonitorSetting_ChannelTestEnabledEnvCanEnableDisabledConfig
(
t
*
testing
.
T
)
{
orig
:=
monitorSetting
t
.
Cleanup
(
func
()
{
monitorSetting
=
orig
})
t
.
Setenv
(
"CHANNEL_TEST_ENABLED"
,
"true"
)
monitorSetting
=
MonitorSetting
{
AutoTestChannelEnabled
:
false
,
AutoTestChannelMinutes
:
12
,
}
setting
:=
GetMonitorSetting
()
require
.
NotNil
(
t
,
setting
)
assert
.
True
(
t
,
setting
.
AutoTestChannelEnabled
)
assert
.
Equal
(
t
,
float64
(
12
),
setting
.
AutoTestChannelMinutes
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment