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 #365 - fix problem of connecting to the influx api with URL which… #400

Merged
merged 12 commits into from
Jun 5, 2018

Conversation

vicctor
Copy link

@vicctor vicctor commented Dec 16, 2017

… does not points to the url root (e.g. localhots:80/influx-api/)

This change was tested with following URLs:
http://localhost:8086
http://localhost:8086/

Proxied connection (influx behind Nginx)
http://loocalhost:8080/influx-api/

… URL which does not points to the url root (e.g. localhots:80/influx-api/)

This change was tested with following URLs:
http://localhost:8086
http://localhost:8086/

Proxied connection (influx behind Nginx)
http://loocalhost:8080/influx-api/
@codecov-io
Copy link

codecov-io commented Dec 16, 2017

Codecov Report

Merging #400 into master will increase coverage by 0.07%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #400      +/-   ##
============================================
+ Coverage     86.55%   86.63%   +0.07%     
- Complexity      301      302       +1     
============================================
  Files            20       20              
  Lines          1294     1294              
  Branches        135      135              
============================================
+ Hits           1120     1121       +1     
+ Misses          114      113       -1     
  Partials         60       60
Impacted Files Coverage Δ Complexity Δ
src/main/java/org/influxdb/impl/InfluxDBImpl.java 87.68% <0%> (+0.3%) 68% <0%> (+1%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6049aff...1339166. Read the comment docs.

@fmachado
Copy link
Contributor

@vicctor would be great if you could provide a docker-compose.yml file containing both nginx properly configured and influxdb running so I could run the tests against it.

Artur Keska added 5 commits December 18, 2017 09:56
…ss different URL's for testing

(also remoted unused code with selection of API notAPI port)
Anyway, I believe that it's better to keep the URL in single URL property
- changed compile-and-test.sh scripts, so it starts both standard and "proxy"
- added simple nginx config for docker container
- tests related to UDP communication moved to separate class and skipped in case of http proxy testing
@majst01
Copy link
Collaborator

majst01 commented Dec 20, 2017

Hi @vicctor

Please do not format any of the files for a PR, try to reduce the changes needed, you have actually add more than 1000 lines and remove about 800, this makes it impossible to review this PR.

@vicctor
Copy link
Author

vicctor commented Dec 20, 2017

@majst01 Hi Steffan, thx for quick response. The truth is that I'm new in this project and I was in hurry to fix this issue, so all I can say sorry about that.
Indeed I found that I committed unnecessary white spaces in the pom file. I will reduce it and send yet another pull request later. Please, can you also give me some hints if I can reduce something more? It would be also great if you can provide me with coding-rules used in the project, so I can configure my IDE using it.

Also small explanation about what I did:
I added automatic tests with nginx proxy using the compile-and-test.sh (I found this approach is used at the moment on travis).
I can see however that this approach generates falsy codecov results. I'ts because tests are not started from surefire but from the .sh script. My first approach was to use the old good Parametriesed test and provide two different URI's to the InfluxDBTest class. But it turns out that with the JUnit5 I have to do that on every single method. Yesterday I did not found any more time to do that so perhaps it's good thing for next refac. Anyway, I'm also not sure if this is the best choice. Please let me know about your guess/plan.

@MaxYuen
Copy link

MaxYuen commented Dec 21, 2017

thanks for ur contributions

@majst01
Copy link
Collaborator

majst01 commented May 11, 2018

@vicctor if you still interested in this PR you need to rebase or resolve the conflicts.

@majst01
Copy link
Collaborator

majst01 commented May 13, 2018

This PR does basically the same as #416

pom.xml Outdated
@@ -89,6 +89,11 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
<configuration>
<excludes>
<exclude>${someModule.test.excludes}</exclude>
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is this meant for

import org.influxdb.dto.Pong;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.platform.runner.JUnitPlatform;
import org.junit.runner.RunWith;

import okhttp3.OkHttpClient;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why reformatting this import

root /usr/share/nginx/html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
Copy link
Collaborator

Choose a reason for hiding this comment

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

A lot of unrelated and commented code ?

Copy link
Contributor

Choose a reason for hiding this comment

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

@majst01, I am going to help Mr. @vicctor if he has no time for this PR, just trying to make this PR able to merge. I will address your comment soon

@lxhoan lxhoan force-pushed the master branch 3 times, most recently from 2c84650 to 511ab70 Compare June 5, 2018 07:34
@lxhoan
Copy link
Contributor

lxhoan commented Jun 5, 2018

@majst01, @fmachado . I improved the original works, please review this again, thank you

Copy link
Collaborator

@majst01 majst01 left a comment

Choose a reason for hiding this comment

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

almost there

@RunWith(JUnitPlatform.class)
public class InfluxDBProxyTest {
private InfluxDB influxDB;
private String db = "udp";
Copy link
Collaborator

Choose a reason for hiding this comment

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

The database should be named via-proxy or so, but not udp, this is misleading

Copy link
Contributor

Choose a reason for hiding this comment

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

change naming
BTW, name of the database for UDP is configured at server side

}

public static String getProxyApiUrl() {
return getEnv("PROXY_API_URL", "http://127.0.0.1:8086/");
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you please check formatting, here identation is broken

Copy link
Contributor

Choose a reason for hiding this comment

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

fixed it, we should have check style for test as well

   + code format
   + test db naming
@majst01 majst01 merged commit c1d60a6 into influxdata:master Jun 5, 2018
lxhoan added a commit that referenced this pull request Jun 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants