database-rider / database-rider

Database testing made easy!

Home Page:https://database-rider.github.io/database-rider

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Column casing issue on postgres database

Theshedman opened this issue · comments

I am experiencing some issues seeding data in my Postgres database. It's a casing issue. DBRider keeps converting both my table and column names to uppercase. After I set the caseInsensitiveStrategy to LOWERCASE, the table name was no longer in uppercase except the column name.

Expected behaviour: I expect both the table and the column names to all be in lowercase after setting the caseSensitiveTableNames to false and caseInsensitiveStrategy to LOWERCASE

Actual behavior: only the table name is in lowercase while the column name is still in uppercase despite the settings in the dbunit.yml file

Dependency:

<dependency>
    <groupId>com.github.database-rider</groupId>
    <artifactId>rider-junit5</artifactId>
    <version>1.41.1</version>
</dependency>

dbunit.yml File:

cacheConnection: true
cacheTableNames: true
leakHunter: true
caseInsensitiveStrategy: LOWERCASE
properties:
  batchedStatements: true
  schema: public
  caseSensitiveTableNames: false
  escapePattern: "?"

Seed Data:

kyc_requirements:
  - id: hdksldi231idksjaue
    wallet: NGN
    mandatory: true
    verification_type: BVN
  - id: uusikehgnsasdeffog
    wallet: NGN
    mandatory: true
    verification_type: NIN
  - id: lskdnbow0eoswlerbms
    wallet: NGN
    mandatory: true
    verification_type: AML

Exception:

java.lang.RuntimeException: Could not create dataset for test 'setupKYCRequirement'.

	at com.github.database.rider.core.RiderRunner.runBeforeTest(RiderRunner.java:46)
	at com.github.database.rider.junit5.DBUnitExtension.beforeTestExecution(DBUnitExtension.java:69)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
Caused by: com.github.database.rider.core.exception.DataBaseSeedingException: Could not initialize dataset: datasets/kycRequirement.yml
	at com.github.database.rider.core.dataset.DataSetExecutorImpl.createDataSet(DataSetExecutorImpl.java:142)
	at com.github.database.rider.core.RiderRunner.runBeforeTest(RiderRunner.java:44)
	... 3 more
Caused by: org.dbunit.dataset.NoSuchColumnException: kyc_requirements.MANDATORY -  (Non-uppercase input column: mandatory) in ColumnNameToIndexes cache map. Note that the map's column names are NOT case sensitive.
	at org.dbunit.dataset.AbstractTableMetaData.getColumnIndex(AbstractTableMetaData.java:117)
	at org.dbunit.operation.AbstractOperation.getOperationMetaData(AbstractOperation.java:89)
	at org.dbunit.operation.AbstractBatchOperation.execute(AbstractBatchOperation.java:151)
	at org.dbunit.operation.CompositeOperation.execute(CompositeOperation.java:79)
	at com.github.database.rider.core.dataset.DataSetExecutorImpl.createDataSet(DataSetExecutorImpl.java:133)
	```

I discovered that everything is working as it should. I mistakenly provided the wrong column name in one of the columns.