package kubeapi

import (
	"context"
	"testing"

	"github.com/stretchr/testify/require"
	corev1 "k8s.io/api/core/v1"
	"sigs.k8s.io/controller-runtime/pkg/client/fake"
)

func TestCreateIgnoreExists(t *testing.T) {
	client := fake.NewClientBuilder().Build()

	cm := new(corev1.ConfigMap)
	cm.Name = "name"
	err := CreateIgnoreExists(context.Background(), client, cm)
	require.Nil(t, err)
	// call again for testing no error if obj exists.
	cm = new(corev1.ConfigMap)
	cm.Name = "name"
	err = CreateIgnoreExists(context.Background(), client, cm)
	require.Nil(t, err)
}
