Skip to content

Commit

Permalink
review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
bewebi committed Jun 26, 2023
1 parent 445b381 commit 8e5bc08
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion projects/gloo/pkg/translator/performance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ var _ = Describe("Translation - Benchmarking Tests", Serial, Label(labels.Perfor
Expect(durations).Should(And(config.benchmarkMatchers...))
},
generateDesc, // generate descriptions for table entries with nil descriptions
Entry("basic", gloohelpers.NewScaledSnapshotBuilder().WithInjectedSnapshot(basicSnap), basicConfig),
Entry("basic", gloohelpers.NewInjectedSnapshotBuilder(basicSnap), basicConfig),
Entry(nil, gloohelpers.NewScaledSnapshotBuilder().WithUpstreamCount(10).WithEndpointCount(1), basicConfig, "upstream scale"),
Entry(nil, gloohelpers.NewScaledSnapshotBuilder().WithUpstreamCount(1000).WithEndpointCount(1), oneKUpstreamsConfig, "upstream scale"),
Entry(nil, gloohelpers.NewScaledSnapshotBuilder().WithUpstreamCount(1).WithEndpointCount(10), basicConfig, "endpoint scale"),
Expand Down
10 changes: 5 additions & 5 deletions test/helpers/scaled_snapshots.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ func NewScaledSnapshotBuilder() *ScaledSnapshotBuilder {
}
}

// WithInjectedSnapshot takes a snapshot object to be returned directly by Build()
// NewInjectedSnapshotBuilder takes a snapshot object to be returned directly by Build()
// All other settings on a builder with an InjectedSnapshot will be ignored
func (b *ScaledSnapshotBuilder) WithInjectedSnapshot(snap *gloosnapshot.ApiSnapshot) *ScaledSnapshotBuilder {
b.injectedSnap = snap

return b
func NewInjectedSnapshotBuilder(snap *gloosnapshot.ApiSnapshot) *ScaledSnapshotBuilder {
return &ScaledSnapshotBuilder{
injectedSnap: snap,
}
}

func (b *ScaledSnapshotBuilder) WithUpstreamCount(n int) *ScaledSnapshotBuilder {
Expand Down
26 changes: 13 additions & 13 deletions test/helpers/scaled_snapshots_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,21 @@ var _ = Describe("ScaledSnapshotBuilder", func() {
})
})
})
})

When("with injected snapshot", func() {
It("returns the injected snapshot regardless of other settings", func() {
inSnap := &gloosnapshot.ApiSnapshot{
Upstreams: []*v1.Upstream{
{
Metadata: &core.Metadata{
Name: "injected-name",
Namespace: "injected-namespace",
},
var _ = Describe("InjectedSnapshotBuilder", func() {
It("returns the injected snapshot regardless of other settings", func() {
inSnap := &gloosnapshot.ApiSnapshot{
Upstreams: []*v1.Upstream{
{
Metadata: &core.Metadata{
Name: "injected-name",
Namespace: "injected-namespace",
},
},
}
outSnap := helpers.NewScaledSnapshotBuilder().WithInjectedSnapshot(inSnap).WithUpstreamCount(10).Build()
Expect(outSnap).To(Equal(inSnap))
})
},
}
outSnap := helpers.NewInjectedSnapshotBuilder(inSnap).WithUpstreamCount(10).Build()
Expect(outSnap).To(Equal(inSnap))
})
})

0 comments on commit 8e5bc08

Please sign in to comment.