naver / ngrinder

enterprise level performance testing solution
naver.github.io/ngrinder
Apache License 2.0
2k stars 478 forks source link

Pass targetHosts property to agent #887

Closed outstanding1301 closed 1 year ago

outstanding1301 commented 2 years ago

There's no way to get perfTest.targetHosts in test script.

I found there's ngrinder.etc.hosts property but it indicates targetHosts only in specific condition

So I made a feature that pass targetHosts property to Agent following steps bellow

  1. Put ngrinder.target.hosts property to GrinderProperties in PerfTestService if perfTest has targetHosts.
  2. Add it to agent property as targetHosts in PropertyBuilder
donggyu04 commented 2 years ago

@outstanding1301

Why do you need targetHosts in your script?

junoyoon commented 2 years ago

By the way, this feature seems good.

@imbyungjun review and merge it.

imbyungjun commented 2 years ago

@outstanding1301

What's the difference between ngrinder.etc.hosts and targetHosts? I don't understand this property addition is necessary.

imbyungjun commented 2 years ago

These are the result what I printing ngrinder.etc.hosts and targetHosts.

Perftest Configuration image

Test Script

grinder.logger.info("{}", System.getProperty("ngrinder.etc.hosts"))
grinder.logger.info("{}", System.getProperty("targetHosts"))

Result Log

2022-09-28 14:56:35,859 INFO  mylaptop.local:127.0.0.1,localhost:127.0.0.1,www.naver.com:0.0.0.1,www.google.com:1.1.1.1
2022-09-28 14:56:35,859 INFO  www.naver.com:0.0.0.1,www.google.com:1.1.1.1
imbyungjun commented 1 year ago

Close this PR because there is no response for a long time. Please open it again if necessary.