mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-12 16:01:27 +08:00
fix: plugin file distribution
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
// NOTE: Generated By hrp v4.1.4, DO NOT EDIT!
|
// NOTE: Generated By hrp v4.1.5, DO NOT EDIT!
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|||||||
@@ -1089,7 +1089,7 @@ func (r *masterRunner) reportStats() {
|
|||||||
currentTime := time.Now()
|
currentTime := time.Now()
|
||||||
println()
|
println()
|
||||||
println("===================== HttpRunner Master for Distributed Load Testing ===================== ")
|
println("===================== HttpRunner Master for Distributed Load Testing ===================== ")
|
||||||
println(fmt.Sprintf("Current time: %s, State: %v, Current Valid Workers: %v, Target Users: %v",
|
println(fmt.Sprintf("Current time: %s, State: %v, Current Available Workers: %v, Target Users: %v",
|
||||||
currentTime.Format("2006/01/02 15:04:05"), getStateName(r.getState()), r.server.getClientsLength(), r.getSpawnCount()))
|
currentTime.Format("2006/01/02 15:04:05"), getStateName(r.getState()), r.server.getClientsLength(), r.getSpawnCount()))
|
||||||
table := tablewriter.NewWriter(os.Stdout)
|
table := tablewriter.NewWriter(os.Stdout)
|
||||||
table.SetHeader([]string{"Worker ID", "State", "Current Users", "CPU Usage", "CPU Warning Emitted", "Memory Usage", "Heartbeat"})
|
table.SetHeader([]string{"Worker ID", "State", "Current Users", "CPU Usage", "CPU Warning Emitted", "Memory Usage", "Heartbeat"})
|
||||||
|
|||||||
@@ -492,12 +492,11 @@ func GetFileNameWithoutExtension(path string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Bytes2File(data []byte, filename string) error {
|
func Bytes2File(data []byte, filename string) error {
|
||||||
file, err := os.Create(filename)
|
file, err := os.OpenFile(filename, os.O_WRONLY|os.O_TRUNC|os.O_CREATE, 0755)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("failed to generate file")
|
||||||
|
}
|
||||||
count, err := file.Write(data)
|
count, err := file.Write(data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -281,14 +281,17 @@ func (r *HRPRunner) newCaseRunner(testcase *TestCase) (*testCaseRunner, error) {
|
|||||||
timeout := time.Duration(runner.testCase.Config.Timeout*1000) * time.Millisecond
|
timeout := time.Duration(runner.testCase.Config.Timeout*1000) * time.Millisecond
|
||||||
runner.hrpRunner.SetTimeout(timeout)
|
runner.hrpRunner.SetTimeout(timeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// load plugin info to testcase config
|
||||||
if plugin != nil {
|
if plugin != nil {
|
||||||
pluginContent, err := builtin.ReadFile(plugin.Path())
|
pluginPath, _ := locatePlugin(testcase.Config.Path)
|
||||||
|
pluginContent, err := builtin.ReadFile(pluginPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
tp := strings.Split(plugin.Path(), ".")
|
tp := strings.Split(plugin.Path(), ".")
|
||||||
runner.parsedConfig.PluginSetting = &PluginConfig{
|
runner.parsedConfig.PluginSetting = &PluginConfig{
|
||||||
Path: plugin.Path(),
|
Path: pluginPath,
|
||||||
Content: pluginContent,
|
Content: pluginContent,
|
||||||
Type: tp[len(tp)-1],
|
Type: tp[len(tp)-1],
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user