Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions internal/controller/httpproxy_metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -483,11 +483,15 @@ func TestHTTPProxyReconcileInternalErrorGetsStableFixedMessage(t *testing.T) {
},
}

// The programming tracker is the process's own, and other tests program
// this proxy on test-cluster. Whether their entry is still there depends
// on the order the tests run in, so this test reads a key of its own.
const cluster = "internal-error-cluster"
before := testutil.ToFloat64(httpProxyReconcileErrorsTotal.WithLabelValues("httproute", "forbidden"))

_, err := reconciler.Reconcile(context.Background(), mcreconcile.Request{
Request: reconcile.Request{NamespacedName: client.ObjectKeyFromObject(httpProxy)},
ClusterName: "test-cluster",
ClusterName: cluster,
})
require.Error(t, err)

Expand All @@ -506,15 +510,15 @@ func TestHTTPProxyReconcileInternalErrorGetsStableFixedMessage(t *testing.T) {

_, err = reconciler.Reconcile(context.Background(), mcreconcile.Request{
Request: reconcile.Request{NamespacedName: client.ObjectKeyFromObject(httpProxy)},
ClusterName: "test-cluster",
ClusterName: cluster,
})
require.Error(t, err)
var retried networkingv1alpha.HTTPProxy
require.NoError(t, fakeClient.Get(context.Background(), client.ObjectKeyFromObject(httpProxy), &retried))
assert.Equal(t, updated.ResourceVersion, retried.ResourceVersion, "a retry with the same failure must not rewrite status")

httpProxyProgramming.mu.Lock()
_, pending := httpProxyProgramming.pending[httpProxyKey{cluster: "test-cluster", NamespacedName: client.ObjectKeyFromObject(httpProxy)}]
_, pending := httpProxyProgramming.pending[httpProxyKey{cluster: cluster, NamespacedName: client.ObjectKeyFromObject(httpProxy)}]
httpProxyProgramming.mu.Unlock()
assert.True(t, pending, "an unprogrammed generation is tracked for latency")
}
Expand Down
Loading