Adding short unit tests by default (#6494)
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
554938a840
Коммит
00f48a1908
6
Makefile
6
Makefile
@@ -52,6 +52,8 @@ DIST_PATH=$(DIST_ROOT)/mattermost
|
||||
# Tests
|
||||
TESTS=.
|
||||
|
||||
TESTFLAGS ?= -short
|
||||
|
||||
# Packages lists
|
||||
TE_PACKAGES=$(shell go list ./... | grep -v vendor)
|
||||
TE_PACKAGES_COMMA=$(shell echo $(TE_PACKAGES) | tr ' ' ',')
|
||||
@@ -233,7 +235,7 @@ test-te: start-docker prepare-enterprise do-cover-file
|
||||
|
||||
@for package in $(TE_PACKAGES); do \
|
||||
echo "Testing "$$package; \
|
||||
$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=2000s -covermode=count -coverprofile=cprofile.out -coverpkg=$(ALL_PACKAGES_COMMA) $$package || exit 1; \
|
||||
$(GO) test $(GOFLAGS) -run=$(TESTS) $(TESTFLAGS) -test.v -test.timeout=2000s -covermode=count -coverprofile=cprofile.out -coverpkg=$(ALL_PACKAGES_COMMA) $$package || exit 1; \
|
||||
if [ -f cprofile.out ]; then \
|
||||
tail -n +2 cprofile.out >> cover.out; \
|
||||
rm cprofile.out; \
|
||||
@@ -267,7 +269,7 @@ ifeq ($(BUILD_ENTERPRISE_READY),true)
|
||||
$(GO) test $(GOFLAGS) -run=$(TESTS) -covermode=count -coverpkg=$(ALL_PACKAGES_COMMA) -c $$package; \
|
||||
if [ -f $$(basename $$package).test ]; then \
|
||||
echo "Testing "$$package; \
|
||||
./$$(basename $$package).test -test.v -test.timeout=2000s -test.coverprofile=cprofile.out || exit 1; \
|
||||
./$$(basename $$package).test -test.v $(TESTFLAGS) -test.timeout=2000s -test.coverprofile=cprofile.out || exit 1; \
|
||||
if [ -f cprofile.out ]; then \
|
||||
tail -n +2 cprofile.out >> cover.out; \
|
||||
rm cprofile.out; \
|
||||
|
||||
@@ -28,6 +28,9 @@ func TestGetLogs(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetClusterInfos(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
th := Setup().InitSystemAdmin().InitBasic()
|
||||
|
||||
if _, err := th.BasicClient.GetClusterStatus(); err == nil {
|
||||
|
||||
@@ -11,11 +11,9 @@ import (
|
||||
"github.com/mattermost/platform/model"
|
||||
)
|
||||
|
||||
var disableCliTests bool = false
|
||||
|
||||
func TestCliVersion(t *testing.T) {
|
||||
if disableCliTests {
|
||||
return
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
|
||||
cmd := exec.Command("bash", "-c", `go run ../cmd/platform/*.go version`)
|
||||
@@ -27,8 +25,8 @@ func TestCliVersion(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCliCreateTeam(t *testing.T) {
|
||||
if disableCliTests {
|
||||
return
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
|
||||
th := Setup().InitSystemAdmin()
|
||||
@@ -52,8 +50,8 @@ func TestCliCreateTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCliCreateUserWithTeam(t *testing.T) {
|
||||
if disableCliTests {
|
||||
return
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
|
||||
th := Setup().InitSystemAdmin()
|
||||
@@ -93,8 +91,8 @@ func TestCliCreateUserWithTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCliCreateUserWithoutTeam(t *testing.T) {
|
||||
if disableCliTests {
|
||||
return
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
|
||||
Setup()
|
||||
@@ -120,8 +118,8 @@ func TestCliCreateUserWithoutTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCliAssignRole(t *testing.T) {
|
||||
if disableCliTests {
|
||||
return
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
|
||||
th := Setup().InitBasic()
|
||||
@@ -144,8 +142,8 @@ func TestCliAssignRole(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCliJoinChannel(t *testing.T) {
|
||||
if disableCliTests {
|
||||
return
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
|
||||
th := Setup().InitBasic()
|
||||
@@ -186,8 +184,8 @@ func TestCliJoinChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCliRemoveChannel(t *testing.T) {
|
||||
if disableCliTests {
|
||||
return
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
|
||||
th := Setup().InitBasic()
|
||||
@@ -243,8 +241,8 @@ func TestCliRemoveChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCliListChannels(t *testing.T) {
|
||||
if disableCliTests {
|
||||
return
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
|
||||
th := Setup().InitBasic()
|
||||
@@ -278,8 +276,8 @@ func TestCliListChannels(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCliRestoreChannel(t *testing.T) {
|
||||
if disableCliTests {
|
||||
return
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
|
||||
th := Setup().InitBasic()
|
||||
@@ -313,8 +311,8 @@ func TestCliRestoreChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCliJoinTeam(t *testing.T) {
|
||||
if disableCliTests {
|
||||
return
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
|
||||
th := Setup().InitSystemAdmin().InitBasic()
|
||||
@@ -343,8 +341,8 @@ func TestCliJoinTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCliLeaveTeam(t *testing.T) {
|
||||
if disableCliTests {
|
||||
return
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
|
||||
th := Setup().InitBasic()
|
||||
@@ -380,8 +378,8 @@ func TestCliLeaveTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCliResetPassword(t *testing.T) {
|
||||
if disableCliTests {
|
||||
return
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
|
||||
th := Setup().InitBasic()
|
||||
@@ -399,8 +397,8 @@ func TestCliResetPassword(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCliCreateChannel(t *testing.T) {
|
||||
if disableCliTests {
|
||||
return
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
|
||||
th := Setup().InitBasic()
|
||||
@@ -427,8 +425,8 @@ func TestCliCreateChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCliMakeUserActiveAndInactive(t *testing.T) {
|
||||
if disableCliTests {
|
||||
return
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
|
||||
th := Setup().InitBasic()
|
||||
|
||||
@@ -10,6 +10,10 @@ import (
|
||||
)
|
||||
|
||||
func TestGetWebrtcToken(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
|
||||
th := Setup().InitBasic().InitSystemAdmin()
|
||||
defer TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -12,6 +12,9 @@ import (
|
||||
)
|
||||
|
||||
func TestSendChangeUsernameEmail(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
Setup()
|
||||
|
||||
var emailTo string = "test@example.com"
|
||||
@@ -60,6 +63,9 @@ func TestSendChangeUsernameEmail(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSendEmailChangeVerifyEmail(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
Setup()
|
||||
|
||||
var newUserEmail string = "newtest@example.com"
|
||||
@@ -111,6 +117,9 @@ func TestSendEmailChangeVerifyEmail(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSendEmailChangeEmail(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
Setup()
|
||||
|
||||
var oldEmail string = "test@example.com"
|
||||
@@ -158,6 +167,9 @@ func TestSendEmailChangeEmail(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSendVerifyEmail(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
Setup()
|
||||
|
||||
var userEmail string = "test@example.com"
|
||||
@@ -209,6 +221,9 @@ func TestSendVerifyEmail(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSendSignInChangeEmail(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
Setup()
|
||||
|
||||
var email string = "test@example.com"
|
||||
@@ -256,6 +271,9 @@ func TestSendSignInChangeEmail(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSendWelcomeEmail(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
Setup()
|
||||
|
||||
var userId string = "32432nkjnijn432uj32"
|
||||
@@ -349,6 +367,9 @@ func TestSendWelcomeEmail(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSendPasswordChangeEmail(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
Setup()
|
||||
|
||||
var email string = "test@example.com"
|
||||
@@ -396,6 +417,9 @@ func TestSendPasswordChangeEmail(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSendMfaChangeEmail(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
Setup()
|
||||
|
||||
var email string = "test@example.com"
|
||||
@@ -480,6 +504,9 @@ func TestSendMfaChangeEmail(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSendInviteEmails(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
th := Setup().InitBasic()
|
||||
|
||||
var email1 string = "test1@example.com"
|
||||
@@ -555,6 +582,9 @@ func TestSendInviteEmails(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSendPasswordReset(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
th := Setup().InitBasic()
|
||||
|
||||
var siteURL string = "http://test.mattermost.io"
|
||||
|
||||
@@ -9,6 +9,10 @@ import (
|
||||
)
|
||||
|
||||
func TestWebrtcInfoResponseToFromJson(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
|
||||
o := WebrtcInfoResponse{Token: NewId(), GatewayUrl: NewId()}
|
||||
json := o.ToJson()
|
||||
ro := WebrtcInfoResponseFromJson(strings.NewReader(json))
|
||||
@@ -24,6 +28,10 @@ func TestWebrtcInfoResponseToFromJson(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGatewayResponseFromJson(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
|
||||
// Valid Gateway Response
|
||||
s1 := `{"janus": "something"}`
|
||||
g1 := GatewayResponseFromJson(strings.NewReader(s1))
|
||||
|
||||
Ссылка в новой задаче
Block a user