Skip to content

Commit

Permalink
Merge branch 'mono-repo' into cp-4577-file-path
Browse files Browse the repository at this point in the history
  • Loading branch information
sbishel committed Mar 16, 2023
2 parents a20aaff + 6d3485f commit 01f0392
Show file tree
Hide file tree
Showing 14 changed files with 124 additions and 59 deletions.
2 changes: 1 addition & 1 deletion server/boards/ws/plugin_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog"
)

const websocketMessagePrefix = "custom_focalboard_"
const websocketMessagePrefix = "custom_boards_"

var errMissingTeamInCommand = fmt.Errorf("command doesn't contain teamId")

Expand Down
13 changes: 9 additions & 4 deletions server/channels/store/sqlstore/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,8 @@ func TestGetDbVersion(t *testing.T) {
model.DatabaseDriverMysql,
}

for _, driver := range testDrivers {
for _, d := range testDrivers {
driver := d
t.Run("Should return db version for "+driver, func(t *testing.T) {
t.Parallel()
settings := makeSqlSettings(driver)
Expand Down Expand Up @@ -655,7 +656,9 @@ func TestIsDuplicate(t *testing.T) {
errors.New("Random error"): false,
}

for err, expected := range testErrors {
for e, b := range testErrors {
err := e
expected := b
t.Run(fmt.Sprintf("Should return %t for %s", expected, err.Error()), func(t *testing.T) {
t.Parallel()
assert.Equal(t, expected, IsDuplicate(err))
Expand Down Expand Up @@ -815,7 +818,8 @@ func TestGetDBSchemaVersion(t *testing.T) {

assets := db.Assets()

for _, driver := range testDrivers {
for _, d := range testDrivers {
driver := d
t.Run("Should return latest version number of applied migrations for "+driver, func(t *testing.T) {
t.Parallel()
settings := makeSqlSettings(driver)
Expand Down Expand Up @@ -849,7 +853,8 @@ func TestGetAppliedMigrations(t *testing.T) {

assets := db.Assets()

for _, driver := range testDrivers {
for _, d := range testDrivers {
driver := d
t.Run("Should return db applied migrations for "+driver, func(t *testing.T) {
t.Parallel()
settings := makeSqlSettings(driver)
Expand Down
9 changes: 6 additions & 3 deletions server/playbooks/server/api_actions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import (
)

func TestActionCreation(t *testing.T) {
e := Setup(t)
e, teardown := Setup(t)
defer teardown()
e.CreateBasic()

createNewChannel := func(t *testing.T, name string) *model.Channel {
Expand Down Expand Up @@ -200,7 +201,8 @@ func TestActionCreation(t *testing.T) {
}

func TestActionList(t *testing.T) {
e := Setup(t)
e, teardown := Setup(t)
defer teardown()
e.CreateBasic()

// Create three valid actions
Expand Down Expand Up @@ -292,7 +294,8 @@ func TestActionList(t *testing.T) {
}

func TestActionUpdate(t *testing.T) {
e := Setup(t)
e, teardown := Setup(t)
defer teardown()
e.CreateBasic()

// Create a valid action
Expand Down
3 changes: 2 additions & 1 deletion server/playbooks/server/api_bot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import (
)

func TestTrialLicences(t *testing.T) {
e := Setup(t)
e, teardown := Setup(t)
defer teardown()
e.CreateBasic()

t.Run("request trial license without permissions", func(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion server/playbooks/server/api_general_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import (
)

func TestAPI(t *testing.T) {
e := Setup(t)
e, teardown := Setup(t)
defer teardown()
e.CreateClients()

t.Run("404", func(t *testing.T) {
Expand Down
12 changes: 8 additions & 4 deletions server/playbooks/server/api_graphql_playbooks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import (
)

func TestGraphQLPlaybooks(t *testing.T) {
e := Setup(t)
e, teardown := Setup(t)
defer teardown()
e.CreateBasic()

t.Run("basic get", func(t *testing.T) {
Expand Down Expand Up @@ -205,7 +206,8 @@ func TestGraphQLPlaybooks(t *testing.T) {

}
func TestGraphQLUpdatePlaybookFails(t *testing.T) {
e := Setup(t)
e, teardown := Setup(t)
defer teardown()
e.CreateBasic()

t.Run("update playbook fails because size constraints.", func(t *testing.T) {
Expand Down Expand Up @@ -368,7 +370,8 @@ func TestGraphQLUpdatePlaybookFails(t *testing.T) {
}

func TestUpdatePlaybookFavorite(t *testing.T) {
e := Setup(t)
e, teardown := Setup(t)
defer teardown()
e.CreateBasic()

t.Run("favorite", func(t *testing.T) {
Expand Down Expand Up @@ -490,7 +493,8 @@ func gqlTestPlaybookUpdate(e *TestEnvironment, t *testing.T, playbookID string,
}

func TestGraphQLPlaybooksMetrics(t *testing.T) {
e := Setup(t)
e, teardown := Setup(t)
defer teardown()
e.CreateBasic()

t.Run("metrics get", func(t *testing.T) {
Expand Down
27 changes: 18 additions & 9 deletions server/playbooks/server/api_graphql_runs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import (
)

func TestGraphQLRunList(t *testing.T) {
e := Setup(t)
e, teardown := Setup(t)
defer teardown()
e.CreateBasic()

t.Run("list by participantOrFollower", func(t *testing.T) {
Expand Down Expand Up @@ -204,7 +205,8 @@ func TestGraphQLRunList(t *testing.T) {
}

func TestGraphQLChangeRunParticipants(t *testing.T) {
e := Setup(t)
e, teardown := Setup(t)
defer teardown()
e.CreateBasic()

user3, _, err := e.ServerAdminClient.CreateUser(&model.User{
Expand Down Expand Up @@ -656,7 +658,8 @@ func TestGraphQLChangeRunParticipants(t *testing.T) {
}

func TestGraphQLChangeRunOwner(t *testing.T) {
e := Setup(t)
e, teardown := Setup(t)
defer teardown()
e.CreateBasic()

// create a third user to test change owner
Expand Down Expand Up @@ -699,7 +702,8 @@ func TestGraphQLChangeRunOwner(t *testing.T) {
}

func TestSetRunFavorite(t *testing.T) {
e := Setup(t)
e, teardown := Setup(t)
defer teardown()
e.CreateBasic()

createRun := func() *client.PlaybookRun {
Expand Down Expand Up @@ -785,7 +789,8 @@ func TestSetRunFavorite(t *testing.T) {
}

func TestResolverFavorites(t *testing.T) {
e := Setup(t)
e, teardown := Setup(t)
defer teardown()
e.CreateBasic()

createRun := func() *client.PlaybookRun {
Expand Down Expand Up @@ -817,7 +822,8 @@ func TestResolverFavorites(t *testing.T) {
}

func TestResolverPlaybooks(t *testing.T) {
e := Setup(t)
e, teardown := Setup(t)
defer teardown()
e.CreateBasic()

createRun := func() *client.PlaybookRun {
Expand All @@ -843,7 +849,8 @@ func TestResolverPlaybooks(t *testing.T) {
}

func TestUpdateRun(t *testing.T) {
e := Setup(t)
e, teardown := Setup(t)
defer teardown()
e.CreateBasic()

createRun := func() *client.PlaybookRun {
Expand Down Expand Up @@ -959,7 +966,8 @@ func TestUpdateRun(t *testing.T) {
}

func TestUpdateRunTaskActions(t *testing.T) {
e := Setup(t)
e, teardown := Setup(t)
defer teardown()
e.CreateBasic()

t.Run("task actions mutation create and update", func(t *testing.T) {
Expand Down Expand Up @@ -1052,7 +1060,8 @@ func TestUpdateRunTaskActions(t *testing.T) {
}

func TestBadGraphQLRequest(t *testing.T) {
e := Setup(t)
e, teardown := Setup(t)
defer teardown()
e.CreateBasic()

testRunsQuery := `
Expand Down
45 changes: 30 additions & 15 deletions server/playbooks/server/api_playbooks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import (
)

func TestPlaybooks(t *testing.T) {
e := Setup(t)
e, teardown := Setup(t)
defer teardown()
e.CreateClients()
e.CreateBasicServer()

Expand Down Expand Up @@ -265,7 +266,8 @@ func TestPlaybooks(t *testing.T) {
}

func TestCreateInvalidPlaybook(t *testing.T) {
e := Setup(t)
e, teardown := Setup(t)
defer teardown()
e.CreateClients()
e.CreateBasicServer()

Expand Down Expand Up @@ -366,7 +368,8 @@ func TestCreateInvalidPlaybook(t *testing.T) {
}

func TestPlaybooksRetrieval(t *testing.T) {
e := Setup(t)
e, teardown := Setup(t)
defer teardown()
e.CreateBasic()

t.Run("get playbook", func(t *testing.T) {
Expand All @@ -383,7 +386,8 @@ func TestPlaybooksRetrieval(t *testing.T) {
}

func TestPlaybookUpdate(t *testing.T) {
e := Setup(t)
e, teardown := Setup(t)
defer teardown()
e.CreateBasic()

t.Run("update playbook properties", func(t *testing.T) {
Expand Down Expand Up @@ -516,7 +520,8 @@ func TestPlaybookUpdate(t *testing.T) {
}

func TestPlaybookUpdateCrossTeam(t *testing.T) {
e := Setup(t)
e, teardown := Setup(t)
defer teardown()
e.CreateBasic()

t.Run("update playbook properties not in team public playbook", func(t *testing.T) {
Expand Down Expand Up @@ -546,7 +551,8 @@ func TestPlaybookUpdateCrossTeam(t *testing.T) {
}

func TestPlaybooksSort(t *testing.T) {
e := Setup(t)
e, teardown := Setup(t)
defer teardown()
e.CreateClients()
e.CreateBasicServer()
e.SetE20Licence()
Expand Down Expand Up @@ -788,7 +794,8 @@ func TestPlaybooksSort(t *testing.T) {
}

func TestPlaybooksPaging(t *testing.T) {
e := Setup(t)
e, teardown := Setup(t)
defer teardown()
e.CreateClients()
e.CreateBasicServer()
e.SetE20Licence()
Expand Down Expand Up @@ -927,7 +934,8 @@ func getPlaybookIDsList(playbooks []client.Playbook) []string {
}

func TestPlaybooksPermissions(t *testing.T) {
e := Setup(t)
e, teardown := Setup(t)
defer teardown()
e.CreateBasic()

t.Run("test no permissions to create", func(t *testing.T) {
Expand Down Expand Up @@ -1139,7 +1147,8 @@ func TestPlaybooksPermissions(t *testing.T) {
}

func TestPlaybooksConversions(t *testing.T) {
e := Setup(t)
e, teardown := Setup(t)
defer teardown()
e.CreateBasic()

t.Run("public to private conversion", func(t *testing.T) {
Expand Down Expand Up @@ -1198,7 +1207,8 @@ func TestPlaybooksConversions(t *testing.T) {
}

func TestPlaybooksImportExport(t *testing.T) {
e := Setup(t)
e, teardown := Setup(t)
defer teardown()
e.CreateClients()
e.CreateBasicServer()
e.CreateBasicPublicPlaybook()
Expand Down Expand Up @@ -1226,7 +1236,8 @@ func TestPlaybooksImportExport(t *testing.T) {
}

func TestPlaybooksDuplicate(t *testing.T) {
e := Setup(t)
e, teardown := Setup(t)
defer teardown()
e.CreateClients()
e.CreateBasicServer()
e.SetE20Licence()
Expand All @@ -1247,7 +1258,8 @@ func TestPlaybooksDuplicate(t *testing.T) {
}

func TestAddPostToTimeline(t *testing.T) {
e := Setup(t)
e, teardown := Setup(t)
defer teardown()
e.CreateBasic()

dialogRequest := model.SubmitDialogRequest{
Expand Down Expand Up @@ -1294,7 +1306,8 @@ func TestAddPostToTimeline(t *testing.T) {
}

func TestPlaybookStats(t *testing.T) {
e := Setup(t)
e, teardown := Setup(t)
defer teardown()
e.CreateClients()
e.CreateBasicServer()
e.SetE20Licence()
Expand Down Expand Up @@ -1329,7 +1342,8 @@ func TestPlaybookStats(t *testing.T) {
}

func TestPlaybookGetAutoFollows(t *testing.T) {
e := Setup(t)
e, teardown := Setup(t)
defer teardown()
e.CreateBasic()

p1ID, err := e.PlaybooksAdminClient.Playbooks.Create(context.Background(), client.PlaybookCreateOptions{
Expand Down Expand Up @@ -1432,7 +1446,8 @@ func TestPlaybookGetAutoFollows(t *testing.T) {
}

func TestPlaybookChecklistCleanup(t *testing.T) {
e := Setup(t)
e, teardown := Setup(t)
defer teardown()
e.CreateBasic()

t.Run("update playbook", func(t *testing.T) {
Expand Down
Loading

0 comments on commit 01f0392

Please sign in to comment.