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

Test elastic above 8.0.0 on an existing server #567

Open
maxenva-ext opened this issue Dec 21, 2023 · 1 comment
Open

Test elastic above 8.0.0 on an existing server #567

maxenva-ext opened this issue Dec 21, 2023 · 1 comment
Assignees

Comments

@maxenva-ext
Copy link

maxenva-ext commented Dec 21, 2023

What action do you want to perform

There is 2 issue :
It looks like we can't connect pytest-elasticsearch with an elastic client above 8.0.0 on a server that already exist with the following line
es_client = factories.elasticsearch("elasticsearch_nooproc")

Elastic client changed their way to connect with the elastic-transport-python API and since there is the following error.

ValueError: URL must include a 'scheme', 'host', and 'port' component (ie 'https://localhost:9200')
~/.local/lib/python3.10/site-packages/elastic_transport/client_utils.py:212: ValueError

The second issue is smaller but when you use a toml file for configuration there is wrong type raised by elastic-transport-python that raise this error.

`TypeError: '<' not supported between instances of 'str' and 'int'`
~/.local/lib/python3.10/site-packages/elastic_transport/_models.py:305: TypeError

I've found a small (disgracious) work around in the factories.py file

yield NoopElasticsearch(host=es_host, port=es_port) # master 
yield NoopElasticsearch(host=es_host, port=int(es_port)) # work around 

The toml file I used

[tool.pytest.ini_options]
elasticsearch_port = 9200

maybe i've missed some breaking change with elasticsearch-py

BTW my requiriement.txt

pytest==7.4.0
pytest-elasticsearch==4.0.2
python-dotenv==1.0.0
elasticsearch==8.6.2
elasticsearch-dsl>=8.0.0,<9.0.0
@tsclearcode
Copy link

Hi @maxenva-ext
I'm not able to reproduce the first issue.
I've tried on:

  • 8.12.1 ES server
  • elastic-transport==8.12.0
  • elasticsearch==8.12.0

Could you provide minimal working example?

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

No branches or pull requests

2 participants