mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 06:40:54 +03:00
move server version setting to common section
Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -38,6 +38,7 @@ import (
|
||||
"github.com/drakkan/sftpgo/v2/internal/kms"
|
||||
"github.com/drakkan/sftpgo/v2/internal/plugin"
|
||||
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||
"github.com/drakkan/sftpgo/v2/internal/version"
|
||||
"github.com/drakkan/sftpgo/v2/internal/vfs"
|
||||
)
|
||||
|
||||
@@ -1768,6 +1769,21 @@ func TestALPNProtocols(t *testing.T) {
|
||||
assert.Equal(t, []string{"h2", "http/1.1"}, protocols)
|
||||
}
|
||||
|
||||
func TestServerVersion(t *testing.T) {
|
||||
appName := "SFTPGo"
|
||||
version.SetConfig("")
|
||||
v := version.GetServerVersion("_", false)
|
||||
assert.Equal(t, fmt.Sprintf("%s_%s", appName, version.Get().Version), v)
|
||||
v = version.GetServerVersion("-", true)
|
||||
assert.Equal(t, fmt.Sprintf("%s-%s-", appName, version.Get().Version), v)
|
||||
version.SetConfig("short")
|
||||
v = version.GetServerVersion("_", false)
|
||||
assert.Equal(t, appName, v)
|
||||
v = version.GetServerVersion("_", true)
|
||||
assert.Equal(t, appName+"_", v)
|
||||
version.SetConfig("")
|
||||
}
|
||||
|
||||
func BenchmarkBcryptHashing(b *testing.B) {
|
||||
bcryptPassword := "bcryptpassword"
|
||||
for i := 0; i < b.N; i++ {
|
||||
|
||||
Reference in New Issue
Block a user