|
|
|
@ -23,7 +23,9 @@ import (
|
|
|
|
|
prom_testutil "github.com/prometheus/client_golang/prometheus/testutil" |
|
|
|
|
"github.com/prometheus/common/promslog" |
|
|
|
|
"github.com/stretchr/testify/require" |
|
|
|
|
apiv1 "k8s.io/api/core/v1" |
|
|
|
|
apierrors "k8s.io/apimachinery/pkg/api/errors" |
|
|
|
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
|
|
|
|
"k8s.io/apimachinery/pkg/runtime" |
|
|
|
|
"k8s.io/apimachinery/pkg/version" |
|
|
|
|
"k8s.io/apimachinery/pkg/watch" |
|
|
|
@ -320,3 +322,18 @@ func TestFailuresCountMetric(t *testing.T) {
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func TestNodeName(t *testing.T) { |
|
|
|
|
node := &apiv1.Node{ |
|
|
|
|
ObjectMeta: metav1.ObjectMeta{ |
|
|
|
|
Name: "foo", |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
name, err := nodeName(node) |
|
|
|
|
require.NoError(t, err) |
|
|
|
|
require.Equal(t, "foo", name) |
|
|
|
|
|
|
|
|
|
name, err = nodeName(cache.DeletedFinalStateUnknown{Key: "bar"}) |
|
|
|
|
require.NoError(t, err) |
|
|
|
|
require.Equal(t, "bar", name) |
|
|
|
|
} |
|
|
|
|