Ensure unittest isolation (#9819)
* api4: fix TestGetUsersNotInTeam assertions This test was relying on data from a previous test run. With the data cleared before each test, the assertions much match reality. * *testlib: always InitSystemAdmin Some tests implicitly relied on the basic user having system administrator privileges because it was the first user created as such. Eliminate `InitSystemAdmin` and explicitly create the system admin user instead to avoid this ambiguity going forward. * *testlib: drop all tables before each test * api4: split up TestChannelDelete to avoid duplicate InitBasic * api4: teardown in TestResetPassword, for when this test comes back * invalidate cache on DropAllTables This is necessary since the test store persists across tests. * disable parallel tests While tests within a package must be explicitly parallelized using `t.Parallel()`, tests across packages are run in parallel by default. This causes problems given that the tests all currently share the same database instance. Unfortunately, this also means that running the tests is much slower, but we can return to this later.
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
2555a5d45d
Коммит
a78913178c
@@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCreateIncomingWebhook(t *testing.T) {
|
||||
th := Setup().InitBasic().InitSystemAdmin()
|
||||
th := Setup().InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -74,7 +74,7 @@ func TestCreateIncomingWebhook(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetIncomingWebhooks(t *testing.T) {
|
||||
th := Setup().InitBasic().InitSystemAdmin()
|
||||
th := Setup().InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -153,7 +153,7 @@ func TestGetIncomingWebhooks(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetIncomingWebhook(t *testing.T) {
|
||||
th := Setup().InitBasic().InitSystemAdmin()
|
||||
th := Setup().InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.SystemAdminClient
|
||||
|
||||
@@ -192,7 +192,7 @@ func TestGetIncomingWebhook(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteIncomingWebhook(t *testing.T) {
|
||||
th := Setup().InitBasic().InitSystemAdmin()
|
||||
th := Setup().InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.SystemAdminClient
|
||||
|
||||
@@ -243,7 +243,7 @@ func TestDeleteIncomingWebhook(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateOutgoingWebhook(t *testing.T) {
|
||||
th := Setup().InitBasic().InitSystemAdmin()
|
||||
th := Setup().InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -293,7 +293,7 @@ func TestCreateOutgoingWebhook(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetOutgoingWebhooks(t *testing.T) {
|
||||
th := Setup().InitBasic().InitSystemAdmin()
|
||||
th := Setup().InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -394,7 +394,7 @@ func TestGetOutgoingWebhooks(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetOutgoingWebhook(t *testing.T) {
|
||||
th := Setup().InitBasic().InitSystemAdmin()
|
||||
th := Setup().InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -424,7 +424,7 @@ func TestGetOutgoingWebhook(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateIncomingHook(t *testing.T) {
|
||||
th := Setup().InitBasic().InitSystemAdmin()
|
||||
th := Setup().InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -644,7 +644,7 @@ func TestUpdateIncomingHook(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRegenOutgoingHookToken(t *testing.T) {
|
||||
th := Setup().InitBasic().InitSystemAdmin()
|
||||
th := Setup().InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -676,7 +676,7 @@ func TestRegenOutgoingHookToken(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateOutgoingHook(t *testing.T) {
|
||||
th := Setup().InitBasic().InitSystemAdmin()
|
||||
th := Setup().InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -839,7 +839,7 @@ func TestUpdateOutgoingHook(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteOutgoingHook(t *testing.T) {
|
||||
th := Setup().InitBasic().InitSystemAdmin()
|
||||
th := Setup().InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.SystemAdminClient
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user