mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 11:29:48 +08:00
change: upgrade funplugin to v0.3.0
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
funcPlugin "github.com/httprunner/func-plugin"
|
||||
"github.com/httprunner/funplugin"
|
||||
"github.com/httprunner/hrp/internal/boomer"
|
||||
"github.com/httprunner/hrp/internal/ga"
|
||||
)
|
||||
@@ -22,8 +22,8 @@ func NewBoomer(spawnCount int, spawnRate float64) *HRPBoomer {
|
||||
|
||||
type HRPBoomer struct {
|
||||
*boomer.Boomer
|
||||
plugins []funcPlugin.IPlugin // each task has its own plugin process
|
||||
pluginsMutex *sync.RWMutex // avoid data race
|
||||
plugins []funplugin.IPlugin // each task has its own plugin process
|
||||
pluginsMutex *sync.RWMutex // avoid data race
|
||||
}
|
||||
|
||||
// Run starts to run load test for one or multiple testcases.
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
## v0.6.4 (2022-03-10)
|
||||
|
||||
- feat: both support gPRC(default) and net/rpc mode in hashicorp plugin, switch with environment `HRP_PLUGIN_TYPE`
|
||||
- refactor: move submodule `plugin` to separate repo `github.com/httprunner/func-plugin`
|
||||
- refactor: move submodule `plugin` to separate repo `github.com/httprunner/funplugin`
|
||||
- refactor: replace builtin json library with `json-iterator/go` to improve performance
|
||||
|
||||
## v0.6.3 (2022-03-04)
|
||||
|
||||
1
examples/__init__.py
Normal file
1
examples/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
# NOTICE: Generated By HttpRunner. DO NOT EDIT!
|
||||
5
examples/debugtalk.py
Normal file
5
examples/debugtalk.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from plugin.python.plugin import serve
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
serve()
|
||||
128
examples/har/demo.json
Normal file
128
examples/har/demo.json
Normal file
@@ -0,0 +1,128 @@
|
||||
{
|
||||
"config": {
|
||||
"name": "testcase description"
|
||||
},
|
||||
"teststeps": [
|
||||
{
|
||||
"name": "",
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"url": "https://postman-echo.com/get",
|
||||
"params": {
|
||||
"foo1": "HDnY8",
|
||||
"foo2": "34.5"
|
||||
},
|
||||
"headers": {
|
||||
"Accept-Encoding": "gzip",
|
||||
"Host": "postman-echo.com",
|
||||
"User-Agent": "HttpRunnerPlus"
|
||||
}
|
||||
},
|
||||
"validate": [
|
||||
{
|
||||
"check": "status_code",
|
||||
"assert": "equals",
|
||||
"expect": 200,
|
||||
"msg": "assert response status code"
|
||||
},
|
||||
{
|
||||
"check": "headers.\"Content-Type\"",
|
||||
"assert": "equals",
|
||||
"expect": "application/json; charset=utf-8",
|
||||
"msg": "assert response header Content-Type"
|
||||
},
|
||||
{
|
||||
"check": "body.url",
|
||||
"assert": "equals",
|
||||
"expect": "https://postman-echo.com/get?foo1=HDnY8\u0026foo2=34.5",
|
||||
"msg": "assert response body url"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"url": "https://postman-echo.com/post",
|
||||
"headers": {
|
||||
"Accept-Encoding": "gzip",
|
||||
"Content-Length": "28",
|
||||
"Content-Type": "application/json; charset=UTF-8",
|
||||
"Host": "postman-echo.com",
|
||||
"User-Agent": "Go-http-client/1.1"
|
||||
},
|
||||
"cookies": {
|
||||
"sails.sid": "s%3Az_LpglkKxTvJ_eHVUH6V67drKp0AGWW-.PidabaXOnatLRP47hVyqqepl6BdrpEQzRlJQXtbIiwk"
|
||||
},
|
||||
"body": {
|
||||
"foo1": "HDnY8",
|
||||
"foo2": 12.3
|
||||
}
|
||||
},
|
||||
"validate": [
|
||||
{
|
||||
"check": "status_code",
|
||||
"assert": "equals",
|
||||
"expect": 200,
|
||||
"msg": "assert response status code"
|
||||
},
|
||||
{
|
||||
"check": "headers.\"Content-Type\"",
|
||||
"assert": "equals",
|
||||
"expect": "application/json; charset=utf-8",
|
||||
"msg": "assert response header Content-Type"
|
||||
},
|
||||
{
|
||||
"check": "body.url",
|
||||
"assert": "equals",
|
||||
"expect": "https://postman-echo.com/post",
|
||||
"msg": "assert response body url"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"url": "https://postman-echo.com/post",
|
||||
"headers": {
|
||||
"Accept-Encoding": "gzip",
|
||||
"Content-Length": "20",
|
||||
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
|
||||
"Host": "postman-echo.com",
|
||||
"User-Agent": "Go-http-client/1.1"
|
||||
},
|
||||
"cookies": {
|
||||
"sails.sid": "s%3AS5e7w0zQ0xAsCwh9L8T6R7QLYCO7_gtD.r8%2B2w9IWqEIfuVkrZjnxzm2xADIk34zKAWXRPapr%2FAw"
|
||||
},
|
||||
"body": "foo1=HDnY8\u0026foo2=12.3"
|
||||
},
|
||||
"validate": [
|
||||
{
|
||||
"check": "status_code",
|
||||
"assert": "equals",
|
||||
"expect": 200,
|
||||
"msg": "assert response status code"
|
||||
},
|
||||
{
|
||||
"check": "headers.\"Content-Type\"",
|
||||
"assert": "equals",
|
||||
"expect": "application/json; charset=utf-8",
|
||||
"msg": "assert response header Content-Type"
|
||||
},
|
||||
{
|
||||
"check": "body.data",
|
||||
"assert": "equals",
|
||||
"expect": "",
|
||||
"msg": "assert response body data"
|
||||
},
|
||||
{
|
||||
"check": "body.url",
|
||||
"assert": "equals",
|
||||
"expect": "https://postman-echo.com/post",
|
||||
"msg": "assert response body url"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
1
examples/har/hire-referral.har
Normal file
1
examples/har/hire-referral.har
Normal file
File diff suppressed because one or more lines are too long
3000
examples/har/hire-referral.json
Normal file
3000
examples/har/hire-referral.json
Normal file
File diff suppressed because it is too large
Load Diff
2346
examples/har/hire-referral.yaml
Normal file
2346
examples/har/hire-referral.yaml
Normal file
File diff suppressed because it is too large
Load Diff
1101
examples/har/postman-echo.yaml
Normal file
1101
examples/har/postman-echo.yaml
Normal file
File diff suppressed because it is too large
Load Diff
1
examples/har/referral.har
Normal file
1
examples/har/referral.har
Normal file
File diff suppressed because one or more lines are too long
51
examples/httpbin.json
Normal file
51
examples/httpbin.json
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"config": {
|
||||
"name": "testcase description",
|
||||
"variables": {},
|
||||
"verify": false
|
||||
},
|
||||
"teststeps": [
|
||||
{
|
||||
"name": "/get",
|
||||
"request": {
|
||||
"url": "http://httpbin.org/get",
|
||||
"method": "GET",
|
||||
"headers": {
|
||||
"Host": "httpbin.org",
|
||||
"Connection": "keep-alive",
|
||||
"accept": "application/json",
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.80 Safari/537.36 Edg/98.0.1108.50",
|
||||
"Referer": "http://httpbin.org/",
|
||||
"Accept-Encoding": "gzip, deflate",
|
||||
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"
|
||||
}
|
||||
},
|
||||
"validate": [
|
||||
{
|
||||
"check": "status_code",
|
||||
"assert": "equals",
|
||||
"expect": 200,
|
||||
"msg": "assert response status code"
|
||||
},
|
||||
{
|
||||
"check": "headers.\"Content-Type\"",
|
||||
"assert": "equals",
|
||||
"expect": "application/json",
|
||||
"msg": "assert response header Content-Type"
|
||||
},
|
||||
{
|
||||
"check": "body.origin",
|
||||
"assert": "equals",
|
||||
"expect": "117.176.133.109",
|
||||
"msg": "assert response body origin"
|
||||
},
|
||||
{
|
||||
"check": "body.url",
|
||||
"assert": "equals",
|
||||
"expect": "http://httpbin.org/get",
|
||||
"msg": "assert response body url"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,18 +1,18 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
plugin "github.com/httprunner/func-plugin/go"
|
||||
"github.com/httprunner/funplugin/fungo"
|
||||
)
|
||||
|
||||
// register functions and build to plugin binary
|
||||
func main() {
|
||||
plugin.Register("sum_ints", SumInts)
|
||||
plugin.Register("sum_two_int", SumTwoInt)
|
||||
plugin.Register("sum", Sum)
|
||||
plugin.Register("sum_two_string", SumTwoString)
|
||||
plugin.Register("sum_strings", SumStrings)
|
||||
plugin.Register("concatenate", Concatenate)
|
||||
plugin.Register("setup_hook_example", SetupHookExample)
|
||||
plugin.Register("teardown_hook_example", TeardownHookExample)
|
||||
plugin.Serve()
|
||||
fungo.Register("sum_ints", SumInts)
|
||||
fungo.Register("sum_two_int", SumTwoInt)
|
||||
fungo.Register("sum", Sum)
|
||||
fungo.Register("sum_two_string", SumTwoString)
|
||||
fungo.Register("sum_strings", SumStrings)
|
||||
fungo.Register("concatenate", Concatenate)
|
||||
fungo.Register("setup_hook_example", SetupHookExample)
|
||||
fungo.Register("teardown_hook_example", TeardownHookExample)
|
||||
fungo.Serve()
|
||||
}
|
||||
|
||||
4
go.mod
4
go.mod
@@ -6,7 +6,7 @@ require (
|
||||
github.com/andybalholm/brotli v1.0.4
|
||||
github.com/denisbrodbeck/machineid v1.0.1
|
||||
github.com/google/uuid v1.3.0
|
||||
github.com/httprunner/func-plugin v0.2.0
|
||||
github.com/httprunner/funplugin v0.3.0
|
||||
github.com/jinzhu/copier v0.3.2
|
||||
github.com/jmespath/go-jmespath v0.4.0
|
||||
github.com/json-iterator/go v1.1.12
|
||||
@@ -21,4 +21,4 @@ require (
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
|
||||
)
|
||||
|
||||
// replace github.com/httprunner/func-plugin => ../func-plugin
|
||||
// replace github.com/httprunner/funplugin => ../funplugin
|
||||
|
||||
4
go.sum
4
go.sum
@@ -198,8 +198,8 @@ github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2p
|
||||
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
|
||||
github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb h1:b5rjCoWHc7eqmAS4/qyk21ZsHyb6Mxv/jykxvNTkU4M=
|
||||
github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
|
||||
github.com/httprunner/func-plugin v0.2.0 h1:ffeZFCc5NVnZlJlpHOHnEEDeu8KzucGHrVs3co+zq+o=
|
||||
github.com/httprunner/func-plugin v0.2.0/go.mod h1:qqplUZFs7gM7AdY74DLisxlmpIrOUZbk12UIexL3FfY=
|
||||
github.com/httprunner/funplugin v0.3.0 h1:qCf8uwO6BGctq1e95KH4gXSJkUkq+q1oRnBJnQy9Fr4=
|
||||
github.com/httprunner/funplugin v0.3.0/go.mod h1:vPyeJIfbpGe0epZZtAV0wCn16gLY9+imSw/zfxq0Lcc=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
|
||||
|
||||
@@ -72,7 +72,7 @@ var demoPlugin = `package main
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
plugin "github.com/httprunner/func-plugin/go"
|
||||
"github.com/httprunner/funplugin/fungo"
|
||||
)
|
||||
|
||||
func SumTwoInt(a, b int) int {
|
||||
@@ -111,12 +111,12 @@ func TeardownHookExample(args string) string {
|
||||
}
|
||||
|
||||
func main() {
|
||||
plugin.Register("sum_ints", SumInts)
|
||||
plugin.Register("sum_two_int", SumTwoInt)
|
||||
plugin.Register("sum", Sum)
|
||||
plugin.Register("setup_hook_example", SetupHookExample)
|
||||
plugin.Register("teardown_hook_example", TeardownHookExample)
|
||||
plugin.Serve()
|
||||
fungo.Register("sum_ints", SumInts)
|
||||
fungo.Register("sum_two_int", SumTwoInt)
|
||||
fungo.Register("sum", Sum)
|
||||
fungo.Register("setup_hook_example", SetupHookExample)
|
||||
fungo.Register("teardown_hook_example", TeardownHookExample)
|
||||
fungo.Serve()
|
||||
}
|
||||
`
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ func CreateScaffold(projectName string) error {
|
||||
}
|
||||
|
||||
// download plugin dependency
|
||||
if err := builtin.ExecCommand(exec.Command("go", "get", "github.com/httprunner/func-plugin"), pluginDir); err != nil {
|
||||
if err := builtin.ExecCommand(exec.Command("go", "get", "github.com/httprunner/funplugin"), pluginDir); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
funcPlugin "github.com/httprunner/func-plugin"
|
||||
"github.com/httprunner/func-plugin/shared"
|
||||
"github.com/httprunner/funplugin"
|
||||
"github.com/httprunner/funplugin/shared"
|
||||
"github.com/httprunner/hrp/internal/builtin"
|
||||
)
|
||||
|
||||
@@ -22,7 +22,7 @@ func newParser() *parser {
|
||||
}
|
||||
|
||||
type parser struct {
|
||||
plugin funcPlugin.IPlugin // plugin is used to call functions
|
||||
plugin funplugin.IPlugin // plugin is used to call functions
|
||||
}
|
||||
|
||||
func buildURL(baseURL, stepURL string) string {
|
||||
|
||||
@@ -30,7 +30,7 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
funcPlugin "github.com/httprunner/func-plugin"
|
||||
"github.com/httprunner/funplugin"
|
||||
"github.com/httprunner/hrp/internal/builtin"
|
||||
"github.com/httprunner/hrp/internal/ga"
|
||||
"github.com/httprunner/hrp/internal/json"
|
||||
@@ -297,8 +297,8 @@ func (r *caseRunner) run() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func initPlugin(path string, logOn bool) (plugin funcPlugin.IPlugin, err error) {
|
||||
plugin, err = funcPlugin.Init(path, logOn)
|
||||
func initPlugin(path string, logOn bool) (plugin funplugin.IPlugin, err error) {
|
||||
plugin, err = funplugin.Init(path, logOn)
|
||||
if plugin == nil {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user