Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests: Resolve flaky Automatix test #5866

Conversation

joeldierkes
Copy link
Contributor

Since 7093082 (Improvements of automatix daemon : Closes #5616, #5617
(#5621), 2022-09-02), the test_automatix test fails infrequently. The
error message provided suggests, that the project variable sometimes
get converted to an integer:

=================================== FAILURES ===================================
________________________________ test_automatix ________________________________
[gw1] linux -- Python 3.6.8 /usr/bin/python
/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/base.py:1803: in _execute_context
    cursor, statement, parameters, context
/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/default.py:732: in do_execute
    cursor.execute(statement, parameters)
E   psycopg2.errors.UndefinedFunction: operator does not exist: character varying = integer
E   LINE 3: WHERE dev.dids.project = 17420750 AND dev.dids.did_type = 'C...
E                                  ^
E   HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.

The project variable used is initialized via the first 8 characters of
a random uuid4 string. This string contains hexadecimal values, which
can lead to a string with the 8 first characters being just integers.
The probability for that with (10 / 16) ^ 8 = 2.33% (if we asume a
uniform distribution) is fairly low, however, we run the tests quite
frequently. This thus is a vaiable candidate for the error.

The filter_engine used in list_dids is responsible for converting
the string to an int. This is desired for now. Postgres is the only
engine which does not provide a functionality to compare a string and an
integer.

Using a string which does not automatically gets converted to an integer
solves the problem.

Since 7093082 (Improvements of automatix daemon : Closes rucio#5616, rucio#5617
(rucio#5621), 2022-09-02), the `test_automatix` test fails infrequently. The
error message provided suggests, that the `project` variable sometimes
get converted to an integer:

```
=================================== FAILURES ===================================
________________________________ test_automatix ________________________________
[gw1] linux -- Python 3.6.8 /usr/bin/python
/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/base.py:1803: in _execute_context
    cursor, statement, parameters, context
/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/default.py:732: in do_execute
    cursor.execute(statement, parameters)
E   psycopg2.errors.UndefinedFunction: operator does not exist: character varying = integer
E   LINE 3: WHERE dev.dids.project = 17420750 AND dev.dids.did_type = 'C...
E                                  ^
E   HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.
```

The `project` variable used is initialized via the first 8 characters of
a random uuid4 string. This string contains hexadecimal values, which
can lead to a string with the 8 first characters being just integers.
The probability for that with `(10 / 16) ^ 8 = 2.33%` (if we asume a
uniform distribution) is fairly low, however, we run the tests quite
frequently. This thus is a vaiable candidate for the error.

The `filter_engine` used in `list_dids` is responsible for converting
the string to an int. This is desired for now. Postgres is the only
engine which does not provide a functionality to compare a string and an
integer.

Using a string which does not automatically gets converted to an integer
solves the problem.
@joeldierkes joeldierkes linked an issue Sep 11, 2022 that may be closed by this pull request
@joeldierkes joeldierkes force-pushed the feature-5865-implicit-casting-in-automatix-test branch from 2b4054b to 1a3fc55 Compare September 11, 2022 20:46
Copy link
Contributor

@cserf cserf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦‍♂️ Good catch.

@bari12 bari12 merged commit e231b3b into rucio:master Sep 15, 2022
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.

Implicit casting error in automatix test Use uploadclient in automatix
3 participants