You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2020/04/13 15:20:47 UTC
[GitHub] [skywalking] mrproliu opened a new pull request #4646: Nginx
correlation e2e test
mrproliu opened a new pull request #4646: Nginx correlation e2e test
URL: https://github.com/apache/skywalking/pull/4646
### New feature or improvement
- After [Nginx correlation implement](https://github.com/apache/skywalking-nginx-lua/pull/35), this PR is adding the Nginx correlation e2e test.
- If we got an illegal correlation section, then we should abandon that.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [skywalking] wu-sheng commented on a change in pull request #4646:
Nginx correlation e2e test
Posted by GitBox <gi...@apache.org>.
wu-sheng commented on a change in pull request #4646: Nginx correlation e2e test
URL: https://github.com/apache/skywalking/pull/4646#discussion_r407554233
##########
File path: test/e2e/e2e-service-provider/pom.xml
##########
@@ -44,6 +44,11 @@
<artifactId>h2</artifactId>
<version>${h2.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.skywalking</groupId>
+ <artifactId>apm-toolkit-trace</artifactId>
+ <version>8.0.0-SNAPSHOT</version>
Review comment:
> This will be hard to maintain, though I didn't figure out a better way
You don't need this dependency, duplicate the annotation in the test codes, then it will be enhanced by the agent. We did this in the plugin test.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [skywalking] mrproliu commented on a change in pull request #4646:
Nginx correlation e2e test
Posted by GitBox <gi...@apache.org>.
mrproliu commented on a change in pull request #4646: Nginx correlation e2e test
URL: https://github.com/apache/skywalking/pull/4646#discussion_r407564366
##########
File path: test/e2e/e2e-service-provider/pom.xml
##########
@@ -44,6 +44,11 @@
<artifactId>h2</artifactId>
<version>${h2.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.skywalking</groupId>
+ <artifactId>apm-toolkit-trace</artifactId>
+ <version>8.0.0-SNAPSHOT</version>
Review comment:
Yes, I have tried on this. But When I copy on this, the IDE will give me an alert, because it also a source directory. Should I need to add the e2e project to a new IDE window?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [skywalking] wu-sheng commented on a change in pull request #4646:
Nginx correlation e2e test
Posted by GitBox <gi...@apache.org>.
wu-sheng commented on a change in pull request #4646: Nginx correlation e2e test
URL: https://github.com/apache/skywalking/pull/4646#discussion_r407557483
##########
File path: test/e2e/e2e-test/src/test/java/org/apache/skywalking/e2e/LuaE2E.java
##########
@@ -92,14 +95,21 @@
public void setUp() throws Exception {
queryClient(swWebappHostPort);
- trafficController(entryProvider, "/nginx/entry/info?backend=" + nginxHostPort.host() + ":" + nginxHostPort.port());
+ trafficController(entryProvider, "/nginx/entry/info");
}
@AfterAll
public void tearDown() {
trafficController.stop();
}
+ @RetryableTest
+ public void correlation() throws Exception {
+ final URL url = new URL("http", entryProvider.host(), entryProvider.port(), "/nginx/entry/info");
+ final ResponseEntity<String> response = restTemplate.postForEntity(url.toURI(), trafficData, String.class);
+ Assert.assertEquals(response.getBody(), "entry_value_nginx_value");
Review comment:
@mrproliu Do you mean this check?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [skywalking] kezhenxu94 commented on a change in pull request
#4646: Nginx correlation e2e test
Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on a change in pull request #4646: Nginx correlation e2e test
URL: https://github.com/apache/skywalking/pull/4646#discussion_r407546570
##########
File path: test/e2e/e2e-service-provider/pom.xml
##########
@@ -44,6 +44,11 @@
<artifactId>h2</artifactId>
<version>${h2.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.skywalking</groupId>
+ <artifactId>apm-toolkit-trace</artifactId>
+ <version>8.0.0-SNAPSHOT</version>
Review comment:
This will be hard to maintain, though I didn't figure out a better way
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [skywalking] kezhenxu94 commented on a change in pull request
#4646: Nginx correlation e2e test
Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on a change in pull request #4646: Nginx correlation e2e test
URL: https://github.com/apache/skywalking/pull/4646#discussion_r407541701
##########
File path: test/e2e/e2e-test/src/test/java/org/apache/skywalking/e2e/LuaE2E.java
##########
@@ -92,14 +95,21 @@
public void setUp() throws Exception {
queryClient(swWebappHostPort);
- trafficController(entryProvider, "/nginx/entry/info?backend=" + nginxHostPort.host() + ":" + nginxHostPort.port());
+ trafficController(entryProvider, "/nginx/entry/info");
}
@AfterAll
public void tearDown() {
trafficController.stop();
}
+ @RetryableTest
+ public void correlation() throws Exception {
Review comment:
Let's remove the `public` modifier, Junit 5 doesn't require this
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [skywalking] kezhenxu94 commented on a change in pull request
#4646: Nginx correlation e2e test
Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on a change in pull request #4646: Nginx correlation e2e test
URL: https://github.com/apache/skywalking/pull/4646#discussion_r407541435
##########
File path: test/e2e/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/lua/LuaController.java
##########
@@ -36,8 +37,15 @@
@PostMapping("/nginx/entry/info")
private String nginxEntry(String backend) throws MalformedURLException, URISyntaxException {
final URL url = new URL("http://nginx:8080/nginx/info");
+ TraceContext.putCorrelation("entry", "entry_value");
final ResponseEntity<String> response = restTemplate.postForEntity(url.toURI(), null, String.class);
return response.getBody();
}
+ @PostMapping("/nginx/end/info")
+ private String nginxEnd() throws MalformedURLException, URISyntaxException {
+ return TraceContext.getCorrelation("entry").orElse("")
+ + "_" + TraceContext.getCorrelation("nginx").orElse("");
+ }
Review comment:
> correlation can't be tested in the e2e from my perspective.
@wu-sheng maybe here is how @mrproliu he made it possible to test correlation in the E2E, get the correlation context in a service and expose them in an endpoint that can be verified in the test codes?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [skywalking] mrproliu commented on a change in pull request #4646:
Nginx correlation e2e test
Posted by GitBox <gi...@apache.org>.
mrproliu commented on a change in pull request #4646: Nginx correlation e2e test
URL: https://github.com/apache/skywalking/pull/4646#discussion_r407559058
##########
File path: test/e2e/e2e-test/src/test/java/org/apache/skywalking/e2e/LuaE2E.java
##########
@@ -92,14 +95,21 @@
public void setUp() throws Exception {
queryClient(swWebappHostPort);
- trafficController(entryProvider, "/nginx/entry/info?backend=" + nginxHostPort.host() + ":" + nginxHostPort.port());
+ trafficController(entryProvider, "/nginx/entry/info");
}
@AfterAll
public void tearDown() {
trafficController.stop();
}
+ @RetryableTest
+ public void correlation() throws Exception {
+ final URL url = new URL("http", entryProvider.host(), entryProvider.port(), "/nginx/entry/info");
+ final ResponseEntity<String> response = restTemplate.postForEntity(url.toURI(), trafficData, String.class);
+ Assert.assertEquals(response.getBody(), "entry_value_nginx_value");
Review comment:
Yes, there will check all the correlation data from `java2` response.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [skywalking] wu-sheng commented on a change in pull request #4646:
Nginx correlation e2e test
Posted by GitBox <gi...@apache.org>.
wu-sheng commented on a change in pull request #4646: Nginx correlation e2e test
URL: https://github.com/apache/skywalking/pull/4646#discussion_r407799204
##########
File path: test/e2e/e2e-test/src/test/java/org/apache/skywalking/e2e/LuaE2E.java
##########
@@ -92,14 +95,21 @@
public void setUp() throws Exception {
queryClient(swWebappHostPort);
- trafficController(entryProvider, "/nginx/entry/info?backend=" + nginxHostPort.host() + ":" + nginxHostPort.port());
+ trafficController(entryProvider, "/nginx/entry/info");
}
@AfterAll
public void tearDown() {
trafficController.stop();
}
+ @RetryableTest
+ public void correlation() throws Exception {
+ final URL url = new URL("http", entryProvider.host(), entryProvider.port(), "/nginx/entry/info");
+ final ResponseEntity<String> response = restTemplate.postForEntity(url.toURI(), trafficData, String.class);
+ Assert.assertEquals(response.getBody(), "entry_value_nginx_value");
Review comment:
So, once the propagation fails, this e2e will fail directly. Got it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [skywalking] wu-sheng commented on a change in pull request #4646:
Nginx correlation e2e test
Posted by GitBox <gi...@apache.org>.
wu-sheng commented on a change in pull request #4646: Nginx correlation e2e test
URL: https://github.com/apache/skywalking/pull/4646#discussion_r407556454
##########
File path: test/e2e/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/lua/LuaController.java
##########
@@ -36,8 +37,15 @@
@PostMapping("/nginx/entry/info")
private String nginxEntry(String backend) throws MalformedURLException, URISyntaxException {
final URL url = new URL("http://nginx:8080/nginx/info");
+ TraceContext.putCorrelation("entry", "entry_value");
final ResponseEntity<String> response = restTemplate.postForEntity(url.toURI(), null, String.class);
return response.getBody();
}
+ @PostMapping("/nginx/end/info")
+ private String nginxEnd() throws MalformedURLException, URISyntaxException {
+ return TraceContext.getCorrelation("entry").orElse("")
+ + "_" + TraceContext.getCorrelation("nginx").orElse("");
+ }
Review comment:
`/nginx/end/info` is the validated endpoint name, but the response entity wouldn't be tests. Please correct me if I am wrong.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [skywalking] wu-sheng commented on issue #4646: Nginx correlation
e2e test
Posted by GitBox <gi...@apache.org>.
wu-sheng commented on issue #4646: Nginx correlation e2e test
URL: https://github.com/apache/skywalking/pull/4646#issuecomment-612947897
Could you explain a little about this PR? `correlation` can't be tested in the e2e from my perspective. I noticed you added the correlation header in the nginx, which should/could be read in the java. But there is no way to test this in e2e.
I think this header should only be tests as a part of plugin test. What do you think?
FYI @kezhenxu94 , WDYT?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [skywalking] kezhenxu94 commented on a change in pull request
#4646: Nginx correlation e2e test
Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on a change in pull request #4646: Nginx correlation e2e test
URL: https://github.com/apache/skywalking/pull/4646#discussion_r407562023
##########
File path: test/e2e/e2e-service-provider/pom.xml
##########
@@ -44,6 +44,11 @@
<artifactId>h2</artifactId>
<version>${h2.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.skywalking</groupId>
+ <artifactId>apm-toolkit-trace</artifactId>
+ <version>8.0.0-SNAPSHOT</version>
Review comment:
So @mrproliu you have to copy class `org.apache.skywalking.apm.toolkit.trace.TraceContext` into e2e folder, and remove this dependency,
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [skywalking] mrproliu commented on a change in pull request #4646:
Nginx correlation e2e test
Posted by GitBox <gi...@apache.org>.
mrproliu commented on a change in pull request #4646: Nginx correlation e2e test
URL: https://github.com/apache/skywalking/pull/4646#discussion_r407554434
##########
File path: test/e2e/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/lua/LuaController.java
##########
@@ -36,8 +37,15 @@
@PostMapping("/nginx/entry/info")
private String nginxEntry(String backend) throws MalformedURLException, URISyntaxException {
final URL url = new URL("http://nginx:8080/nginx/info");
+ TraceContext.putCorrelation("entry", "entry_value");
final ResponseEntity<String> response = restTemplate.postForEntity(url.toURI(), null, String.class);
return response.getBody();
}
+ @PostMapping("/nginx/end/info")
+ private String nginxEnd() throws MalformedURLException, URISyntaxException {
+ return TraceContext.getCorrelation("entry").orElse("")
+ + "_" + TraceContext.getCorrelation("nginx").orElse("");
+ }
Review comment:
Here my changed, `java1` -> `Nginx` -> `java2`, `java1` and `Nginx` to put the correlation data, then I get the all correlation data in `java2` and return it. So, I make a JUnit to verify the `java2` result.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [skywalking] kezhenxu94 merged pull request #4646: Nginx
correlation e2e test
Posted by GitBox <gi...@apache.org>.
kezhenxu94 merged pull request #4646: Nginx correlation e2e test
URL: https://github.com/apache/skywalking/pull/4646
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [skywalking] kezhenxu94 commented on a change in pull request
#4646: Nginx correlation e2e test
Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on a change in pull request #4646: Nginx correlation e2e test
URL: https://github.com/apache/skywalking/pull/4646#discussion_r407552308
##########
File path: test/e2e/e2e-service-provider/pom.xml
##########
@@ -44,6 +44,11 @@
<artifactId>h2</artifactId>
<version>${h2.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.skywalking</groupId>
+ <artifactId>apm-toolkit-trace</artifactId>
+ <version>8.0.0-SNAPSHOT</version>
Review comment:
Well, it also breaks the CI because we don't have this version when building this service
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [skywalking] kezhenxu94 commented on a change in pull request
#4646: Nginx correlation e2e test
Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on a change in pull request #4646: Nginx correlation e2e test
URL: https://github.com/apache/skywalking/pull/4646#discussion_r407565920
##########
File path: test/e2e/e2e-service-provider/pom.xml
##########
@@ -44,6 +44,11 @@
<artifactId>h2</artifactId>
<version>${h2.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.skywalking</groupId>
+ <artifactId>apm-toolkit-trace</artifactId>
+ <version>8.0.0-SNAPSHOT</version>
Review comment:
> Yes, I have tried on this. But When I copy on this, the IDE will give me an alert, because it also a source directory. Should I need to add the e2e project to a new IDE window?
> 
Copy the file out of the IDEA, i.e. in the `Finder` or `Terminal`, or open the `e2e` in a separate IDEA window and copy between the two windows (`apm` and `e2e`)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [skywalking] mrproliu commented on issue #4646: Nginx correlation
e2e test
Posted by GitBox <gi...@apache.org>.
mrproliu commented on issue #4646: Nginx correlation e2e test
URL: https://github.com/apache/skywalking/pull/4646#issuecomment-612951702
> Could you explain a little about this PR? `correlation` can't be tested in the e2e from my perspective. I noticed you added the correlation header in the nginx, which should/could be read in the java. But there is no way to test this in e2e.
>
> I think this header should only be tests as a part of plugin test. What do you think?
> FYI @kezhenxu94 , WDYT?
I think the plugin test only tests with the java plugins, I think it cannot cross-language agent test? Do I miss something?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [skywalking] kezhenxu94 commented on a change in pull request
#4646: Nginx correlation e2e test
Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on a change in pull request #4646: Nginx correlation e2e test
URL: https://github.com/apache/skywalking/pull/4646#discussion_r407549634
##########
File path: test/e2e/e2e-test/src/test/java/org/apache/skywalking/e2e/LuaE2E.java
##########
@@ -92,14 +95,21 @@
public void setUp() throws Exception {
queryClient(swWebappHostPort);
- trafficController(entryProvider, "/nginx/entry/info?backend=" + nginxHostPort.host() + ":" + nginxHostPort.port());
Review comment:
Remove the declaration of `nginxHostPort` (line#89) if you don't need it anymore
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [skywalking] wu-sheng commented on issue #4646: Nginx correlation
e2e test
Posted by GitBox <gi...@apache.org>.
wu-sheng commented on issue #4646: Nginx correlation e2e test
URL: https://github.com/apache/skywalking/pull/4646#issuecomment-612953101
> I think the plugin test only tests with the java plugins, I think it cannot cross-language agent test? Do I miss something?
Currently, yes. But my point is only, this can't be tested in the e2e too, right?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services