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

fix: Fix support for InfluxDB 1.8.x in InfluxQLQueryAPI #459

Merged
merged 3 commits into from
Oct 26, 2022

Conversation

btasker
Copy link
Contributor

@btasker btasker commented Oct 25, 2022

Proposed Changes

Switches to sending InfluxQL queries as a urlencoded form-body to ensure compatibility with 1.8.x's InfluxQL implementation.

See (#458)

Checklist

  • CHANGELOG.md updated
  • Rebased/mergeable
  • mvn test completes successfully
  • Commit messages are conventional
  • Sign CLA (if not already signed)

InfluxQL queries will be sent as a urlencoded form-body as 1.8.x does not support use of the `application/vnd.influxql` mime-type
@btasker btasker changed the title fix: Fix support for InfluxDB 1.8.x in InfluxQLQueryAPI (#458) fix: Fix support for InfluxDB 1.8.x in InfluxQLQueryAPI Oct 25, 2022
Copy link
Contributor

@bednar bednar left a comment

Choose a reason for hiding this comment

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

Thanks for your PR 👍

Please add test for your changes:

@Test
void testInfluxDB18() {
    // create database
    String db = "testing_database";
    influxDBQuery("CREATE DATABASE " + db, db);

    // connect to InfluxDB 1.8
    influxDBClient.close();
    influxDBClient = InfluxDBClientFactory.createV1(getInfluxDbUrl(), "username", "password".toCharArray(),
            db, "autogen");
    influxQLQueryApi = influxDBClient.getInfluxQLQueryApi();

    // test query to InfluxDB 1.8
    InfluxQLQueryResult result = influxQLQueryApi.query(new InfluxQLQuery("SHOW DATABASES", db));
    assertSingleSeriesRecords(result)
            .map(record -> record.getValueByKey("name"))
            .contains(db);


    // drop database
    influxDBQuery("DROP DATABASE " + db, db);
}

to

Adds test for InfluxQL queries against a 1.8 instance. Credit to @bednar
@codecov-commenter
Copy link

codecov-commenter commented Oct 26, 2022

Codecov Report

Base: 88.40% // Head: 88.40% // No change to project coverage 👍

Coverage data is based on head (f748c64) compared to base (f137cd9).
Patch has no changes to coverable lines.

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #459   +/-   ##
=========================================
  Coverage     88.40%   88.40%           
  Complexity      777      777           
=========================================
  Files           172      172           
  Lines          7014     7014           
  Branches        378      378           
=========================================
  Hits           6201     6201           
  Misses          693      693           
  Partials        120      120           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@btasker btasker requested a review from bednar October 26, 2022 08:42
Copy link
Contributor

@bednar bednar left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@btasker btasker merged commit fbedbd8 into influxdata:master Oct 26, 2022
@bednar bednar added this to the 6.7.0 milestone Oct 26, 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.

3 participants