Commit b4ffa3cc authored by Alessio Caiazza's avatar Alessio Caiazza

Rename `BuildSection.RunAndCollectMetrics` to `Execute`

parent 714a8cbb
...@@ -175,7 +175,7 @@ func (b *Build) executeStage(ctx context.Context, buildStage BuildStage, executo ...@@ -175,7 +175,7 @@ func (b *Build) executeStage(ctx context.Context, buildStage BuildStage, executo
SkipMetrics: !b.JobResponse.Features.TraceSections, SkipMetrics: !b.JobResponse.Features.TraceSections,
Run: func() error { return executor.Run(cmd) }, Run: func() error { return executor.Run(cmd) },
} }
return section.RunAndCollectMetrics(&b.logger) return section.Execute(&b.logger)
} }
func (b *Build) executeUploadArtifacts(ctx context.Context, state error, executor Executor) (err error) { func (b *Build) executeUploadArtifacts(ctx context.Context, state error, executor Executor) (err error) {
......
...@@ -41,7 +41,7 @@ func (s *BuildSection) end(logger RawLogger) { ...@@ -41,7 +41,7 @@ func (s *BuildSection) end(logger RawLogger) {
s.timestamp(traceSectionEnd, logger) s.timestamp(traceSectionEnd, logger)
} }
func (s *BuildSection) RunAndCollectMetrics(logger RawLogger) error { func (s *BuildSection) Execute(logger RawLogger) error {
s.start(logger) s.start(logger)
defer s.end(logger) defer s.end(logger)
......
...@@ -91,7 +91,7 @@ func TestBuildSection(t *testing.T) { ...@@ -91,7 +91,7 @@ func TestBuildSection(t *testing.T) {
parser := newSectionParser() parser := newSectionParser()
section := BuildSection{Name: tc.name, Run: func() error { time.Sleep(tc.delay); return tc.error }} section := BuildSection{Name: tc.name, Run: func() error { time.Sleep(tc.delay); return tc.error }}
section.RunAndCollectMetrics(parser) section.Execute(parser)
assert.Nil(t, parser.Error, "case %d: Error: %s", num, parser.Error) assert.Nil(t, parser.Error, "case %d: Error: %s", num, parser.Error)
assert.Equal(t, 1, len(parser.Sections), "case %d: wrong number of sections detected", num) assert.Equal(t, 1, len(parser.Sections), "case %d: wrong number of sections detected", num)
...@@ -105,7 +105,7 @@ func TestBuildSectionSkipMetrics(t *testing.T) { ...@@ -105,7 +105,7 @@ func TestBuildSectionSkipMetrics(t *testing.T) {
parser := newSectionParser() parser := newSectionParser()
section := BuildSection{Name: "SkipMetrics", SkipMetrics: true, Run: func() error { return nil }} section := BuildSection{Name: "SkipMetrics", SkipMetrics: true, Run: func() error { return nil }}
section.RunAndCollectMetrics(parser) section.Execute(parser)
assert.Nil(t, parser.Error) assert.Nil(t, parser.Error)
assert.Equal(t, 0, len(parser.Sections)) assert.Equal(t, 0, len(parser.Sections))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment