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

Debug postgresql #304

Merged
merged 39 commits into from
Mar 8, 2024
Merged

Debug postgresql #304

merged 39 commits into from
Mar 8, 2024

Conversation

Juliettejns
Copy link
Contributor

Branche de debug pour la version postgresql de pyrrha.
Log des erreurs avant debug:

FAILED tests/test_selenium/test_corpus_init.py::TestCorpusRegistration::test_registration_with_an_existing_name - sqlalchemy.exc.IntegrityError: (psycopg2.errors.UniqueViolation) duplicate key value violates unique constraint "control_lists_pkey"
DETAIL:  Key (id)=(1) already exists.

[SQL: INSERT INTO control_lists (name, public, parent_id, description, bibliography, language, notes) VALUES (%(name)s, %(public)s, %(parent_id)s, %(description)s, %(bibliography)s, %(language)s, %(notes)s) RETURNING control_lists.id]
[parameters: {'name': 'Français Moderne', 'public': 'public', 'parent_id': None, 'description': 'Une configuration générique pour le français moderne', 'bibliography': None, 'language': 'fre', 'notes': None}]
(Background on this error at: https://sqlalche.me/e/20/gkpj)
FAILED tests/test_selenium/test_dashboard.py::TestDashboard::test_corpora_displayed_same_as_header_items - sqlalchemy.exc.IntegrityError: (psycopg2.errors.ForeignKeyViolation) insert or update on table "favorite" violates foreign key constraint "favorite_corpus_id_fkey"
DETAIL:  Key (corpus_id)=(3) is not present in table "corpus".

[SQL: INSERT INTO favorite (corpus_id, user_id) VALUES (%(corpus_id)s, %(user_id)s)]
[parameters: {'corpus_id': 3, 'user_id': 1}]
(Background on this error at: https://sqlalche.me/e/20/gkpj)
FAILED tests/test_selenium/test_manage_corpus_user.py::TestManageCorpusUser::test_corpus_creator_is_owner - ValueError: Corpus not found FreshNewCorpus
FAILED tests/test_selenium/test_tokens_edit.py::TestTokenEdit::test_delete - selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="token_2_row"]"}
  (Session info: chrome-headless-shell=120.0.6099.216); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception
Stacktrace:
#0 0x556c77c81f83 <unknown>
#1 0x556c7793acf7 <unknown>
#2 0x556c7798a99e <unknown>
#3 0x556c7798aaa1 <unknown>
#4 0x556c779d5d64 <unknown>
#5 0x556c779b40dd <unknown>
#6 0x556c779d3006 <unknown>
#7 0x556c779b3e53 <unknown>
#8 0x556c7797bdd4 <unknown>
#9 0x556c7797d1de <unknown>
#10 0x556c77c46531 <unknown>
#11 0x556c77c4a455 <unknown>
#12 0x556c77c32f55 <unknown>
#13 0x556c77c4b0ef <unknown>
#14 0x556c77c1699f <unknown>
#15 0x556c77c6f008 <unknown>
#16 0x556c77c6f1d7 <unknown>
#17 0x556c77c81124 <unknown>
#18 0x7fb35dc94ac3 <unknown>
FAILED tests/test_selenium/test_tokens_search_through_fields.py::TestTokensSearchThroughFields::test_search_with_or_operator - AssertionError: False is not true
============ 5 failed, 144 passed, 40 warnings in 519.42s (0:08:39) ============
Error: Process completed with exit code 1.

Traitement de l'erreur 1 (test.registration_with_same_name) en rendant non obligatoire l'ajout d'une control List lors de l'ajout d'un corpus dans le test.

Traitement des erreurs 2 et 3 en autoincrémentant les control_list_id dans la fonction add_control_list située dans app.

@Juliettejns Juliettejns changed the base branch from dev to dev-postgresql March 5, 2024 11:04
@Juliettejns
Copy link
Contributor Author

A faire:
Test4 (test_delete): conserve des foreign key dans la table Token_History qui ont été supprimés de la Table Word_Token. Proposition: rendre non obligatoire cette foreign key. La supprimer et ajouter à la place le nom du token supprimé sur la ligne?

Test5: test recherche avec | (ne fonctionne pas car on recherche sein*, ce qui ne sort pas Seinz.
Proposition 1: rendre la recherche case insentitive avec ilike_op si c'est ce que l'on veut tester
Proposition 2: Si l'erreur est non voulu et on ne souhaite pas tester la recherche avec case insentitive, changer de mot ou bien enlever Seinz des éléments de tests.

Copy link
Member

@PonteIneptique PonteIneptique left a comment

Choose a reason for hiding this comment

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

I leave some comments for when you come back to this :)

tests/test_selenium/base.py Outdated Show resolved Hide resolved
tests/test_selenium/test_corpus_init.py Show resolved Hide resolved
tests/db_fixtures/__init__.py Outdated Show resolved Hide resolved
@PonteIneptique
Copy link
Member

@Juliettejns Il semble que le SET fasse planter un truc, d'une manière ou d'une autre. À mon avis, il faut transformer le warning en raise, et donc planter le serveur en cas de mauvaise locale.

@PonteIneptique
Copy link
Member

Il y a des plantages PSQL que je ne m'explique pas.

@PonteIneptique
Copy link
Member

J'ai essayé d'ajouter des with self.app.app_context() mais les runs continuent de casser...

Cf.

with self.app.app_context():

@PonteIneptique
Copy link
Member

@Juliettejns Peux-tu tester voir si les crash psql (sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) server closed the connection unexpectedly) disparaissent en cas de non utilisation du SHOW ? Car je vois rien qui aurait changer sinon.

@PonteIneptique
Copy link
Member

Maybe dpgaspar/Flask-AppBuilder#1130

@Juliettejns
Copy link
Contributor Author

  • Ajout de psql locale avec changement de la langue de postgresql
  • Corrections bug SQL test registration corpus with same name

@Juliettejns
Copy link
Contributor Author

Issues corrigées.
Prêt à push si validation

@PonteIneptique PonteIneptique merged commit 2c220d1 into dev-postgresql Mar 8, 2024
2 of 4 checks passed
@PonteIneptique PonteIneptique deleted the debug_postgresql branch March 11, 2024 09:02
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