diff --git a/pkg/smokescreen/smokescreen_test.go b/pkg/smokescreen/smokescreen_test.go index 67ccd43f..0207dddc 100644 --- a/pkg/smokescreen/smokescreen_test.go +++ b/pkg/smokescreen/smokescreen_test.go @@ -559,8 +559,22 @@ func TestProxyProtocols(t *testing.T) { client.Do(req) clientCh <- true }() - <-clientCh + + // Metrics should show one successful connection and a corresponding successful + // DNS request along with its timing metric. + tmc, ok := cfg.MetricsClient.(*metrics.MockMetricsClient) + r.True(ok) + i, err := tmc.GetCount("cn.atpt.total", "success:true") + r.NoError(err) + r.Equal(i, uint64(1)) + lookups, err := tmc.GetCount("resolver.attempts_total") + r.NoError(err) + r.Equal(lookups, uint64(1)) + ltime, err := tmc.GetCount("resolver.lookup_time") + r.NoError(err) + r.Equal(ltime, uint64(1)) + entry := findCanonicalProxyDecision(logHook.AllEntries()) r.NotNil(entry) @@ -611,6 +625,20 @@ func TestProxyProtocols(t *testing.T) { serverCh <- true <-clientCh + // Metrics should show one successful connection and a corresponding successful + // DNS request along with its timing metric. + tmc, ok := cfg.MetricsClient.(*metrics.MockMetricsClient) + r.True(ok) + i, err := tmc.GetCount("cn.atpt.total", "success:true") + r.NoError(err) + r.Equal(i, uint64(1)) + lookups, err := tmc.GetCount("resolver.attempts_total") + r.NoError(err) + r.Equal(lookups, uint64(1)) + ltime, err := tmc.GetCount("resolver.lookup_time") + r.NoError(err) + r.Equal(ltime, uint64(1)) + entry := findCanonicalProxyDecision(logHook.AllEntries()) r.NotNil(entry) r.Contains(entry.Data, "proxy_type")