mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-07 08:02:42 +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
|
||||
|
||||
import (
|
||||
|
||||
@@ -1089,7 +1089,7 @@ func (r *masterRunner) reportStats() {
|
||||
currentTime := time.Now()
|
||||
println()
|
||||
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()))
|
||||
table := tablewriter.NewWriter(os.Stdout)
|
||||
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 {
|
||||
file, err := os.Create(filename)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
file, err := os.OpenFile(filename, os.O_WRONLY|os.O_TRUNC|os.O_CREATE, 0755)
|
||||
defer file.Close()
|
||||
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("failed to generate file")
|
||||
}
|
||||
count, err := file.Write(data)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -281,14 +281,17 @@ func (r *HRPRunner) newCaseRunner(testcase *TestCase) (*testCaseRunner, error) {
|
||||
timeout := time.Duration(runner.testCase.Config.Timeout*1000) * time.Millisecond
|
||||
runner.hrpRunner.SetTimeout(timeout)
|
||||
}
|
||||
|
||||
// load plugin info to testcase config
|
||||
if plugin != nil {
|
||||
pluginContent, err := builtin.ReadFile(plugin.Path())
|
||||
pluginPath, _ := locatePlugin(testcase.Config.Path)
|
||||
pluginContent, err := builtin.ReadFile(pluginPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
tp := strings.Split(plugin.Path(), ".")
|
||||
runner.parsedConfig.PluginSetting = &PluginConfig{
|
||||
Path: plugin.Path(),
|
||||
Path: pluginPath,
|
||||
Content: pluginContent,
|
||||
Type: tp[len(tp)-1],
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user