diff --git a/projects/gloo/pkg/translator/performance_test.go b/projects/gloo/pkg/translator/performance_test.go index 91a67974943..7139c01bccc 100644 --- a/projects/gloo/pkg/translator/performance_test.go +++ b/projects/gloo/pkg/translator/performance_test.go @@ -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"), diff --git a/test/helpers/scaled_snapshots.go b/test/helpers/scaled_snapshots.go index d3952a810db..5eba9863956 100644 --- a/test/helpers/scaled_snapshots.go +++ b/test/helpers/scaled_snapshots.go @@ -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 { diff --git a/test/helpers/scaled_snapshots_test.go b/test/helpers/scaled_snapshots_test.go index 7e5b57668ec..5e5489dcb31 100644 --- a/test/helpers/scaled_snapshots_test.go +++ b/test/helpers/scaled_snapshots_test.go @@ -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)) }) })