问题
Good day to all. I'm trying to write functional tests for some Spring endpoints (Spring is not a key here) which use my REST application as a black box and try to connect to it via http.
Algorithm is as follows:
- The application starts with empty test database
- Test starts, in
@Before
method it fills the database with needed data - Test performs a http request to application and receives the answer
- Test compares given response with the expected one.
Almost all of the tests work good but in one case application uses a materialized view and when test tries to receive data from endpoint, returned data is almost empty. It also happens when I in@Before
method make a REFRESH MATERIALIZED VIEW SQL. But when I do it in pgadmin (in the same connection) everything works well.
I think, this happens because of the application connects via jdbc first (when database and view are empty) and when the test's second connection refreshes the materialized view, it couldn't see the changes in it.
Am I right?
And my question is: what algorithm should I use (I can't change the application query and add refresh command there) to solve this problem? Thanks
回答1:
Sorry, it was due to bug in post-filter advice in my code
来源:https://stackoverflow.com/questions/34178190/consistency-of-materialize-view-refreshing-result-between-two-jdbc-connections