Fix benchmarks

This commit is contained in:
Andrea Fazzi 2020-01-31 12:49:33 +01:00
parent d60b55cc9d
commit ffa708e0e7
3 changed files with 15 additions and 4 deletions

View file

@ -63,10 +63,12 @@ func genPOSTResponseTargets(targetName string, conf *config) error {
}
targets := make([]*vegeta.Target, 0)
for _, participant := range participants {
// payload := "SingleResponses.0=32&SingleResponses.1=68&SingleResponses.2=34&SingleResponses.3=46&SingleResponses.4=25&SingleResponses.5=42&SingleResponses.6=7&SingleResponses.7=38&SingleResponses.8=13&SingleResponses.9=24&SingleResponses.10=73&SingleResponses.11=1&SingleResponses.12=19&SingleResponses.13=64&SingleResponses.14=80&SingleResponses.15=11&SingleResponses.16=70&SingleResponses.17=54&SingleResponses.18=50&SingleResponses.19=57"
for i, participant := range participants {
targets = append(targets, &vegeta.Target{
Method: "POST",
URL: fmt.Sprintf("%s/responses/%d/update", conf.Url, participant.ID),
URL: fmt.Sprintf("%s/responses/%d/update?format=html&tpl_content=responses_add_update&tpl_layout=base&update=true&login_session=%s", conf.Url, i+1, tokens[participant.FiscalCode]),
Body: []byte(base64.StdEncoding.EncodeToString([]byte("PUNCH!"))),
Header: http.Header{"Content-Type": []string{"application/x-www-form-urlencoded"}},
})
@ -87,7 +89,7 @@ func genPOSTResponseTargets(targetName string, conf *config) error {
if err != nil {
return err
}
_, err = output.WriteString(string(jsonData) + "\n")
_, err = output.WriteString(string(jsonData) + "\n\n")
if err != nil {
return err
}
@ -161,7 +163,7 @@ func init() {
}
func main() {
target := flag.String("target", "responses", "Generate targets for participants responses.")
target := flag.String("targets", "responses", "Generate targets for participants responses.")
url := flag.String("url", "http://localhost:3000", "The URL of the host.")
flag.Parse()

3
go.mod
View file

@ -6,8 +6,10 @@ require (
github.com/BurntSushi/toml v0.3.1
github.com/PuerkitoBio/goquery v1.5.0
github.com/auth0/go-jwt-middleware v0.0.0-20190805220309-36081240882b
github.com/bmizerany/perks v0.0.0-20141205001514-d9a9656a3a4b // indirect
github.com/c2h5oh/datasize v0.0.0-20200112174442-28bbd4740fee // indirect
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/dgryski/go-gk v0.0.0-20140819190930-201884a44051 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/elgs/gojq v0.0.0-20160421194050-81fa9a608a13 // indirect
github.com/elgs/gosplitargs v0.0.0-20161028071935-a491c5eeb3c8 // indirect
@ -30,6 +32,7 @@ require (
github.com/rs/jplot v0.0.0-20180624024257-9b69b4534805 // indirect
github.com/sethvargo/go-password v0.1.3
github.com/smartystreets/goconvey v1.6.4 // indirect
github.com/streadway/quantile v0.0.0-20150917103942-b0c588724d25 // indirect
github.com/tsenart/go-tsz v0.0.0-20180814235614-0bd30b3df1c3 // indirect
github.com/tsenart/vegeta v12.7.0+incompatible
github.com/urfave/negroni v1.0.0 // indirect

6
go.sum
View file

@ -16,6 +16,8 @@ github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb
github.com/auth0/go-jwt-middleware v0.0.0-20190805220309-36081240882b h1:CvoEHGmxWl5kONC5icxwqV899dkf4VjOScbxLpllEnw=
github.com/auth0/go-jwt-middleware v0.0.0-20190805220309-36081240882b/go.mod h1:LWMyo4iOLWXHGdBki7NIht1kHru/0wM179h+d3g8ATM=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/bmizerany/perks v0.0.0-20141205001514-d9a9656a3a4b h1:AP/Y7sqYicnjGDfD5VcY4CIfh1hRXBUavxrvELjTiOE=
github.com/bmizerany/perks v0.0.0-20141205001514-d9a9656a3a4b/go.mod h1:ac9efd0D1fsDb3EJvhqgXRbFx7bs2wqZ10HQPeU8U/Q=
github.com/c2h5oh/datasize v0.0.0-20200112174442-28bbd4740fee h1:BnPxIde0gjtTnc9Er7cxvBk8DHLWhEux0SxayC8dP6I=
github.com/c2h5oh/datasize v0.0.0-20200112174442-28bbd4740fee/go.mod h1:S/7n9copUssQ56c7aAgHqftWO4LTf4xY6CGWt8Bc+3M=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
@ -24,6 +26,8 @@ github.com/denisenkom/go-mssqldb v0.0.0-20190515213511-eb9f6a1743f3 h1:tkum0XDgf
github.com/denisenkom/go-mssqldb v0.0.0-20190515213511-eb9f6a1743f3/go.mod h1:zAg7JM8CkOJ43xKXIj7eRO9kmWm/TW578qo+oDO6tuM=
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgryski/go-gk v0.0.0-20140819190930-201884a44051 h1:ByJUvQYyTtNNCVfYNM48q6uYUT4fAlN0wNmd3th4BSo=
github.com/dgryski/go-gk v0.0.0-20140819190930-201884a44051/go.mod h1:qm+vckxRlDt0aOla0RYJJVeqHZlWfOm2UIxHaqPB46E=
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
@ -136,6 +140,8 @@ github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykE
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/streadway/quantile v0.0.0-20150917103942-b0c588724d25 h1:7z3LSn867ex6VSaahyKadf4WtSsJIgne6A1WLOAGM8A=
github.com/streadway/quantile v0.0.0-20150917103942-b0c588724d25/go.mod h1:lbP8tGiBjZ5YWIc2fzuRpTaz0b/53vT6PEs3QuAWzuU=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/tsenart/go-tsz v0.0.0-20180814235614-0bd30b3df1c3 h1:pcQGQzTwCg//7FgVywqge1sW9Yf8VMsMdG58MI5kd8s=