diff options
author | Christopher Speller <crspeller@gmail.com> | 2017-05-25 11:01:53 -0400 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2017-05-25 11:01:53 -0400 |
commit | 00f48a1908ea80ba88bda78399a3bbfed57b2e9b (patch) | |
tree | 35c042b5a45a21142bd5c430344b3041a52eef64 | |
parent | 554938a8403a00dda36c77b288dafe374dd2430e (diff) | |
download | chat-00f48a1908ea80ba88bda78399a3bbfed57b2e9b.tar.gz chat-00f48a1908ea80ba88bda78399a3bbfed57b2e9b.tar.bz2 chat-00f48a1908ea80ba88bda78399a3bbfed57b2e9b.zip |
Adding short unit tests by default (#6494)
-rw-r--r-- | Makefile | 6 | ||||
-rw-r--r-- | api/admin_test.go | 3 | ||||
-rw-r--r-- | api/cli_test.go | 58 | ||||
-rw-r--r-- | api4/webrtc_test.go | 4 | ||||
-rw-r--r-- | app/email_test.go | 30 | ||||
-rw-r--r-- | model/webrtc_test.go | 8 |
6 files changed, 77 insertions, 32 deletions
@@ -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; \ diff --git a/api/admin_test.go b/api/admin_test.go index cbbf10fdd..d90bc8add 100644 --- a/api/admin_test.go +++ b/api/admin_test.go @@ -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 { diff --git a/api/cli_test.go b/api/cli_test.go index afdada7b3..671d1af11 100644 --- a/api/cli_test.go +++ b/api/cli_test.go @@ -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() diff --git a/api4/webrtc_test.go b/api4/webrtc_test.go index 806118f76..44dbcdf2e 100644 --- a/api4/webrtc_test.go +++ b/api4/webrtc_test.go @@ -10,6 +10,10 @@ import ( ) func TestGetWebrtcToken(t *testing.T) { + if testing.Short() { + t.SkipNow() + } + th := Setup().InitBasic().InitSystemAdmin() defer TearDown() Client := th.Client diff --git a/app/email_test.go b/app/email_test.go index a8519ca0f..67457c702 100644 --- a/app/email_test.go +++ b/app/email_test.go @@ -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" diff --git a/model/webrtc_test.go b/model/webrtc_test.go index 7ec6605f8..4b8b26dc1 100644 --- a/model/webrtc_test.go +++ b/model/webrtc_test.go @@ -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)) |