Repository navigation
rql_test: remove previous tested database dir before reusing it - #2147
Conversation
We will assign a random port to each server, and then use it to
construct a database dir in form of "run/server_${port}".
As we don't use same port number in one run, we met no issues. However,
we never delete those databases, thus we are, of course, in a high
chance that we will use a same dir we used before, which results to a
following error:
======================================================================
ERROR: test_repl (__main__.TestConnection)
----------------------------------------------------------------------
Traceback (most recent call last):
File "connections/connection.py", line 180, in setUp
r.db_create('test').run(conn)
File "../../drivers/python/rethinkdb/ast.py", line 108, in run
return c._start(self, **global_opt_args)
File "../../drivers/python/rethinkdb/net.py", line 193, in _start
return self._send_query(query, term, global_opt_args)
File "../../drivers/python/rethinkdb/net.py", line 300, in _send_query
self._check_error_response(response, term)
File "../../drivers/python/rethinkdb/net.py", line 268, in _check_error_response
raise RqlRuntimeError(message, term, frames)
RqlRuntimeError: Database `test` already exists. in:
r.db_create('test')
^^^^^^^^^^^^^^^^^^^
It happens because we *did* already create "test" database before.
Unconditionally removing a database directory if we are going to use
it again will fix it.
BTW, why it is worth to keep them? Can we just remove them after test?
Or, if you are considering for later check, I guess it's better to
store them at test_result dir, then it will keep the database director
being uniq?
Signed-off-by: Liu Aleaxander <[email protected]>
|
Thanks for identifying the problem. Your fix looks good to me. I think the data directories are kept because they can be used to track the cause of a test failure. We have a Jenkins instance in our intranet that runs automated tests. I prefer waiting for them to be green for a few days before unmarking this test as flaky. |
|
Fare enough. Anyway, JFYI, I was also working on an automate test framework at part time; it's fair simple now and it works well as expected. After being aware of this issue, I modified my test script to remove test/sql_test/run unconditionally each time before running a new test. I queued bunches of commit for testing, and it got about 30 results so far, and I see none failed of py-connect. And just as said, there is no need for being rush to get rid of it from flaky list, I'm okay to wait few more days. |
|
I have tested this pull request and it seems to works great. I will merge it tomorrow if no one objects. |
rql_test: remove previous tested database dir before reusing it
|
Thanks again @Aleaxander for these pull requests. I would be interested in hearing more about your framework. |
We will assign a random port to each server, and then use it to
construct a database dir in form of "run/server_${port}".
As we don't use same port number in one run, we met no issues. However,
we never delete those databases, thus we are, of course, in a high
chance that we will use a same dir we used before, which results to a
following error:
It happens because we did already create "test" database before.
Unconditionally removing a database directory if we are going to use
it again will fix it.
BTW, why it is worth to keep them? Can we just remove them after test?
Or, if you are considering for later check, I guess it's better to
store them at test_result dir, then it will keep the database director
being uniq?
Signed-off-by: Liu Aleaxander [email protected]