-
Notifications
You must be signed in to change notification settings - Fork 8
feat: get influxdb version #243
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #243 +/- ##
==========================================
+ Coverage 90.05% 90.14% +0.08%
==========================================
Files 20 20
Lines 1197 1207 +10
Branches 187 188 +1
==========================================
+ Hits 1078 1088 +10
Misses 42 42
Partials 77 77 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Find below my notes:
- I'd call the method rather
getServerVersionas that is the main use-case, the fact that we are callingpingis just implementation detail - I'd also allow to return
I don't know the versionstate, as that could be also possible (so maybe the return value could be @nullable or throw specific exception for that case) + javadoc - the unreachable server or any network error should still throw
InfluxDBApiExceptionexception - the server version should be parsed not only from the header, but also from the response body
Version 2 response (in header):
% curl -G -i https://us-east-1-1.aws.cloud2.influxdata.com/ping
HTTP/2 204
date: Thu, 12 Jun 2025 11:27:04 GMT
trace-id: 3d99d4fd7fa9e3c4
trace-sampled: false
x-influxdb-build: cloud2
x-influxdb-version: 2.0
strict-transport-security: max-age=31536000; includeSubDomains
x-influxdb-request-id: eb997c65c40ccf3d18cc244b2d24d856
x-influxdb-build: Cloud
Version 3 response (in body):
% curl -G -i http://localhost:8181/ping --header "Authorization: Bearer apiv3_....."
HTTP/1.1 200 OK
access-control-allow-origin: *
transfer-encoding: chunked
date: Thu, 12 Jun 2025 11:29:37 GMT
{"version":"3.0.2","revision":"d80d6cd600","process_id":"c876e998-9c58-4ba6-a4d4-bcb0a7ee9d7b"}
Hi, so what about |
No need to change anything in |
|
@jansimonb |
jansimonb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To increase coverage and to test valid use-cases, please, add tests where:
- version header is not set + non-json result is retuned
- version header is not set + no response body present
jansimonb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks! 👍
Closes #242
Proposed Changes
NOTE: It will call /ping api from InfluxDB v2 (branch main-2.x) and returns version 2.0 in the header of the response.
I don't think this is the right behavior because client v3 should work with InfluxDB v3 but I don't think we can do anything from our side.
Checklist