Skip to content

rql_test: remove previous tested database dir before reusing it - #2147

Merged
AtnNn merged 1 commit into
rethinkdb:nextfrom
Aleaxander:yliu-py-connect-fix
Mar 24, 2014
Merged

AtnNn merged 1 commit into
rethinkdb:nextfrom
Aleaxander:yliu-py-connect-fix

Conversation

@Aleaxander

Copy link
Copy Markdown
Contributor

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]

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]>
@AtnNn

AtnNn commented Mar 24, 2014

Copy link
Copy Markdown
Member

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.

@AtnNn AtnNn self-assigned this Mar 24, 2014
@AtnNn AtnNn added this to the 1.11.x milestone Mar 24, 2014
@Aleaxander

Copy link
Copy Markdown
Contributor Author

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.

@AtnNn

AtnNn commented Mar 24, 2014

Copy link
Copy Markdown
Member

I have tested this pull request and it seems to works great. I will merge it tomorrow if no one objects.

AtnNn added a commit that referenced this pull request Mar 24, 2014
rql_test: remove previous tested database dir before reusing it
@AtnNn
AtnNn merged commit efa5d18 into rethinkdb:next Mar 24, 2014
@AtnNn

AtnNn commented Mar 24, 2014

Copy link
Copy Markdown
Member

Thanks again @Aleaxander for these pull requests.

I would be interested in hearing more about your framework.

@AtnNn AtnNn modified the milestones: 1.12, 1.11.x Mar 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants