[
https://issues.apache.org/jira/browse/GOBBLIN-2065?focusedWorklogId=918449&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-918449
]
ASF GitHub Bot logged work on GOBBLIN-2065:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 09/May/24 01:39
Start Date: 09/May/24 01:39
Worklog Time Spent: 10m
Work Description: phet commented on code in PR #3948:
URL: https://github.com/apache/gobblin/pull/3948#discussion_r1594864769
##########
gobblin-service/src/test/java/org/apache/gobblin/service/modules/orchestration/proc/ReevaluateDagProcTest.java:
##########
@@ -61,18 +64,36 @@ public class ReevaluateDagProcTest {
private final long flowExecutionId = System.currentTimeMillis();
private final String flowGroup = "fg";
- void mockDMSS(DagManagementStateStore dagManagementStateStore) throws
IOException, SpecNotFoundException {
+ private ITestMetastoreDatabase testMetastoreDatabase;
+ private DagManagementStateStore dagManagementStateStore;
+
+ @BeforeClass
+ public void setUpClass() throws Exception {
+ this.testMetastoreDatabase = TestMetastoreDatabaseFactory.get();
+ }
+
+ @BeforeMethod
+ public void setUp() throws Exception {
+ this.dagManagementStateStore =
spy(MostlyMySqlDagManagementStateStoreTest.getDummyDMSS(this.testMetastoreDatabase));
+ mockDMSSCommonBehavior(dagManagementStateStore);
+ }
+
+ private void mockDMSSCommonBehavior(DagManagementStateStore
dagManagementStateStore) throws IOException, SpecNotFoundException {
doReturn(FlowSpec.builder().build()).when(dagManagementStateStore).getFlowSpec(any());
doNothing().when(dagManagementStateStore).tryAcquireQuota(any());
doNothing().when(dagManagementStateStore).addDagNodeState(any(), any());
+ doNothing().when(dagManagementStateStore).deleteDagNodeState(any(), any());
doReturn(true).when(dagManagementStateStore).releaseQuota(any());
}
+ @AfterClass(alwaysRun = true)
+ public void tearDownClass() throws Exception {
+ // `.close()` to avoid (in the aggregate, across multiple suites) -
java.sql.SQLNonTransientConnectionException: Too many connections
+ this.testMetastoreDatabase.close();
+ }
+
@Test
public void testOneNextJobToRun() throws Exception {
- ITestMetastoreDatabase testMetastoreDatabase =
TestMetastoreDatabaseFactory.get();
- DagManagementStateStore dagManagementStateStore =
spy(MostlyMySqlDagManagementStateStoreTest.getDummyDMSS(testMetastoreDatabase));
- mockDMSS(dagManagementStateStore);
Review Comment:
while each test uses divergent mocking, they can still initialize the bulk
of the spy setup in a `@BeforeMethod`, so resituated it there
Issue Time Tracking
-------------------
Worklog Id: (was: 918449)
Time Spent: 1h (was: 50m)
> close ITestMetastoreDatabase in all tests
> -----------------------------------------
>
> Key: GOBBLIN-2065
> URL: https://issues.apache.org/jira/browse/GOBBLIN-2065
> Project: Apache Gobblin
> Issue Type: Bug
> Reporter: Arjun Singh Bora
> Priority: Major
> Time Spent: 1h
> Remaining Estimate: 0h
>
> if test db is not closed, it will eventually give `TooManyConnections`
> exception
--
This message was sent by Atlassian Jira
(v8.20.10#820010)