-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create Config Database test base class #19640
Conversation
class DatabaseConfigPersistenceTest extends BaseConfigDatabaseTest { | ||
|
||
public static final String DEFAULT_PROTOCOL_VERSION = "0.2.0"; | ||
protected static final StandardSourceDefinition SOURCE_GITHUB = new StandardSourceDefinition() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all of this noise is copied from BaseDatabaseConfigPersistenceTest
. It will all get removed in the next PR which gets rid of DatabaseConfigPersistence
entirely.
statePersistence = new StatePersistence(database); | ||
} | ||
|
||
private void setupTestData() throws JsonValidationException, IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this diff looks bigger than it is. this is just pulled up from lower down in the class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What
DatabaseConfigPersistence
I realized that over time theBaseDatabaseConfigPersistenceTest
had been misused. This was making it so that test run much slower (because the full database migration was being run between each test) and that it was much harder to write test classes for checking our database queries because lots of boilerplate was being needlessly copied and pasted because people didn't understand how to use the base class.How
BaseDatabaseConfigPersistenceTest
withBaseConfigDatabaseTest
. This is a much more opinionated abstraction that I think will be harder to misuse. The javadocs in the class explain it in detail, so I will not repeat it here.DatabaseConfigPersistence
which relies on us splitting out our tests more clearly. Decided to separate out this change for clarity.Results
Time to run
airbyte-config:config-persistence:test
before this change:Time to run
airbyte-config:config-persistence:test
after this change:A neat 55% speed increase!! 😄
Recommended reading order
BaseConfigDatabaseTest.java
🚨 User Impact 🚨