mirror of
https://github.com/hanzoai/forge.git
synced 2026-10-30 15:00:39 +00:00
Source files keep their SPDX-License-Identifier and Hanzo copyright line; the Gitea, Gogs and LFS Test Server copyrights they used to repeat now live once in NOTICE, alongside LICENSE. The header lint accepts any copyright line above the SPDX line, so it no longer demands an upstream one. Co-authored-by: Hanzo Dev <[email protected]>
36 lines
810 B
Go
36 lines
810 B
Go
// Copyright 2026 Hanzo AI, Inc. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package setting
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestLoadGlobalLockConfig(t *testing.T) {
|
|
t.Run("DefaultGlobalLockConfig", func(t *testing.T) {
|
|
iniStr := ``
|
|
cfg, err := NewConfigProviderFromData(iniStr)
|
|
assert.NoError(t, err)
|
|
|
|
loadGlobalLockFrom(cfg)
|
|
assert.Equal(t, "memory", GlobalLock.ServiceType)
|
|
})
|
|
|
|
t.Run("KVGlobalLockConfig", func(t *testing.T) {
|
|
iniStr := `
|
|
[global_lock]
|
|
SERVICE_TYPE = kv
|
|
SERVICE_CONN_STR = addrs=127.0.0.1:6379 db=0
|
|
`
|
|
cfg, err := NewConfigProviderFromData(iniStr)
|
|
assert.NoError(t, err)
|
|
|
|
loadGlobalLockFrom(cfg)
|
|
assert.Equal(t, "kv", GlobalLock.ServiceType)
|
|
assert.Equal(t, "addrs=127.0.0.1:6379 db=0", GlobalLock.ServiceConnStr)
|
|
})
|
|
}
|