Skip to content

Commit

Permalink
Fix expected metric in 'batch update random metrics' (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
gonozov0 authored Oct 17, 2023
1 parent 13256b9 commit 02de85f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions cmd/metricstest/iteration12_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,20 +140,19 @@ func (suite *Iteration12Suite) serverShutdown() {
}

func (suite *Iteration12Suite) TestBatchAPI() {
httpc := resty.New().SetHostURL(suite.serverAddress)
httpc := resty.New().SetHostURL(suite.serverAddress).
SetHeader("Accept-Encoding", "gzip").
SetHeader("Content-Type", "application/json")

idCounter := "CounterBatchZip" + strconv.Itoa(suite.rnd.Intn(256))
idGauge := "GaugeBatchZip" + strconv.Itoa(suite.rnd.Intn(256))
valueCounter1, valueCounter2 := int64(suite.rnd.Int31()), int64(suite.rnd.Int31())
var valueCounter0 int64
valueGauge1, valueGauge2 := suite.rnd.Float64()*1e6, suite.rnd.Float64()*1e6

req := httpc.R().
SetHeader("Accept-Encoding", "gzip").
SetHeader("Content-Type", "application/json")

suite.Run("get random counter", func() {
var result Metrics
req := httpc.R()
resp, err := req.
SetBody(&Metrics{
ID: idCounter,
Expand Down Expand Up @@ -211,6 +210,7 @@ func (suite *Iteration12Suite) TestBatchAPI() {
},
}

req := httpc.R()
resp, err := req.SetBody(metrics).
Post("updates/")

Expand All @@ -229,6 +229,7 @@ func (suite *Iteration12Suite) TestBatchAPI() {

suite.Run("check counter value", func() {
var result Metrics
req := httpc.R()
resp, err := req.
SetBody(&Metrics{
ID: idCounter,
Expand Down Expand Up @@ -260,6 +261,7 @@ func (suite *Iteration12Suite) TestBatchAPI() {

suite.Run("check gauge value", func() {
var result Metrics
req := httpc.R()
resp, err := req.
SetBody(&Metrics{
ID: idGauge,
Expand Down

0 comments on commit 02de85f

Please sign in to comment.