Skip to content

Commit

Permalink
Revert "Added summary generated event (#3682)"
Browse files Browse the repository at this point in the history
This reverts commit eec9105.
  • Loading branch information
olegbespalov committed May 13, 2024
1 parent 633d338 commit 2631f35
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 22 deletions.
5 changes: 0 additions & 5 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,6 @@ func (c *cmdRun) run(cmd *cobra.Command, args []string) (err error) {
})
if hsErr == nil {
hsErr = handleSummaryResult(c.gs.FS, c.gs.Stdout, c.gs.Stderr, summaryResult)
waitForSummaryGeneratedEvent := emitEvent(&event.Event{
Type: event.TestSummaryGenerated,
Data: &event.SummaryData{Summary: summaryResult},
})
waitForSummaryGeneratedEvent()
}
if hsErr != nil {
logger.WithError(hsErr).Error("failed to handle the end-of-test summary")
Expand Down
3 changes: 0 additions & 3 deletions cmd/tests/cmd_run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2073,7 +2073,6 @@ func TestEventSystemOK(t *testing.T) {
`got event IterStart with data '{Iteration:4 VUID:1 ScenarioName:default Error:<nil>}'`,
`got event IterEnd with data '{Iteration:4 VUID:1 ScenarioName:default Error:<nil>}'`,
`got event TestEnd with data '<nil>'`,
`got event TestSummaryGenerated with data '&{Summary:map[stdout:]}'`,
`got event Exit with data '&{Error:<nil>}'`,
}
log := ts.LoggerHook.Lines()
Expand Down Expand Up @@ -2108,7 +2107,6 @@ func TestEventSystemError(t *testing.T) {
"got event IterStart with data '{Iteration:0 VUID:1 ScenarioName:default Error:<nil>}'",
"got event IterEnd with data '{Iteration:0 VUID:1 ScenarioName:default Error:test aborted: oops! at file:///-:11:16(6)}'",
"got event TestEnd with data '<nil>'",
"got event TestSummaryGenerated with data '&{Summary:map[stdout:]}'",
"got event Exit with data '&{Error:test aborted: oops! at file:///-:11:16(6)}'",
"test aborted: oops! at file:///-:11:16(6)",
},
Expand Down Expand Up @@ -2145,7 +2143,6 @@ func TestEventSystemError(t *testing.T) {
"got event IterEnd with data '{Iteration:1 VUID:1 ScenarioName:default Error:Error: oops!\n\tat file:///-:9:11(3)\n}'",
"Error: oops!\n\tat file:///-:9:11(3)\n",
"got event TestEnd with data '<nil>'",
"got event TestSummaryGenerated with data '&{Summary:map[stdout:]}'",
"got event Exit with data '&{Error:<nil>}'",
},
expExitCode: 0,
Expand Down
11 changes: 1 addition & 10 deletions event/type.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package event

import "io"

// Type represents the different event types emitted by k6.
//
//go:generate enumer -type=Type -trimprefix Type -output type_gen.go
Expand All @@ -20,14 +18,12 @@ const (
IterEnd
// Exit is emitted when the k6 process is about to exit.
Exit
// TestSummaryGenerated is emitted when the test result summary is generated.
TestSummaryGenerated
)

//nolint:gochecknoglobals
var (
// GlobalEvents are emitted once per test run.
GlobalEvents = []Type{Init, TestStart, TestEnd, TestSummaryGenerated, Exit}
GlobalEvents = []Type{Init, TestStart, TestEnd, Exit}
// VUEvents are emitted multiple times per each VU.
VUEvents = []Type{IterStart, IterEnd}
)
Expand All @@ -45,8 +41,3 @@ type IterData struct {
ScenarioName string
Error error
}

// SummaryData is the data sent in the TestSummaryGenerated event.
type SummaryData struct {
Summary map[string]io.Reader
}
7 changes: 3 additions & 4 deletions event/type_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2631f35

Please sign in to comment.