fix config cli option (#7850)
Этот коммит содержится в:
29
cmd/platform/config_test.go
Обычный файл
29
cmd/platform/config_test.go
Обычный файл
@@ -0,0 +1,29 @@
|
||||
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
|
||||
// See License.txt for license information.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/mattermost/mattermost-server/model"
|
||||
)
|
||||
|
||||
func TestConfigValidate(t *testing.T) {
|
||||
dir, err := ioutil.TempDir("", "")
|
||||
require.NoError(t, err)
|
||||
defer os.RemoveAll(dir)
|
||||
|
||||
path := filepath.Join(dir, "config.json")
|
||||
config := &model.Config{}
|
||||
config.SetDefaults()
|
||||
require.NoError(t, ioutil.WriteFile(path, []byte(config.ToJson()), 0600))
|
||||
|
||||
assert.Contains(t, checkCommand(t, "--config", path, "config", "validate"), "The document is valid")
|
||||
}
|
||||
@@ -32,7 +32,7 @@ func initDBCommandContext(configFileLocation string) (*app.App, error) {
|
||||
|
||||
utils.ConfigureCmdLineLog()
|
||||
|
||||
a := app.New()
|
||||
a := app.New(app.ConfigFile(configFileLocation))
|
||||
if model.BuildEnterpriseReady == "true" {
|
||||
a.LoadLicense()
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ func checkCommand(t *testing.T, args ...string) string {
|
||||
require.NoError(t, err)
|
||||
output, err := exec.Command(path, execArgs(t, args)...).CombinedOutput()
|
||||
require.NoError(t, err, string(output))
|
||||
return string(output)
|
||||
return strings.TrimSpace(strings.TrimSuffix(strings.TrimSpace(string(output)), "PASS"))
|
||||
}
|
||||
|
||||
func runCommand(t *testing.T, args ...string) error {
|
||||
|
||||
@@ -64,7 +64,7 @@ func runServer(configFileLocation string) {
|
||||
l4g.Error("Problem with file storage settings: " + err.Error())
|
||||
}
|
||||
|
||||
a := app.New()
|
||||
a := app.New(app.ConfigFile(configFileLocation))
|
||||
defer a.Shutdown()
|
||||
|
||||
if model.BuildEnterpriseReady == "true" {
|
||||
|
||||
Ссылка в новой задаче
Block a user