or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

advanced-features.mdcontainer-management.mdcore-framework.mddatabase-testing.mdindex.mdjdbc-utilities.md

database-testing.mddocs/

0

# Database-Specific Testing

1

2

Specialized test suites for individual database systems with database-specific functionality testing, SQL dialect compatibility, and unique feature validation. Each database suite extends the core framework with database-specific test scenarios.

3

4

## Capabilities

5

6

### PostgreSQL Integration Suite

7

8

Comprehensive test suite for PostgreSQL database integration with Spark JDBC.

9

10

```scala { .api }

11

/**

12

* PostgreSQL-specific integration test suite

13

* Tests PostgreSQL-specific features and SQL dialect compatibility

14

*/

15

class PostgreSQLIntegrationSuite extends DockerJDBCIntegrationSuite {

16

override val databaseType = "postgresql"

17

override val databaseImage = "postgres:13"

18

19

/** Test basic JDBC connectivity */

20

def testBasicConnectivity(): Unit

21

22

/** Test join pushdown optimization */

23

def testJoinPushdown(): Unit

24

25

/** Test DataSource V2 namespace operations */

26

def testNamespaceOperations(): Unit

27

28

/** Test PostgreSQL-specific data types */

29

def testPostgreSQLDataTypes(): Unit

30

31

/** Test array and JSON data types */

32

def testAdvancedDataTypes(): Unit

33

34

/** Test PostgreSQL full-text search */

35

def testFullTextSearch(): Unit

36

}

37

```

38

39

### MySQL Integration Suite

40

41

MySQL-specific integration testing with character set handling and MySQL dialect features.

42

43

```scala { .api }

44

/**

45

* MySQL-specific integration test suite

46

* Tests MySQL-specific features, character sets, and SQL dialect

47

*/

48

class MySQLIntegrationSuite extends DockerJDBCIntegrationSuite {

49

override val databaseType = "mysql"

50

override val databaseImage = "mysql:8.0"

51

52

/** Test basic JDBC connectivity */

53

def testBasicConnectivity(): Unit

54

55

/** Test MySQL-specific SQL dialect compatibility */

56

def testSqlDialectCompatibility(): Unit

57

58

/** Test character set and collation handling */

59

def testCharsetHandling(): Unit

60

61

/** Test MySQL-specific data types */

62

def testMySQLDataTypes(): Unit

63

64

/** Test AUTO_INCREMENT columns */

65

def testAutoIncrement(): Unit

66

67

/** Test MySQL storage engines */

68

def testStorageEngines(): Unit

69

}

70

```

71

72

### MariaDB Integration Suite

73

74

MariaDB-specific testing for MariaDB features and MySQL compatibility.

75

76

```scala { .api }

77

/**

78

* MariaDB-specific integration test suite

79

* Tests MariaDB-specific features and MySQL compatibility

80

*/

81

class MariaDBIntegrationSuite extends DockerJDBCIntegrationSuite {

82

override val databaseType = "mariadb"

83

override val databaseImage = "mariadb:10.6"

84

85

/** Test basic JDBC connectivity */

86

def testBasicConnectivity(): Unit

87

88

/** Test MariaDB-specific SQL features */

89

def testMariaDBFeatures(): Unit

90

91

/** Test MySQL compatibility mode */

92

def testMySQLCompatibility(): Unit

93

94

/** Test MariaDB JSON data type */

95

def testJsonDataType(): Unit

96

97

/** Test columnar storage engine */

98

def testColumnStore(): Unit

99

}

100

```

101

102

### Oracle Integration Suite

103

104

Oracle Database integration testing with advanced Oracle features and Kerberos authentication.

105

106

```scala { .api }

107

/**

108

* Oracle-specific integration test suite

109

* Tests Oracle-specific features, data types, and authentication

110

*/

111

class OracleIntegrationSuite extends DockerJDBCIntegrationSuite {

112

override val databaseType = "oracle"

113

override val databaseImage = "oracle/database:19.3.0-ee"

114

115

/** Test basic JDBC connectivity */

116

def testBasicConnectivity(): Unit

117

118

/** Test Kerberos authentication support */

119

def testKerberosAuthentication(): Unit

120

121

/** Test Oracle-specific data types (CLOB, BLOB, etc.) */

122

def testOracleSpecificTypes(): Unit

123

124

/** Test Oracle sequences and triggers */

125

def testSequencesAndTriggers(): Unit

126

127

/** Test Oracle PL/SQL procedures */

128

def testPLSQLProcedures(): Unit

129

130

/** Test Oracle partitioning features */

131

def testPartitioning(): Unit

132

133

/** Test Oracle RAC connectivity */

134

def testRACConnectivity(): Unit

135

}

136

```

137

138

### DB2 Integration Suite

139

140

IBM DB2 integration testing with DB2-specific features and z/OS compatibility.

141

142

```scala { .api }

143

/**

144

* IBM DB2-specific integration test suite

145

* Tests DB2-specific features and SQL dialect

146

*/

147

class DB2IntegrationSuite extends DockerJDBCIntegrationSuite {

148

override val databaseType = "db2"

149

override val databaseImage = "ibmcom/db2:11.5.7.0a"

150

151

/** Test basic JDBC connectivity */

152

def testBasicConnectivity(): Unit

153

154

/** Test DB2-specific SQL dialect */

155

def testDB2SqlDialect(): Unit

156

157

/** Test DB2-specific data types */

158

def testDB2DataTypes(): Unit

159

160

/** Test DB2 stored procedures */

161

def testStoredProcedures(): Unit

162

163

/** Test DB2 XML data type */

164

def testXmlDataType(): Unit

165

166

/** Test DB2 table spaces */

167

def testTableSpaces(): Unit

168

}

169

```

170

171

### SQL Server Integration Suite

172

173

Microsoft SQL Server integration testing with Windows authentication and SQL Server features.

174

175

```scala { .api }

176

/**

177

* Microsoft SQL Server-specific integration test suite

178

* Tests SQL Server-specific features and T-SQL dialect

179

*/

180

class SQLServerIntegrationSuite extends DockerJDBCIntegrationSuite {

181

override val databaseType = "sqlserver"

182

override val databaseImage = "mcr.microsoft.com/mssql/server:2019-latest"

183

184

/** Test basic JDBC connectivity */

185

def testBasicConnectivity(): Unit

186

187

/** Test T-SQL dialect compatibility */

188

def testTSqlDialect(): Unit

189

190

/** Test SQL Server-specific data types */

191

def testSqlServerDataTypes(): Unit

192

193

/** Test Windows authentication */

194

def testWindowsAuthentication(): Unit

195

196

/** Test SQL Server indexes and constraints */

197

def testIndexesAndConstraints(): Unit

198

199

/** Test SQL Server temporal tables */

200

def testTemporalTables(): Unit

201

}

202

```

203

204

## Common Test Patterns

205

206

All database-specific test suites follow common patterns for consistent testing:

207

208

### Basic Connectivity Tests

209

210

```scala { .api }

211

/**

212

* Test basic JDBC connectivity

213

* Verifies that Spark can connect to the database

214

* Creates a simple DataFrame and validates data

215

*/

216

def testBasicConnectivity(): Unit

217

218

/**

219

* Test connection pooling behavior

220

* Verifies proper connection management

221

*/

222

def testConnectionPooling(): Unit

223

224

/**

225

* Test connection timeout handling

226

* Validates timeout configuration works correctly

227

*/

228

def testConnectionTimeout(): Unit

229

```

230

231

### Data Type Testing

232

233

```scala { .api }

234

/**

235

* Test database-specific data types

236

* Ensures proper type mapping between Spark and database

237

*/

238

def testDataTypes(): Unit

239

240

/**

241

* Test null value handling

242

* Verifies NULL values are handled correctly

243

*/

244

def testNullHandling(): Unit

245

246

/**

247

* Test large data handling

248

* Tests CLOB, BLOB, and other large data types

249

*/

250

def testLargeDataTypes(): Unit

251

```

252

253

### SQL Dialect Testing

254

255

```scala { .api }

256

/**

257

* Test SQL dialect compatibility

258

* Ensures database-specific SQL works correctly

259

*/

260

def testSqlDialectCompatibility(): Unit

261

262

/**

263

* Test query pushdown optimization

264

* Verifies queries are pushed down to database

265

*/

266

def testQueryPushdown(): Unit

267

268

/**

269

* Test aggregate function pushdown

270

* Tests pushdown of SUM, COUNT, etc.

271

*/

272

def testAggregatePushdown(): Unit

273

```

274

275

## Database-Specific Features

276

277

### PostgreSQL Features

278

279

- Advanced data types (arrays, JSON, UUID)

280

- Full-text search capabilities

281

- PostGIS spatial extensions

282

- Custom operator classes

283

- Partial indexes

284

285

### MySQL Features

286

287

- Character set and collation handling

288

- AUTO_INCREMENT columns

289

- Storage engine selection (InnoDB, MyISAM)

290

- MySQL-specific functions

291

- Trigger and procedure support

292

293

### Oracle Features

294

295

- Advanced data types (CLOB, BLOB, XMLType)

296

- Kerberos authentication

297

- PL/SQL stored procedures

298

- Oracle sequences and triggers

299

- Partitioning and indexing

300

- RAC (Real Application Clusters) support

301

302

### DB2 Features

303

304

- DB2-specific SQL dialect

305

- XML data type support

306

- Stored procedure integration

307

- Table space management

308

- z/OS connectivity (when applicable)

309

310

### SQL Server Features

311

312

- T-SQL dialect support

313

- Windows authentication

314

- Temporal tables

315

- Advanced indexing features

316

- SQL Server-specific data types

317

- Integration Services (SSIS) compatibility

318

319

## Usage Examples

320

321

```scala

322

// PostgreSQL testing

323

class MyPostgreSQLTest extends PostgreSQLIntegrationSuite {

324

test("test JSON data type") {

325

val jsonData = """{"name": "test", "value": 123}"""

326

// Test PostgreSQL JSON operations

327

}

328

}

329

330

// MySQL testing

331

class MyMySQLTest extends MySQLIntegrationSuite {

332

test("test character set handling") {

333

// Test UTF-8 and other character sets

334

}

335

}

336

337

// Oracle testing

338

class MyOracleTest extends OracleIntegrationSuite {

339

test("test CLOB handling") {

340

// Test large character data

341

}

342

}

343

```