Skip to content

Commit 7f48c09

Browse files
committed
Linting
1 parent a05b1a7 commit 7f48c09

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

e2e/lease_count_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ func renderLeaseCountDeployments(serverReplicas, agentReplicas int) (serverDeplo
4444
{Flag: "authentication-audience", Value: "system:konnectivity-server"},
4545
{Flag: "enable-lease-controller"},
4646
{Flag: "admin-bind-address", EmptyValue: true},
47+
{Flag: "mode", Value: *connectionMode},
4748
},
4849
}
4950
serverDeployment, _, err = renderTemplate("server/deployment.yaml", serverDeploymentConfig)

e2e/static_count_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ func renderStaticCountDeployments(serverReplicas, agentReplicas int) (serverDepl
4545
{Flag: "authentication-audience", Value: "system:konnectivity-server"},
4646
{Flag: "admin-bind-address", EmptyValue: true},
4747
{Flag: "server-count", Value: strconv.Itoa(serverReplicas)},
48+
{Flag: "mode", Value: *connectionMode},
4849
},
4950
}
5051
serverDeployment, _, err = renderTemplate("server/deployment.yaml", serverDeploymentConfig)

pkg/agent/lease_counter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func NewServerLeaseCounter(pc clock.PassiveClock, leaseLister coordinationv1list
6262
// In the event that no valid leases are found or lease listing fails, the
6363
// fallback count is returned. This fallback count is updated upon successful
6464
// discovery of valid leases.
65-
func (lc *ServerLeaseCounter) Count(ctx context.Context) int {
65+
func (lc *ServerLeaseCounter) Count() int {
6666
// Since the number of proxy servers is generally small (1-10), we opted against
6767
// using a LIST and WATCH pattern and instead list all leases on each call.
6868
// TODO: Switch to an informer-based system and use events rather than a polling loop.

pkg/agent/lease_counter_test.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func TestServerLeaseCounter(t *testing.T) {
126126

127127
counter := NewServerLeaseCounter(pc, leaseLister, selector, "")
128128

129-
got := counter.Count(context.Background())
129+
got := counter.Count()
130130
if tc.want != got {
131131
t.Errorf("incorrect server count (got: %v, want: %v)", got, tc.want)
132132
}
@@ -152,7 +152,7 @@ func (lister fakeLeaseLister) List(selector labels.Selector) (ret []*coordinatio
152152
return ret, nil
153153
}
154154

155-
func (lister fakeLeaseLister) Leases(namespace string) coordinationv1lister.LeaseNamespaceLister {
155+
func (lister fakeLeaseLister) Leases(_ string) coordinationv1lister.LeaseNamespaceLister {
156156
panic("should not be used")
157157
}
158158

@@ -175,8 +175,7 @@ func TestServerLeaseCounter_FallbackCount(t *testing.T) {
175175

176176
counter := NewServerLeaseCounter(pc, leaseLister, selector, "")
177177

178-
ctx := context.Background()
179-
got := counter.Count(ctx)
178+
got := counter.Count()
180179
leaseLister.Err = fmt.Errorf("fake lease listing error")
181180
if got != 1 {
182181
t.Errorf("lease counter did not return fallback count on leaseLister error (got: %v, want: 1)", got)
@@ -185,14 +184,14 @@ func TestServerLeaseCounter_FallbackCount(t *testing.T) {
185184
// Second call should return the actual count (3) upon leaseClient success.
186185
leaseLister.Err = nil
187186
actualCount := 3
188-
got = counter.Count(ctx)
187+
got = counter.Count()
189188
if got != actualCount {
190189
t.Errorf("lease counter did not return actual count on leaseClient success (got: %v, want: %v)", got, actualCount)
191190
}
192191

193192
// Third call should return updated fallback count (3) upon leaseClient failure.
194193
leaseLister.Err = fmt.Errorf("fake lease listing error")
195-
got = counter.Count(ctx)
194+
got = counter.Count()
196195
if got != actualCount {
197196
t.Errorf("lease counter did not update fallback count after leaseClient success, returned incorrect count on subsequent leaseClient error (got: %v, want: %v)", got, actualCount)
198197
}

0 commit comments

Comments
 (0)