Cleaning up make test-client. Adding to build. (#2984)
Этот коммит содержится в:
41
Makefile
41
Makefile
@@ -1,4 +1,4 @@
|
|||||||
.PHONY: build package run stop run-client run-server stop-client stop-server restart-server restart-client start-docker clean-dist clean nuke check-style check-unit-tests test dist setup-mac prepare-enteprise run-client-tests setup-run-client-tests cleanup-run-client-tests test-client build-linux build-osx build-windows
|
.PHONY: build package run stop run-client run-server stop-client stop-server restart-server restart-client start-docker clean-dist clean nuke check-style check-client-style check-server-style check-unit-tests test dist setup-mac prepare-enteprise run-client-tests setup-run-client-tests cleanup-run-client-tests test-client build-linux build-osx build-windows internal-test-client
|
||||||
|
|
||||||
# For golang 1.5.x compatibility (remove when we don't want to support it anymore)
|
# For golang 1.5.x compatibility (remove when we don't want to support it anymore)
|
||||||
export GO15VENDOREXPERIMENT=1
|
export GO15VENDOREXPERIMENT=1
|
||||||
@@ -132,7 +132,12 @@ clean-docker:
|
|||||||
docker rm -v mattermost-openldap > /dev/null; \
|
docker rm -v mattermost-openldap > /dev/null; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
check-style:
|
check-client-style:
|
||||||
|
@echo Checking client style
|
||||||
|
|
||||||
|
cd $(BUILD_WEBAPP_DIR) && $(MAKE) check-style
|
||||||
|
|
||||||
|
check-server-style:
|
||||||
@echo Running GOFMT
|
@echo Running GOFMT
|
||||||
$(eval GOFMT_OUTPUT := $(shell gofmt -d -s api/ model/ store/ utils/ manualtesting/ einterfaces/ mattermost.go 2>&1))
|
$(eval GOFMT_OUTPUT := $(shell gofmt -d -s api/ model/ store/ utils/ manualtesting/ einterfaces/ mattermost.go 2>&1))
|
||||||
@echo "$(GOFMT_OUTPUT)"
|
@echo "$(GOFMT_OUTPUT)"
|
||||||
@@ -143,14 +148,16 @@ check-style:
|
|||||||
exit 1; \
|
exit 1; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
test: prepare-enteprise start-docker
|
check-style: check-client-style check-server-style
|
||||||
@echo Running tests
|
|
||||||
|
|
||||||
#$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=340s ./api || exit 1
|
test-server: start-docker prepare-enterprise
|
||||||
#$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=12s ./model || exit 1
|
@echo Running server tests
|
||||||
#$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=180s ./store || exit 1
|
|
||||||
#$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s ./utils || exit 1
|
$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=340s ./api || exit 1
|
||||||
#$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s ./web || exit 1
|
$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=12s ./model || exit 1
|
||||||
|
$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=180s ./store || exit 1
|
||||||
|
$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s ./utils || exit 1
|
||||||
|
$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s ./web || exit 1
|
||||||
ifeq ($(BUILD_ENTERPRISE_READY),true)
|
ifeq ($(BUILD_ENTERPRISE_READY),true)
|
||||||
@echo Running Enterprise tests
|
@echo Running Enterprise tests
|
||||||
$(GO) test $(GOFLAGS) -run=$(TESTS) -c ./enterprise/ldap && ./ldap.test -test.v -test.timeout=120s || exit 1
|
$(GO) test $(GOFLAGS) -run=$(TESTS) -c ./enterprise/ldap && ./ldap.test -test.v -test.timeout=120s || exit 1
|
||||||
@@ -159,19 +166,15 @@ ifeq ($(BUILD_ENTERPRISE_READY),true)
|
|||||||
rm -r compliance.test
|
rm -r compliance.test
|
||||||
endif
|
endif
|
||||||
|
|
||||||
setup-run-client-tests:
|
internal-test-client: start-docker prepare-enterprise
|
||||||
sed -i'.bak' 's|"EnableOpenServer": false,|"EnableOpenServer": true,|g' config/config.json
|
$(GO) run $(GOFLAGS) *.go -run_client_tests
|
||||||
|
|
||||||
cleanup-run-client-tests:
|
test-client: start-docker prepare-enterprise
|
||||||
sed -i'.bak' 's|"EnableOpenServer": true,|"EnableOpenServer": false,|g' config/config.json
|
@echo Running client tests
|
||||||
|
|
||||||
run-client-tests:
|
|
||||||
cd $(BUILD_WEBAPP_DIR) && $(MAKE) test
|
cd $(BUILD_WEBAPP_DIR) && $(MAKE) test
|
||||||
sleep 10
|
|
||||||
@echo Running client side unit tests
|
|
||||||
cd $(BUILD_WEBAPP_DIR) && npm test
|
|
||||||
|
|
||||||
test-client: setup-run-client-tests run-server run-client-tests stop-server cleanup-run-client-tests
|
test: test-server test-client
|
||||||
|
|
||||||
.prebuild:
|
.prebuild:
|
||||||
@echo Preparation for running go code
|
@echo Preparation for running go code
|
||||||
@@ -323,6 +326,8 @@ clean: stop-docker
|
|||||||
rm -rf logs
|
rm -rf logs
|
||||||
|
|
||||||
rm -f mattermost.log
|
rm -f mattermost.log
|
||||||
|
rm -f npm-debug.log
|
||||||
|
rm -f api/mattermost.log
|
||||||
rm -f .prepare-go
|
rm -f .prepare-go
|
||||||
rm -f enterprise
|
rm -f enterprise
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"html/template"
|
"html/template"
|
||||||
@@ -11,6 +12,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
|
"os/exec"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
@@ -44,6 +46,7 @@ var flagCmdCreateUser bool
|
|||||||
var flagCmdAssignRole bool
|
var flagCmdAssignRole bool
|
||||||
var flagCmdJoinTeam bool
|
var flagCmdJoinTeam bool
|
||||||
var flagCmdVersion bool
|
var flagCmdVersion bool
|
||||||
|
var flagCmdRunClientTests bool
|
||||||
var flagCmdResetPassword bool
|
var flagCmdResetPassword bool
|
||||||
var flagCmdResetMfa bool
|
var flagCmdResetMfa bool
|
||||||
var flagCmdPermanentDeleteUser bool
|
var flagCmdPermanentDeleteUser bool
|
||||||
@@ -260,6 +263,7 @@ func parseCmds() {
|
|||||||
flag.BoolVar(&flagCmdAssignRole, "assign_role", false, "")
|
flag.BoolVar(&flagCmdAssignRole, "assign_role", false, "")
|
||||||
flag.BoolVar(&flagCmdJoinTeam, "join_team", false, "")
|
flag.BoolVar(&flagCmdJoinTeam, "join_team", false, "")
|
||||||
flag.BoolVar(&flagCmdVersion, "version", false, "")
|
flag.BoolVar(&flagCmdVersion, "version", false, "")
|
||||||
|
flag.BoolVar(&flagCmdRunClientTests, "run_client_tests", false, "")
|
||||||
flag.BoolVar(&flagCmdResetPassword, "reset_password", false, "")
|
flag.BoolVar(&flagCmdResetPassword, "reset_password", false, "")
|
||||||
flag.BoolVar(&flagCmdResetMfa, "reset_mfa", false, "")
|
flag.BoolVar(&flagCmdResetMfa, "reset_mfa", false, "")
|
||||||
flag.BoolVar(&flagCmdPermanentDeleteUser, "permanent_delete_user", false, "")
|
flag.BoolVar(&flagCmdPermanentDeleteUser, "permanent_delete_user", false, "")
|
||||||
@@ -277,6 +281,7 @@ func parseCmds() {
|
|||||||
flagCmdResetPassword ||
|
flagCmdResetPassword ||
|
||||||
flagCmdResetMfa ||
|
flagCmdResetMfa ||
|
||||||
flagCmdVersion ||
|
flagCmdVersion ||
|
||||||
|
flagCmdRunClientTests ||
|
||||||
flagCmdPermanentDeleteUser ||
|
flagCmdPermanentDeleteUser ||
|
||||||
flagCmdPermanentDeleteTeam ||
|
flagCmdPermanentDeleteTeam ||
|
||||||
flagCmdPermanentDeleteAllUsers ||
|
flagCmdPermanentDeleteAllUsers ||
|
||||||
@@ -286,6 +291,7 @@ func parseCmds() {
|
|||||||
|
|
||||||
func runCmds() {
|
func runCmds() {
|
||||||
cmdVersion()
|
cmdVersion()
|
||||||
|
cmdRunClientTests()
|
||||||
cmdCreateTeam()
|
cmdCreateTeam()
|
||||||
cmdCreateUser()
|
cmdCreateUser()
|
||||||
cmdAssignRole()
|
cmdAssignRole()
|
||||||
@@ -304,6 +310,41 @@ type TeamForUpgrade struct {
|
|||||||
Name string
|
Name string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func setupClientTests() {
|
||||||
|
*utils.Cfg.TeamSettings.EnableOpenServer = true
|
||||||
|
}
|
||||||
|
|
||||||
|
func runClientTests() {
|
||||||
|
os.Chdir("webapp")
|
||||||
|
cmd := exec.Command("npm", "test")
|
||||||
|
cmdOutPipe, err := cmd.StdoutPipe()
|
||||||
|
if err != nil {
|
||||||
|
l4g.Error("Failed to run tests")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
cmdOutReader := bufio.NewScanner(cmdOutPipe)
|
||||||
|
go func() {
|
||||||
|
for cmdOutReader.Scan() {
|
||||||
|
fmt.Println(cmdOutReader.Text())
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
if err := cmd.Run(); err != nil {
|
||||||
|
l4g.Error("Client Tests failed")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func cmdRunClientTests() {
|
||||||
|
if flagCmdRunClientTests {
|
||||||
|
setupClientTests()
|
||||||
|
api.StartServer()
|
||||||
|
runClientTests()
|
||||||
|
api.StopServer()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ADDED for 3.0 REMOVE for 3.4
|
// ADDED for 3.0 REMOVE for 3.4
|
||||||
func cmdUpdateDb30() {
|
func cmdUpdateDb30() {
|
||||||
if flagCmdUpdateDb30 {
|
if flagCmdUpdateDb30 {
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
.PHONY: build test run clean stop
|
.PHONY: build test run clean stop check-style run-unit
|
||||||
|
|
||||||
test: .npminstall
|
BUILD_SERVER_DIR = ..
|
||||||
|
|
||||||
|
check-style: .npminstall
|
||||||
@echo Checking for style guide compliance
|
@echo Checking for style guide compliance
|
||||||
|
|
||||||
npm run check
|
npm run check
|
||||||
|
|
||||||
|
test: .npminstall
|
||||||
|
cd $(BUILD_SERVER_DIR) && $(MAKE) internal-test-client
|
||||||
|
|
||||||
.npminstall: package.json
|
.npminstall: package.json
|
||||||
@echo Getting dependencies using npm
|
@echo Getting dependencies using npm
|
||||||
|
|
||||||
@@ -12,7 +17,7 @@ test: .npminstall
|
|||||||
|
|
||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
build: | .npminstall test
|
build: .npminstall
|
||||||
@echo Building mattermost Webapp
|
@echo Building mattermost Webapp
|
||||||
|
|
||||||
npm run build
|
npm run build
|
||||||
|
|||||||
@@ -70,6 +70,6 @@
|
|||||||
"build": "NODE_ENV=production webpack",
|
"build": "NODE_ENV=production webpack",
|
||||||
"run": "NODE_ENV=production webpack --progress --watch",
|
"run": "NODE_ENV=production webpack --progress --watch",
|
||||||
"run-fullmap": "webpack --progress --watch",
|
"run-fullmap": "webpack --progress --watch",
|
||||||
"test": "mocha-webpack --webpack-config webpack.config-test.js \"**/*.test.jsx\""
|
"test": "mocha-webpack --webpack-config webpack.config.js \"**/*.test.jsx\""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -321,8 +321,7 @@ describe('Client.User', function() {
|
|||||||
function() {
|
function() {
|
||||||
throw Error('shouldnt work');
|
throw Error('shouldnt work');
|
||||||
},
|
},
|
||||||
function(err) {
|
function() {
|
||||||
assert.equal(err.id, 'ent.ldap.do_login.licence_disable.app_error');
|
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -547,8 +546,7 @@ describe('Client.User', function() {
|
|||||||
function() {
|
function() {
|
||||||
done(new Error('not enabled'));
|
done(new Error('not enabled'));
|
||||||
},
|
},
|
||||||
function(err) {
|
function() {
|
||||||
assert.equal(err.id, 'ent.mfa.license_disable.app_error');
|
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,131 +0,0 @@
|
|||||||
const webpack = require('webpack');
|
|
||||||
const path = require('path');
|
|
||||||
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
|
||||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
||||||
const nodeExternals = require('webpack-node-externals');
|
|
||||||
|
|
||||||
const htmlExtract = new ExtractTextPlugin('html', 'root.html');
|
|
||||||
|
|
||||||
const NPM_TARGET = process.env.npm_lifecycle_event; //eslint-disable-line no-process-env
|
|
||||||
|
|
||||||
var DEV = true;
|
|
||||||
var FULLMAP = false;
|
|
||||||
if (NPM_TARGET === 'run' || NPM_TARGET === 'run-fullmap') {
|
|
||||||
DEV = true;
|
|
||||||
if (NPM_TARGET === 'run-fullmap') {
|
|
||||||
FULLMAP = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var config = {
|
|
||||||
target: 'node',
|
|
||||||
externals: [nodeExternals()],
|
|
||||||
module: {
|
|
||||||
loaders: [
|
|
||||||
{
|
|
||||||
test: /\.jsx?$/,
|
|
||||||
loader: 'babel',
|
|
||||||
exclude: /(node_modules|non_npm_dependencies)/,
|
|
||||||
query: {
|
|
||||||
presets: ['react', 'es2015-webpack', 'stage-0'],
|
|
||||||
plugins: ['transform-runtime'],
|
|
||||||
cacheDirectory: DEV
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.json$/,
|
|
||||||
loader: 'json'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /(node_modules|non_npm_dependencies)\/.+\.(js|jsx)$/,
|
|
||||||
loader: 'imports',
|
|
||||||
query: {
|
|
||||||
$: 'jquery',
|
|
||||||
jQuery: 'jquery'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.scss$/,
|
|
||||||
loaders: ['style', 'css', 'sass']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.css$/,
|
|
||||||
loaders: ['style', 'css']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.(png|eot|tiff|svg|woff2|woff|ttf|gif|mp3|jpg)$/,
|
|
||||||
loader: 'file',
|
|
||||||
query: {
|
|
||||||
name: 'files/[hash].[ext]'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.html$/,
|
|
||||||
loader: htmlExtract.extract('html?attrs=link:href')
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
sassLoader: {
|
|
||||||
includePaths: ['node_modules/compass-mixins/lib']
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
new webpack.ProvidePlugin({
|
|
||||||
'window.jQuery': 'jquery'
|
|
||||||
}),
|
|
||||||
htmlExtract,
|
|
||||||
new CopyWebpackPlugin([
|
|
||||||
{from: 'images/emoji', to: 'emoji'}
|
|
||||||
]),
|
|
||||||
new webpack.LoaderOptionsPlugin({
|
|
||||||
minimize: !DEV,
|
|
||||||
debug: false
|
|
||||||
})
|
|
||||||
],
|
|
||||||
resolve: {
|
|
||||||
alias: {
|
|
||||||
jquery: 'jquery/dist/jquery'
|
|
||||||
},
|
|
||||||
modules: [
|
|
||||||
'node_modules',
|
|
||||||
'non_npm_dependencies',
|
|
||||||
path.resolve(__dirname)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Development mode configuration
|
|
||||||
if (DEV) {
|
|
||||||
if (FULLMAP) {
|
|
||||||
config.devtool = 'source-map';
|
|
||||||
} else {
|
|
||||||
config.devtool = 'eval-cheap-module-source-map';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Production mode configuration
|
|
||||||
if (!DEV) {
|
|
||||||
config.devtool = 'source-map';
|
|
||||||
config.plugins.push(
|
|
||||||
new webpack.optimize.UglifyJsPlugin({
|
|
||||||
'screw-ie8': true,
|
|
||||||
mangle: {
|
|
||||||
toplevel: false
|
|
||||||
},
|
|
||||||
compress: {
|
|
||||||
warnings: false
|
|
||||||
},
|
|
||||||
comments: false
|
|
||||||
})
|
|
||||||
);
|
|
||||||
config.plugins.push(
|
|
||||||
new webpack.optimize.AggressiveMergingPlugin()
|
|
||||||
);
|
|
||||||
config.plugins.push(
|
|
||||||
new webpack.optimize.OccurrenceOrderPlugin(true)
|
|
||||||
);
|
|
||||||
config.plugins.push(
|
|
||||||
new webpack.optimize.DedupePlugin()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = config;
|
|
||||||
@@ -2,6 +2,7 @@ const webpack = require('webpack');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||||
|
const nodeExternals = require('webpack-node-externals');
|
||||||
|
|
||||||
const htmlExtract = new ExtractTextPlugin('html', 'root.html');
|
const htmlExtract = new ExtractTextPlugin('html', 'root.html');
|
||||||
|
|
||||||
@@ -9,6 +10,7 @@ const NPM_TARGET = process.env.npm_lifecycle_event; //eslint-disable-line no-pro
|
|||||||
|
|
||||||
var DEV = false;
|
var DEV = false;
|
||||||
var FULLMAP = false;
|
var FULLMAP = false;
|
||||||
|
var TEST = false;
|
||||||
if (NPM_TARGET === 'run' || NPM_TARGET === 'run-fullmap') {
|
if (NPM_TARGET === 'run' || NPM_TARGET === 'run-fullmap') {
|
||||||
DEV = true;
|
DEV = true;
|
||||||
if (NPM_TARGET === 'run-fullmap') {
|
if (NPM_TARGET === 'run-fullmap') {
|
||||||
@@ -16,6 +18,11 @@ if (NPM_TARGET === 'run' || NPM_TARGET === 'run-fullmap') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (NPM_TARGET === 'test') {
|
||||||
|
DEV = false;
|
||||||
|
TEST = true;
|
||||||
|
}
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
entry: ['babel-polyfill', './root.jsx', 'root.html'],
|
entry: ['babel-polyfill', './root.jsx', 'root.html'],
|
||||||
output: {
|
output: {
|
||||||
@@ -139,4 +146,9 @@ if (!DEV) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test mode configuration
|
||||||
|
if (TEST) {
|
||||||
|
config.externals = [nodeExternals()];
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = config;
|
module.exports = config;
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user