Re: [I] Test Case Failure When Accessing Singleton Resource and Embedded DB [texera]

2026-01-29 Thread via GitHub


Xiao-zhen-Liu closed issue #4178: Test Case Failure When Accessing Singleton 
Resource and Embedded DB
URL: https://github.com/apache/texera/issues/4178


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [I] Test Case Failure When Accessing Singleton Resource and Embedded DB [texera]

2026-01-27 Thread via GitHub


Xiao-zhen-Liu commented on issue #4178:
URL: https://github.com/apache/texera/issues/4178#issuecomment-3808136469

   The description is accurate. A related PR is #3782.
   Also want to note for "How to reproduce?", currently there are no unit tests 
that will trigger this error because none of them access the singleton 
resources (e.g., `WorkflowAccessResource`.) Once you add such unit tests, the 
issue will appear.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [I] Test Case Failure When Accessing Singleton Resource and Embedded DB [texera]

2026-01-26 Thread via GitHub


seongjinyoon commented on issue #4178:
URL: https://github.com/apache/texera/issues/4178#issuecomment-3802397714

   @Xiao-zhen-Liu Please review the issue.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



[I] Test Case Failure When Accessing Singleton Resource and Embedded DB [texera]

2026-01-26 Thread via GitHub


seongjinyoon opened a new issue, #4178:
URL: https://github.com/apache/texera/issues/4178

   ### What happened?
   
   **Problem:**
   In Texera, we maintain two primary types of test cases:`Unit Tests` and 
`End-to-End Tests`. These tests differ in how they handle resources:
   
   | | Unit Test | End to End Test |
   | :--- | :---: | ---: |
   | **Singleton Resource** | ✅ | ❌ |
   | **Embedded DB** | ❌ | ✅ |
   
   However, issues arise when writing unit tests that access both Singleton 
Resources (such as `SqlServer`) and Embedded DBs (such as `MockTexeraDB`). 
These tests pass when running a single test class but fail when run together 
with other test classes (e.g., `sbt test`).
   
   **Cause:**
   Each test class creates its own `EmbeddedPostgres` on a random port and 
replaces the `SqlServer` singleton. The problem occurs when resource classes 
store the database connection once and reuse it.
   
   Example:
   
https://github.com/apache/texera/blob/850fd8517673626d62808487fa8994be5c1df906/amber/src/main/scala/org/apache/texera/web/resource/dashboard/user/workflow/WorkflowAccessResource.scala#L47-L49
   
   When **Test Class A** runs first, this connection is initialized with Port 
A. When **Test Class A** finishes, its database shuts down. When **Test Class 
B** starts a new database on Port B, the saved connection still points to Port 
A (dead), causing "Connection refused" errors.
   
   **Solution:**
   Change so the connection is looked up fresh each time (dynamic lookup) 
instead of being cached.
   
   ### How to reproduce?
   
   Run any two test classes that use `MockTexeraDB`, where they accesses a 
resource that uses a cached context.
   
   ### Version
   
   1.1.0-incubating (Pre-release/Master)
   
   ### Commit Hash (Optional)
   
   _No response_
   
   ### What browsers are you seeing the problem on?
   
   _No response_
   
   ### Relevant log output
   
   ```shell
   
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]