MM-31356: Add a minimum required version check for Postgres (#16597)
* MM-31356: Add a minimum required version check for Postgres To keep conformance with our failing fast and obvious philosophy, we add a check to prevent Mattermost server from starting if the postgres version is below 10.0. This gives customers a chance to upgrade their database before upgrading their Mattermost version, than to run into weird compatibility issues after they have finished the upgrade. https://mattermost.atlassian.net/browse/MM-31356 ```release-note NONE ``` * fix lint errors * Use a function to pretty-print version string * rectify comment
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
83afd756b6
Коммит
c54b262351
@@ -369,7 +369,7 @@ func TestGetDbVersion(t *testing.T) {
|
||||
settings := makeSqlSettings(driver)
|
||||
store := New(*settings, nil)
|
||||
|
||||
version, err := store.GetDbVersion()
|
||||
version, err := store.GetDbVersion(false)
|
||||
require.Nil(t, err)
|
||||
require.Regexp(t, regexp.MustCompile(`\d+\.\d+(\.\d+)?`), version)
|
||||
})
|
||||
@@ -471,6 +471,31 @@ func TestIsDuplicate(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestVersionString(t *testing.T) {
|
||||
versions := []struct {
|
||||
input int
|
||||
output string
|
||||
}{
|
||||
{
|
||||
input: 100000,
|
||||
output: "10.0",
|
||||
},
|
||||
{
|
||||
input: 90603,
|
||||
output: "9.603",
|
||||
},
|
||||
{
|
||||
input: 120005,
|
||||
output: "12.5",
|
||||
},
|
||||
}
|
||||
|
||||
for _, v := range versions {
|
||||
out := VersionString(v.input)
|
||||
assert.Equal(t, v.output, out)
|
||||
}
|
||||
}
|
||||
|
||||
func makeSqlSettings(driver string) *model.SqlSettings {
|
||||
switch driver {
|
||||
case model.DATABASE_DRIVER_POSTGRES:
|
||||
|
||||
Ссылка в новой задаче
Block a user