(t *testing.T, db string, t1, t2 *driver.RegistrySQL)
| 34 | } |
| 35 | |
| 36 | func testRegistry(t *testing.T, db string, t1, t2 *driver.RegistrySQL) { |
| 37 | // TODO enable parallel tests for mysql once we support automatic transaction retries |
| 38 | var parallel bool |
| 39 | switch db { |
| 40 | case "mysql", "sqlite": |
| 41 | parallel = false |
| 42 | default: |
| 43 | parallel = true |
| 44 | } |
| 45 | |
| 46 | t.Run("client", func(t *testing.T) { |
| 47 | if parallel { |
| 48 | // currently not possible as we have a lot of side-effects on listing of the clients between this and other tests |
| 49 | // t.Parallel() |
| 50 | } |
| 51 | |
| 52 | t.Run("case=create-get-update-delete", client.TestHelperCreateGetUpdateDeleteClient(t1.ClientManager(), t2.ClientManager())) |
| 53 | |
| 54 | t.Run("case=autogenerate-key", client.TestHelperClientAutoGenerateKey(t1.ClientManager())) |
| 55 | |
| 56 | t.Run("case=auth-client", client.TestHelperClientAuthenticate(t1.ClientManager())) |
| 57 | |
| 58 | t.Run("case=update-two-clients", client.TestHelperUpdateTwoClients(t1.ClientManager())) |
| 59 | }) |
| 60 | |
| 61 | for _, reg := range []*driver.RegistrySQL{t1, t2} { |
| 62 | t.Run("consent", func(t *testing.T) { |
| 63 | if parallel { |
| 64 | t.Parallel() |
| 65 | } |
| 66 | test.ConsentManagerTests(t, reg, reg.ConsentManager(), reg.LoginManager(), reg.ClientManager(), reg.OAuth2Storage()) |
| 67 | }) |
| 68 | |
| 69 | t.Run("login", func(t *testing.T) { |
| 70 | if parallel { |
| 71 | t.Parallel() |
| 72 | } |
| 73 | test.LoginManagerTest(t, reg, reg.LoginManager()) |
| 74 | }) |
| 75 | |
| 76 | t.Run("obfuscated subject", func(t *testing.T) { |
| 77 | if parallel { |
| 78 | t.Parallel() |
| 79 | } |
| 80 | test.ObfuscatedSubjectManagerTest(t, reg, reg.ObfuscatedSubjectManager(), reg.ClientManager()) |
| 81 | }) |
| 82 | |
| 83 | t.Run("logout", func(t *testing.T) { |
| 84 | if parallel { |
| 85 | t.Parallel() |
| 86 | } |
| 87 | test.LogoutManagerTest(t, reg.LogoutManager(), reg.ClientManager()) |
| 88 | }) |
| 89 | } |
| 90 | |
| 91 | t.Run("jwk", func(t *testing.T) { |
| 92 | for _, tc := range []struct { |
| 93 | alg string |
no test coverage detected