From e0957469874da4a5ce0eb1bbdbdaec466edace52 Mon Sep 17 00:00:00 2001 From: Lev <1187448+levb@users.noreply.github.com> Date: Tue, 8 Oct 2019 16:34:00 -0700 Subject: [PATCH 1/5] Bumped Jira plugin version to 2.2.1 (#12689) * Bumped the Jira plugin to v2.2.0 * Bumped Jira plugin version to 2.2.1 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9c1217b860..7b3e766cab 100644 --- a/Makefile +++ b/Makefile @@ -89,7 +89,7 @@ PLUGIN_PACKAGES += mattermost-plugin-github-v0.11.0 PLUGIN_PACKAGES += mattermost-plugin-welcomebot-v1.1.1 PLUGIN_PACKAGES += mattermost-plugin-aws-SNS-v1.0.2 PLUGIN_PACKAGES += mattermost-plugin-antivirus-v0.1.1 -PLUGIN_PACKAGES += mattermost-plugin-jira-v2.2.0 +PLUGIN_PACKAGES += mattermost-plugin-jira-v2.2.1 PLUGIN_PACKAGES += mattermost-plugin-gitlab-v1.0.0 PLUGIN_PACKAGES += mattermost-plugin-jenkins-v1.0.0 From 9ea4c40bcc834ff21c8a6940a5ceb5749e6b5de7 Mon Sep 17 00:00:00 2001 From: Stylianos Rigas Date: Wed, 9 Oct 2019 09:41:21 +0100 Subject: [PATCH 2/5] Mm 19050 - Fixing server build fails because of missing Redux module (#12560) * MM-19050 Testing circle ci fix * MM-19050 Testing circle ci fix * MM-19050 Fixing the missing redux error * MM-19050 Removing webapp testing * MM-19050 Movinng npm ci * MM-19050 Readding test step * MM-19050 Readding test step * Removing curl step * Removing curl step * Adding logic for curl fails * MM-19050 Testing e2e functionality * MM-19050 Testing e2e functionality --- .circleci/config.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 372c333cf3..244b10533e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -27,7 +27,11 @@ jobs: git checkout $CIRCLE_BRANCH || git checkout master export WEBAPP_GIT_COMMIT=$(git rev-parse HEAD) echo "$WEBAPP_GIT_COMMIT" - curl -f -o ./dist.tar.gz https://releases.mattermost.com/mattermost-webapp/commit/${WEBAPP_GIT_COMMIT}/mattermost-webapp.tar.gz && mkdir ./dist && tar -xvf ./dist.tar.gz -C ./dist --strip-components=1 || make node_modules test build + curl -f -o ./dist.tar.gz https://releases.mattermost.com/mattermost-webapp/commit/${WEBAPP_GIT_COMMIT}/mattermost-webapp.tar.gz && mkdir ./dist && tar -xvf ./dist.tar.gz -C ./dist --strip-components=1 || echo "curl failed" && export CURL_FAILED=1 + if [ $CURL_FAILED -eq 1 ] + then + npm ci && cd node_modules/mattermost-redux && npm install && npm run build && cd ../.. && make build + fi - persist_to_workspace: root: /go/src/github.com/mattermost paths: From d1e46cd2167dca6bac272ce33ce3f39c242a779f Mon Sep 17 00:00:00 2001 From: Shodiq Muhammad <47969743+iDevoid@users.noreply.github.com> Date: Thu, 10 Oct 2019 00:11:40 +0700 Subject: [PATCH 3/5] change t.Fatal to assert.Equal in model/status_test.go (#12680) --- model/status_test.go | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/model/status_test.go b/model/status_test.go index d2e519006e..cc15e1c0ae 100644 --- a/model/status_test.go +++ b/model/status_test.go @@ -16,22 +16,10 @@ func TestStatus(t *testing.T) { json := status.ToJson() status2 := StatusFromJson(strings.NewReader(json)) - if status.UserId != status2.UserId { - t.Fatal("UserId should have matched") - } - - if status.Status != status2.Status { - t.Fatal("Status should have matched") - } - - if status.LastActivityAt != status2.LastActivityAt { - t.Fatal("LastActivityAt should have matched") - } - - if status.Manual != status2.Manual { - t.Fatal("Manual should have matched") - } - + assert.Equal(t, status.UserId, status2.UserId, "UserId should have matched") + assert.Equal(t, status.Status, status2.Status, "Status should have matched") + assert.Equal(t, status.LastActivityAt, status2.LastActivityAt, "LastActivityAt should have matched") + assert.Equal(t, status.Manual, status2.Manual, "Manual should have matched") assert.Equal(t, "", status2.ActiveChannel) json = status.ToClusterJson() @@ -70,10 +58,6 @@ func TestStatusListFromJson(t *testing.T) { toDec := strings.NewReader(jsonStream) statusesFromJson := StatusListFromJson(toDec) - if statusesFromJson[0].UserId != dat[0]["user_id"] { - t.Fatal("UserId should be equal") - } - if statusesFromJson[1].UserId != dat[1]["user_id"] { - t.Fatal("UserId should be equal") - } + assert.Equal(t, statusesFromJson[0].UserId, dat[0]["user_id"], "UserId should be equal") + assert.Equal(t, statusesFromJson[1].UserId, dat[1]["user_id"], "UserId should be equal") } From 4de508ec51f4ccadb6512fe01e30944cb64698ef Mon Sep 17 00:00:00 2001 From: Pijus Kamandulis Date: Wed, 9 Oct 2019 21:06:12 +0300 Subject: [PATCH 4/5] MM-19238 Migrate tests from 'model/team_test.go' to use testify (#12645) * MM-19238 Migrate tests from 'model/team_test.go' to use testify * MM-19238 Fixed CR issues --- model/team_test.go | 96 +++++++++++++++++----------------------------- 1 file changed, 36 insertions(+), 60 deletions(-) diff --git a/model/team_test.go b/model/team_test.go index ef92f2e420..a586bf2b77 100644 --- a/model/team_test.go +++ b/model/team_test.go @@ -6,6 +6,9 @@ package model import ( "strings" "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func TestTeamJson(t *testing.T) { @@ -13,56 +16,46 @@ func TestTeamJson(t *testing.T) { json := o.ToJson() ro := TeamFromJson(strings.NewReader(json)) - if o.Id != ro.Id { - t.Fatal("Ids do not match") - } + require.Equal(t, o.Id, ro.Id, "Ids do not match") } func TestTeamIsValid(t *testing.T) { o := Team{} - if err := o.IsValid(); err == nil { - t.Fatal("should be invalid") - } + err := o.IsValid() + require.NotNil(t, err, "should be invalid") o.Id = NewId() - if err := o.IsValid(); err == nil { - t.Fatal("should be invalid") - } + err = o.IsValid() + require.NotNil(t, err, "should be invalid") o.CreateAt = GetMillis() - if err := o.IsValid(); err == nil { - t.Fatal("should be invalid") - } + err = o.IsValid() + require.NotNil(t, err, "should be invalid") o.UpdateAt = GetMillis() - if err := o.IsValid(); err == nil { - t.Fatal("should be invalid") - } + err = o.IsValid() + require.NotNil(t, err, "should be invalid") o.Email = strings.Repeat("01234567890", 20) - if err := o.IsValid(); err == nil { - t.Fatal("should be invalid") - } + err = o.IsValid() + require.NotNil(t, err, "should be invalid") o.Email = "corey+test@hulen.com" o.DisplayName = strings.Repeat("01234567890", 20) - if err := o.IsValid(); err == nil { - t.Fatal("should be invalid") - } + err = o.IsValid() + require.NotNil(t, err, "should be invalid") o.DisplayName = "1234" o.Name = "ZZZZZZZ" - if err := o.IsValid(); err == nil { - t.Fatal("should be invalid") - } + err = o.IsValid() + require.NotNil(t, err, "should be invalid") o.Name = "zzzzz" o.Type = TEAM_OPEN o.InviteId = NewId() - if err := o.IsValid(); err != nil { - t.Fatal(err) - } + err = o.IsValid() + require.Nil(t, err, err) } func TestTeamPreSave(t *testing.T) { @@ -95,9 +88,8 @@ var domains = []struct { func TestValidTeamName(t *testing.T) { for _, v := range domains { - if IsValidTeamName(v.value) != v.expected { - t.Errorf("expect %v as %v", v.value, v.expected) - } + actual := IsValidTeamName(v.value) + assert.Equal(t, v.expected, actual) } } @@ -112,24 +104,20 @@ var tReservedDomains = []struct { func TestReservedTeamName(t *testing.T) { for _, v := range tReservedDomains { - if IsReservedTeamName(v.value) != v.expected { - t.Errorf("expect %v as %v", v.value, v.expected) - } + actual := IsReservedTeamName(v.value) + assert.Equal(t, v.expected, actual) } } func TestCleanTeamName(t *testing.T) { - if CleanTeamName("Jimbo's Admin") != "jimbos-admin" { - t.Fatal("didn't clean name properly") - } + actual := CleanTeamName("Jimbo's Admin") + require.Equal(t, "jimbos-admin", actual, "didn't clean name properly") - if CleanTeamName("Admin Really cool") != "really-cool" { - t.Fatal("didn't clean name properly") - } + actual = CleanTeamName("Admin Really cool") + require.Equal(t, "really-cool", actual, "didn't clean name properly") - if CleanTeamName("super-duper-guys") != "super-duper-guys" { - t.Fatal("didn't clean name properly") - } + actual = CleanTeamName("super-duper-guys") + require.Equal(t, "super-duper-guys", actual, "didn't clean name properly") } func TestTeamPatch(t *testing.T) { @@ -152,22 +140,10 @@ func TestTeamPatch(t *testing.T) { o := Team{Id: NewId()} o.Patch(p) - if *p.DisplayName != o.DisplayName { - t.Fatal("DisplayName did not update") - } - if *p.Description != o.Description { - t.Fatal("Description did not update") - } - if *p.CompanyName != o.CompanyName { - t.Fatal("CompanyName did not update") - } - if *p.AllowedDomains != o.AllowedDomains { - t.Fatal("AllowedDomains did not update") - } - if *p.AllowOpenInvite != o.AllowOpenInvite { - t.Fatal("AllowOpenInvite did not update") - } - if *p.GroupConstrained != *o.GroupConstrained { - t.Fatalf("expected %v got %v", *p.GroupConstrained, *o.GroupConstrained) - } + require.Equal(t, *p.DisplayName, o.DisplayName, "DisplayName did not update") + require.Equal(t, *p.Description, o.Description, "Description did not update") + require.Equal(t, *p.CompanyName, o.CompanyName, "CompanyName did not update") + require.Equal(t, *p.AllowedDomains, o.AllowedDomains, "AllowedDomains did not update") + require.Equal(t, *p.AllowOpenInvite, o.AllowOpenInvite, "AllowOpenInvite did not update") + require.Equal(t, *p.GroupConstrained, *o.GroupConstrained) } From c02b489302808063267f68230d51e63c2013947e Mon Sep 17 00:00:00 2001 From: Hector Date: Wed, 9 Oct 2019 21:43:13 +0200 Subject: [PATCH 5/5] Mm 19006 (#12616) * Refactor to use structured logging * Properly formatted with gofmt * migrate tests to use testify * fix: swap expected and actual --- app/status_test.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/status_test.go b/app/status_test.go index 0a56c8158e..e805d548fb 100644 --- a/app/status_test.go +++ b/app/status_test.go @@ -7,6 +7,7 @@ import ( "testing" "github.com/mattermost/mattermost-server/model" + "github.com/stretchr/testify/require" ) func TestSaveStatus(t *testing.T) { @@ -30,11 +31,8 @@ func TestSaveStatus(t *testing.T) { th.App.SaveAndBroadcastStatus(status) after, err := th.App.GetStatus(user.Id) - if err != nil { - t.Fatalf("failed to get status after save: %v", err) - } else if after.Status != statusString { - t.Fatalf("failed to save status, got %v, expected %v", after.Status, statusString) - } + require.Nil(t, err, "failed to get status after save: %v", err) + require.Equal(t, statusString, after.Status, "failed to save status, got %v, expected %v", after.Status, statusString) }) } }