Skip to content

Commit

Permalink
test(client): add missing sqlserver (#13801)
Browse files Browse the repository at this point in the history
* test: add missing sqlserver

* test/fix: fail fast on errors

* Revert "Merge branch 'test/fail-fast' into test/missing-sqlserver"

This reverts commit 0913e44, reversing
changes made to 763dcbb.

* fix: changes to support sqlserver

* ci: add missing env

* fix: add missing sql server to test

* test: opt out sqlserver
  • Loading branch information
danstarns committed Jun 17, 2022
1 parent 2fdbc2a commit 82938b9
Show file tree
Hide file tree
Showing 19 changed files with 87 additions and 11 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Expand Up @@ -179,6 +179,7 @@ jobs:
TEST_MYSQL_ISOLATED_URI: mysql://root:root@localhost:3307/tests
TEST_MSSQL_URI: mssql://SA:Pr1sm4_Pr1sm4@localhost:1433/master
TEST_MSSQL_JDBC_URI: sqlserver://localhost:1433;database=master;user=SA;password=Pr1sm4_Pr1sm4;trustServerCertificate=true;
TEST_MSSQL_JDBC_URI_MIGRATE: 'sqlserver://localhost:1433;database=tests-migrate;user=SA;password=Pr1sm4_Pr1sm4;trustServerCertificate=true;'
TEST_MONGO_URI: 'mongodb://root:prisma@localhost:27018/tests?authSource=admin'
TEST_COCKROACH_URI: 'postgresql://prisma@localhost:26257/tests'
TEST_COCKROACH_URI_MIGRATE: 'postgresql://prisma@localhost:26257/tests-migrate'
Expand Down
5 changes: 5 additions & 0 deletions packages/client/tests/functional/_example/_matrix.ts
Expand Up @@ -17,6 +17,11 @@ export default defineMatrix(() => [
id: 'Int @id @default(autoincrement())',
providerFeatures: '',
},
{
provider: 'sqlserver',
id: 'Int @id @default(autoincrement())',
providerFeatures: '',
},
{
provider: 'cockroachdb',
id: 'BigInt @id @default(autoincrement())',
Expand Down
1 change: 1 addition & 0 deletions packages/client/tests/functional/_utils/providers.ts
Expand Up @@ -4,4 +4,5 @@ export enum Providers {
MYSQL = 'mysql',
MONGODB = 'mongodb',
COCKROACHDB = 'cockroachdb',
SQLSERVER = 'sqlserver',
}
Expand Up @@ -4,7 +4,7 @@ process.env.DATABASE_URI_mongodb = process.env.TEST_MONGO_URI
process.env.DATABASE_URI_postgresql = process.env.TEST_POSTGRES_URI
process.env.DATABASE_URI_mysql = process.env.TEST_MYSQL_URI
process.env.DATABASE_URI_cockroachdb = process.env.TEST_COCKROACH_URI
process.env.DATABASE_URI_sqlserver = process.env.TEST_MSSQL_URI
process.env.DATABASE_URI_sqlserver = process.env.TEST_MSSQL_JDBC_URI_MIGRATE

globalThis.testIf = (condition: boolean) => (condition ? test : test.skip)
globalThis.describeIf = (condition: boolean) => (condition ? describe : describe.skip)
Expand Down
3 changes: 3 additions & 0 deletions packages/client/tests/functional/blog-update/_matrix.ts
Expand Up @@ -11,6 +11,9 @@ export default defineMatrix(() => [
{
provider: 'mysql',
},
{
provider: 'sqlserver',
},
{
provider: 'mongodb',
},
Expand Down
4 changes: 4 additions & 0 deletions packages/client/tests/functional/count/_matrix.ts
Expand Up @@ -14,6 +14,10 @@ export default defineMatrix(() => [
provider: 'mysql',
foreignKeyId: 'String?',
},
{
provider: 'sqlserver',
foreignKeyId: 'String?',
},
{
provider: 'cockroachdb',
foreignKeyId: 'String?',
Expand Down
3 changes: 3 additions & 0 deletions packages/client/tests/functional/create-many/_matrix.ts
Expand Up @@ -8,6 +8,9 @@ export default defineMatrix(() => [
{
provider: 'postgresql',
},
{
provider: 'sqlserver',
},
{
provider: 'cockroachdb',
},
Expand Down
7 changes: 4 additions & 3 deletions packages/client/tests/functional/decimal-list/tests.ts
Expand Up @@ -31,10 +31,11 @@ setupTestSuiteMatrix(
},
{
optOut: {
from: ['mongodb', 'mysql', 'sqlite'],
from: ['mongodb', 'mysql', 'sqlite', 'sqlserver'],
reason: `
Mongodb connector does not support the Decimal type.
Mysql & Sqlite connectors do not support lists of primitive types.
mongodb: connector does not support the Decimal type.
mysql & sqlite: connectors do not support lists of primitive types.
sqlserver: Field "decimals" in model "User" can't be a list. The current connector does not support lists of primitive types.
`,
},
},
Expand Down
3 changes: 3 additions & 0 deletions packages/client/tests/functional/decimal/_matrix.ts
Expand Up @@ -11,6 +11,9 @@ export default defineMatrix(() => [
{
provider: 'mysql',
},
{
provider: 'sqlserver',
},
{
provider: 'cockroachdb',
},
Expand Down
Expand Up @@ -11,6 +11,9 @@ export default defineMatrix(() => [
{
provider: 'mysql',
},
{
provider: 'sqlserver',
},
{
provider: 'mongodb',
},
Expand Down
9 changes: 5 additions & 4 deletions packages/client/tests/functional/init-error/tests.ts
Expand Up @@ -7,7 +7,7 @@ declare let prisma: import('@prisma/client').PrismaClient

// https://github.com/prisma/prisma/issues/10229
testMatrix.setupTestSuite(
() => {
({ provider }) => {
test('should assert that the error has the correct errorCode', async () => {
expect.assertions(2)

Expand All @@ -25,10 +25,11 @@ testMatrix.setupTestSuite(
{
skipDb: true,
optOut: {
from: ['sqlite', 'mongodb'],
from: ['sqlite', 'mongodb', 'sqlserver'],
reason: `
sqlite dont have a connection string'
mongodb times out and dont throw
sqlite: dont have a connection string'
mongodb: times out and dont throw
sqlserver: returns undefined
`,
},
},
Expand Down
Expand Up @@ -151,3 +151,35 @@ Invalid \`prisma.user.create()\` invocation in
→ 168 await prisma.user.create(
Unique constraint failed on the fields: (\`email\`)
`;
exports[`interactive-transactions (sqlserver) () batching raw rollback 1`] = `
Invalid \`prisma.$executeRaw()\` invocation:
Raw query failed. Code: \`2627\`. Message: \`Violation of PRIMARY KEY constraint 'User_pkey'. Cannot insert duplicate key in object 'dbo.User'. The duplicate key value is (1).\`
`;
exports[`interactive-transactions (sqlserver) () batching rollback 1`] = `
Invalid \`prisma.user.create()\` invocation in
/client/tests/functional/interactive-transactions/tests.ts:242:19
239 */
240 testIf(getClientEngineType() === ClientEngineType.Library)('batching rollback', async () => {
241 const result = prisma.$transaction([
242 prisma.user.create(
Unique constraint failed on the constraint: \`dbo.User\`
`;
exports[`interactive-transactions (sqlserver) () rollback query 1`] = `
Invalid \`prisma.user.create()\` invocation in
/client/tests/functional/interactive-transactions/tests.ts:168:25
165 },
166 })
167
→ 168 await prisma.user.create(
Unique constraint failed on the constraint: \`dbo.User\`
`;
Expand Up @@ -17,5 +17,8 @@ export default defineMatrix(() => [
{
provider: 'cockroachdb',
},
{
provider: 'sqlserver',
},
],
])
3 changes: 3 additions & 0 deletions packages/client/tests/functional/metrics-disabled/_matrix.ts
Expand Up @@ -11,6 +11,9 @@ export default defineMatrix(() => [
{
provider: 'mysql',
},
{
provider: 'sqlserver',
},
{
provider: 'mongodb',
},
Expand Down
3 changes: 3 additions & 0 deletions packages/client/tests/functional/metrics/_matrix.ts
Expand Up @@ -11,6 +11,9 @@ export default defineMatrix(() => [
{
provider: 'mysql',
},
{
provider: 'sqlserver',
},
{
provider: 'mongodb',
},
Expand Down
Expand Up @@ -11,6 +11,9 @@ export default defineMatrix(() => [
{
provider: 'mysql',
},
{
provider: 'sqlserver',
},
{
provider: 'cockroachdb',
},
Expand Down
Expand Up @@ -48,11 +48,12 @@ testMatrix.setupTestSuite(
},
{
optOut: {
from: ['mongodb', 'mysql', 'sqlite'],
from: ['mongodb', 'mysql', 'sqlite', 'sqlserver'],
reason: `
$queryRaw only works on SQL based providers
mySql You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"TestModel"'
sqlite The current connector does not support lists of primitive types
mySql: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"TestModel"'
sqlite: The current connector does not support lists of primitive types
sqlserver: The current connector does not support the Json type.
`,
},
},
Expand Down
Expand Up @@ -11,6 +11,9 @@ export default defineMatrix(() => [
{
provider: 'cockroachdb',
},
{
provider: 'sqlserver',
},
],
[
{
Expand Down
Expand Up @@ -17,5 +17,8 @@ export default defineMatrix(() => [
{
provider: 'cockroachdb',
},
{
provider: 'sqlserver',
},
],
])

0 comments on commit 82938b9

Please sign in to comment.