Skip to content

Commit

Permalink
Added scenario retries info params (#2496)
Browse files Browse the repository at this point in the history
* Added scenario retries info params

Signed-off-by: Piotr Nestorow <piotr.nestorow@systemverification.com>

* Go.mod update

Signed-off-by: Piotr Nestorow <piotr.nestorow@systemverification.com>

* Added ScenarioRetriesInfo unit test

Signed-off-by: Piotr Nestorow <piotr.nestorow@systemverification.com>

* Added ScenarioRetriesInfo unit test

Signed-off-by: Piotr Nestorow <piotr.nestorow@systemverification.com>

---------

Signed-off-by: Piotr Nestorow <piotr.nestorow@systemverification.com>
  • Loading branch information
PiotrNestor authored Mar 11, 2024
1 parent 8236a48 commit a550d71
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 7 deletions.
4 changes: 4 additions & 0 deletions execution/specExecutor.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,10 @@ func (e *specExecutor) executeScenario(scenario *gauge.Scenario) (*result.Scenar
Name: scenario.Heading.Value,
Tags: getTagValue(scenario.Tags),
IsFailed: false,
Retries: &gauge_messages.ScenarioRetriesInfo{
MaxRetries: int32(MaxRetriesCount)-1,
CurrentRetry: int32(retriesCount),
},
}

scenarioResult = &result.ScenarioResult{
Expand Down
23 changes: 23 additions & 0 deletions execution/specExecutor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -722,3 +722,26 @@ func TestExecuteShouldMarkSpecAsSkippedWhenAllScenariosSkipped(t *testing.T) {
t.Error("Expect SpecResult.Skipped = true, got false")
}
}

func TestExecuteScenarioShoulHaveRetriesInfo(t *testing.T) {
MaxRetriesCount = 3
RetryOnlyTags = "tagSce"

se := newSpecExecutorForTestsWithRetry()
sceResult, _ := se.executeScenario(exampleSpecWithTags.Scenarios[0])

if sceResult.GetFailed() {
t.Errorf("Expect sceResult.GetFailed() = false, got true")
}
if se.currentExecutionInfo.CurrentScenario.Retries.MaxRetries != int32(MaxRetriesCount - 1) {
t.Errorf("Expected MaxRetries %d, got %d",
int32(MaxRetriesCount - 1),
se.currentExecutionInfo.CurrentScenario.Retries.MaxRetries)
}
if se.currentExecutionInfo.CurrentScenario.Retries.CurrentRetry != int32(MaxRetriesCount - 1) {
t.Errorf("Expected CurrentRetry %d, got %d",
int32(MaxRetriesCount - 1),
se.currentExecutionInfo.CurrentScenario.Retries.CurrentRetry)
}
}

4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/daviddengcn/go-colortext v1.0.0
github.com/fsnotify/fsnotify v1.7.0
github.com/getgauge/common v0.0.0-20231211152919-94c93e29f0b9
github.com/getgauge/gauge-proto/go/gauge_messages v0.0.0-20240224015747-16d1a26a9fea
github.com/getgauge/gauge-proto/go/gauge_messages v0.0.0-20240305092417-e4088981ee73
github.com/golang/protobuf v1.5.3
github.com/magiconair/properties v1.8.7
github.com/natefinch/lumberjack v2.0.0+incompatible
Expand All @@ -18,7 +18,7 @@ require (
github.com/sourcegraph/jsonrpc2 v0.2.0
github.com/spf13/cobra v1.8.0
github.com/spf13/pflag v1.0.5
google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c
google.golang.org/genproto/googleapis/rpc v0.0.0-20240304212257-790db918fca8
google.golang.org/grpc v1.62.0
google.golang.org/protobuf v1.32.0
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nos
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
github.com/getgauge/common v0.0.0-20231211152919-94c93e29f0b9 h1:OwggKdL8AeteB2y0xJzloieq9CMhYG7YmKKMh6D8FLs=
github.com/getgauge/common v0.0.0-20231211152919-94c93e29f0b9/go.mod h1:p/Q0+qO2bLq08PuxaHrxIgkvKlGGYHyXad33+zKIiXU=
github.com/getgauge/gauge-proto/go/gauge_messages v0.0.0-20240224015747-16d1a26a9fea h1:l2xnnhqp0wlvCwOQn+TGk3yBfqOdUw2hYRf5UwAl1C4=
github.com/getgauge/gauge-proto/go/gauge_messages v0.0.0-20240224015747-16d1a26a9fea/go.mod h1:qf8Dv2iFBwlgpBZBOKjW9JDaYi5lHqXNYXEHTXd62Uw=
github.com/getgauge/gauge-proto/go/gauge_messages v0.0.0-20240305092417-e4088981ee73 h1:WkPxV7TpYcqzSWHMSEnDAKJFLWugp/rWtvHVJz+0h0E=
github.com/getgauge/gauge-proto/go/gauge_messages v0.0.0-20240305092417-e4088981ee73/go.mod h1:TXmEkop8jQOf4Q84sCcbJE1kVvb3rcZLkMHL6WbCbcQ=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
Expand Down Expand Up @@ -69,8 +69,8 @@ golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c h1:NUsgEN92SQQqzfA+YtqYNqYmB3DMMYLlIwUZAQFVFbo=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240304212257-790db918fca8 h1:IR+hp6ypxjH24bkMfEJ0yHR21+gwPWdV+/IBrPQyn3k=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240304212257-790db918fca8/go.mod h1:UCOku4NytXMJuLQE5VuqA5lX3PcHCBo8pxNyvkf4xBs=
google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk=
google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
Expand Down
2 changes: 1 addition & 1 deletion version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

// CurrentGaugeVersion represents the current version of Gauge
var CurrentGaugeVersion = &Version{1, 6, 3}
var CurrentGaugeVersion = &Version{1, 6, 4}

// BuildMetadata represents build information of current release (e.g, nightly build information)
var BuildMetadata = ""
Expand Down

0 comments on commit a550d71

Please sign in to comment.