mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-05-03 06:22:56 +03:00
Pull request: all: support setgid, setuid on unix
Updates #2763. Squashed commit of the following: commit bd2077c6569b53ae341a58aa73de6063d7037e8e Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Jun 4 16:25:17 2021 +0300 all: move rlimit_nofile, imp docs commit ba95d4ab7c722bf83300d626a598aface37539ad Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Jun 4 15:12:23 2021 +0300 all: support setgid, setuid on unix
This commit is contained in:
parent
3b87478470
commit
48c44c29ab
14 changed files with 283 additions and 31 deletions
internal/home
|
@ -368,3 +368,50 @@ func TestUpgradeSchema9to10(t *testing.T) {
|
|||
assert.Equal(t, "unexpected type of dns: int", err.Error())
|
||||
})
|
||||
}
|
||||
|
||||
func TestUpgradeSchema10to11(t *testing.T) {
|
||||
check := func(t *testing.T, conf yobj) {
|
||||
rlimit, _ := conf["rlimit_nofile"].(int)
|
||||
|
||||
err := upgradeSchema10to11(conf)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, conf["schema_version"], 11)
|
||||
|
||||
_, ok := conf["rlimit_nofile"]
|
||||
assert.False(t, ok)
|
||||
|
||||
osVal, ok := conf["os"]
|
||||
require.True(t, ok)
|
||||
|
||||
newOSConf, ok := osVal.(yobj)
|
||||
require.True(t, ok)
|
||||
|
||||
_, ok = newOSConf["group"]
|
||||
assert.True(t, ok)
|
||||
|
||||
_, ok = newOSConf["user"]
|
||||
assert.True(t, ok)
|
||||
|
||||
rlimitVal, ok := newOSConf["rlimit_nofile"].(int)
|
||||
require.True(t, ok)
|
||||
|
||||
assert.Equal(t, rlimit, rlimitVal)
|
||||
}
|
||||
|
||||
const rlimit = 42
|
||||
t.Run("with_rlimit", func(t *testing.T) {
|
||||
conf := yobj{
|
||||
"rlimit_nofile": rlimit,
|
||||
"schema_version": 10,
|
||||
}
|
||||
check(t, conf)
|
||||
})
|
||||
|
||||
t.Run("without_rlimit", func(t *testing.T) {
|
||||
conf := yobj{
|
||||
"schema_version": 10,
|
||||
}
|
||||
check(t, conf)
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue