Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Raising missing events #1741 #1750

Merged
merged 3 commits into from
Sep 10, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions execution/parallelGrpcExecution.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,16 @@ func (e *parallelExecution) notifyBeforeSuite() {
CurrentExecutionInfo: &gauge_messages.ExecutionInfo{},
Stream: 1},
}
res := e.runners[0].ExecuteAndGetStatus(m)
e.pluginHandler.NotifyPlugins(m)
res := e.runners[0].ExecuteAndGetStatus(m)
e.suiteResult.PreHookMessages = res.Message
e.suiteResult.PreHookScreenshotFiles = res.ScreenshotFiles
e.suiteResult.PreHookScreenshots = res.Screenshots
if res.GetFailed() {
result.AddPreHook(e.suiteResult, res)
}
m.ExecutionStartingRequest.SuiteResult = gauge.ConvertToProtoSuiteResult(e.suiteResult)
e.pluginHandler.NotifyPlugins(m)
}

func (e *parallelExecution) notifyAfterSuite() {
Expand All @@ -75,13 +76,14 @@ func (e *parallelExecution) notifyAfterSuite() {
Stream: 1,
},
}
res := e.runners[0].ExecuteAndGetStatus(m)
e.pluginHandler.NotifyPlugins(m)
res := e.runners[0].ExecuteAndGetStatus(m)
e.suiteResult.PostHookMessages = res.Message
e.suiteResult.PostHookScreenshotFiles = res.ScreenshotFiles
e.suiteResult.PostHookScreenshots = res.Screenshots
if res.GetFailed() {
result.AddPostHook(e.suiteResult, res)
}
m.ExecutionEndingRequest.SuiteResult = gauge.ConvertToProtoSuiteResult(e.suiteResult)
e.pluginHandler.NotifyPlugins(m)
}
13 changes: 12 additions & 1 deletion execution/parallelGrpcExecution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,20 @@ import (

func TestSuiteHooksAreExecutedOncePerRun(t *testing.T) {
specs := createSpecsList(6)
var recievedMesseges []*gauge_messages.Message
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo in variable name

runner1 := &fakeGrpcRunner{messageCount: make(map[gauge_messages.Message_MessageType]int)}
runner2 := &fakeGrpcRunner{messageCount: make(map[gauge_messages.Message_MessageType]int)}
e := parallelExecution{
numberOfExecutionStreams: 5,
specCollection: gauge.NewSpecCollection(specs, false),
runners: []runner.Runner{runner1, runner2},
pluginHandler: &mockPluginHandler{NotifyPluginsfunc: func(m *gauge_messages.Message) {}},
pluginHandler: &mockPluginHandler{NotifyPluginsfunc: func(m *gauge_messages.Message) {
recievedMesseges = append(recievedMesseges, m)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo in variable name

}},
}

t.Run("BeforeSuite", func(t *testing.T) {
recievedMesseges = []*gauge_messages.Message{}
e.suiteResult = result.NewSuiteResult("", time.Now())
runner1.mockResult = &gauge_messages.ProtoExecutionResult{}
e.notifyBeforeSuite()
Expand All @@ -40,9 +44,13 @@ func TestSuiteHooksAreExecutedOncePerRun(t *testing.T) {
if r2count != 0 {
t.Errorf("Expected runner2 to have received 0 ExecutionStarting request, got %d", r2count)
}
if len(recievedMesseges) != 2 {
t.Errorf("Expected plugins to have received 2 ExecutionStarting notifications, got %d", len(recievedMesseges))
}
})

t.Run("AfterSuite", func(t *testing.T) {
recievedMesseges = []*gauge_messages.Message{}
e.notifyAfterSuite()
e.suiteResult = result.NewSuiteResult("", time.Now())
runner1.mockResult = &gauge_messages.ProtoExecutionResult{}
Expand All @@ -54,6 +62,9 @@ func TestSuiteHooksAreExecutedOncePerRun(t *testing.T) {
if r2count != 0 {
t.Errorf("Expected runner2 to have received 0 ExecutionEnding request, got %d", r2count)
}
if len(recievedMesseges) != 2 {
t.Errorf("Expected plugins to have received 2 ExecutionStarting notifications, got %d", len(recievedMesseges))
}
})
}

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, 1, 3}
var CurrentGaugeVersion = &Version{1, 1, 4}

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