Этот коммит содержится в:
Chris
2017-11-16 08:40:26 -06:00
коммит произвёл GitHub
родитель 6eb4b4604c
Коммит bf6bb9bce9
8 изменённых файлов: 85 добавлений и 19 удалений

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" {