【发布时间】:2015-04-16 13:46:07
【问题描述】:
我下载了 gatling 作为 maven 依赖项,现在我正在寻找如何覆盖 gatling.conf 文件来配置 gatling 和石墨之间的连接。
所以我创建了一个像这样的 gatling.conf 文件:
data {
writers = [console, file, graphite] # The list of DataWriters to which Gatling write simulation data (currently supported : console, file, graphite, jdbc)
reader = file # The DataReader used by the charting engine for reading simulation results
console {
light = false # When set to true, displays a light version without detailed request stats
}
file {
bufferSize = 8192 # FileDataWriter's internal data buffer size, in bytes
}
leak {
noActivityTimeout = 30 # Period, in seconds, for which Gatling may have no activity before considering a leak may be happening
}
graphite {
light = false # only send the all* stats
host = "mygraphite.host.com" # The host where the Carbon server is located
port = 1010 # The port to which the Carbon server listens to (2003 is default for plaintext, 2004 is default for pickle)
protocol = "tcp" # The protocol used to send data to Carbon (currently supported : "tcp", "udp")
rootPathPrefix = "gatling" # The common prefix of all metrics sent to Graphite
bufferSize = 8192 # GraphiteDataWriter's internal data buffer size, in bytes
writeInterval = 1 # GraphiteDataWriter's write interval, in seconds
}
}
在我的 src/main/resources/conf/gatling.conf 中
这是我的 pom.xml :
<build>
<plugins>
<plugin>
<groupId>io.gatling</groupId>
<artifactId>gatling-maven-plugin</artifactId>
<version>${gatling-plugin.version}</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<configFolder>src/main/resources/conf/</configFolder>
<!-- Default values -->
<!--<configFolder>src/test/resources</configFolder-->
<dataFolder>src/main/resources/data</dataFolder>
<resultsFolder>target/gatling/results</resultsFolder>
<!--<!–<requestBodiesFolder>src/test/resources/request-bodies</requestBodiesFolder>-->
<simulationsFolder>src/main/scala</simulationsFolder>
<simulationClass>my.awesomeCompany.scenarios.Scenarios</simulationClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
我做错了什么,还有另一种方法可以使用配置文件吗?或者我必须用 jvm args 覆盖所有选项?
干杯。
【问题讨论】:
-
当心:不覆盖所有指向
src/main/resources的路径,您正在混合主要资源和测试资源...您是否尝试过使用默认路径? -
刚刚试了,没啥变化。我正在开发一个完整的 gatling/scala 项目,该项目需要自己的测试(对于一个测试项目,发现 inception),所以这就是为什么所有东西都在主文件夹中。
-
gatling.conf 是您发布的整个文件吗?
-
是的,它应该包含所有作为默认配置文件吗?
-
不一定,但您缺少配置根目录,gatling。因此,您的值不会覆盖任何内容。将您的
data { … }块包装在gatling { … }块中,它会起作用。