Revision 9b72a5cf9c68e7b99230a45843583901812d2a08 authored by Daniel Borkmann on 03 May 2024, 13:39:42 UTC, committed by Daniel Borkmann on 03 May 2024, 13:56:45 UTC
Turn it off until we have a new v1.15 stable release with #32337 included.
Without the PR the IPSec downgrade test on v1.15 reported small blips of
connectivity interruption.

We can revert this commit once v1.15.5 is out.

Reported-by: Julian Wiedmann <jwi@isovalent.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
1 parent 8552def
Raw File
metrics_test.go
// SPDX-License-Identifier: Apache-2.0
// Copyright Authors of Cilium

package metrics

import (
	"testing"

	"github.com/stretchr/testify/require"

	"github.com/cilium/cilium/pkg/option"
)

func TestGaugeWithThreshold(t *testing.T) {
	threshold := 1.0
	underThreshold := threshold - 0.5
	overThreshold := threshold + 0.5
	gauge := NewGaugeWithThreshold(
		"test_metric",
		"test_subsystem",
		"test_metric",
		map[string]string{
			"test_label": "test_value",
		},
		threshold,
	)

	reg := NewRegistry(RegistryParams{
		DaemonConfig: &option.DaemonConfig{},
	})

	metrics, err := reg.inner.Gather()
	require.Nil(t, err)
	initMetricLen := len(metrics)

	gauge.Set(underThreshold)
	metrics, err = reg.inner.Gather()
	require.Nil(t, err)
	require.Len(t, metrics, initMetricLen)
	require.Equal(t, underThreshold, GetGaugeValue(gauge.gauge))

	gauge.Set(overThreshold)
	metrics, err = reg.inner.Gather()
	require.Nil(t, err)
	require.Len(t, metrics, initMetricLen+1)
	require.Equal(t, overThreshold, GetGaugeValue(gauge.gauge))

	gauge.Set(threshold)
	metrics, err = reg.inner.Gather()
	require.Nil(t, err)
	require.Len(t, metrics, initMetricLen)
	require.Equal(t, threshold, GetGaugeValue(gauge.gauge))

	gauge.Set(overThreshold)
	metrics, err = reg.inner.Gather()
	require.Nil(t, err)
	require.Len(t, metrics, initMetricLen+1)
	require.Equal(t, overThreshold, GetGaugeValue(gauge.gauge))

	gauge.Set(underThreshold)
	metrics, err = reg.inner.Gather()
	require.Nil(t, err)
	require.Len(t, metrics, initMetricLen)
	require.Equal(t, underThreshold, GetGaugeValue(gauge.gauge))
}
back to top