If tests ran, data was created, but in the middle of the test the machine crashed — did the data remain in the database? How was it resolved?
Asked at
AI answer
It depends on whether the changes were committed. If the test ran in a transaction that was not committed, closing the connection usually causes a rollback; in the event of a network failure, the rollback may not happen immediately—it depends on timeouts and the state of the connection. If data was saved in separate commits or in autocommit mode, it may remain in the database. Therefore, tests should have reliable cleanup: rolling back the transaction or deleting test data in teardown, isolating data by run ID, and, if necessary, cleaning it up based on TTL. For flaky tests, it is convenient to use a separate schema or an ephemeral database. In practice, verify the result in the database rather than relying only on the test process having ended.
Also asked at СБЕР
- Tell about your work experience, what projects you participated in, what tasks you performed.
- Do you have any questions about the project?
- What database management systems have you already worked with?
- An HTTP request—can you name its components?
- Tell me about the principles of object-oriented programming.
Similar questions
- How do you solve problems with test data on the staging environment (re-running tests, data conflicts in the database)?
- What actions with the database were performed in the tests and for what purpose?
- Has there been generation of test data and their cleanup?
- Have you encountered problems with test data?
- How is a database used in the testing process?