Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃尡 Add UID to fake Operator objects in tests #523

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/operator-framework/operator-controller/internal/resolution/variablesources"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/uuid"
"k8s.io/utils/pointer"

"github.com/operator-framework/deppy/pkg/deppy"
Expand All @@ -26,6 +27,10 @@ func fakeOperator(name, packageName string, upgradeConstraintPolicy operatorsv1a
return operatorsv1alpha1.Operator{
ObjectMeta: metav1.ObjectMeta{
Name: name,
// We manually set a fake UID here because the code we test
// uses UID to determine Operator CR which
// owns `BundleDeployment`
UID: uuid.NewUUID(),
},
Spec: operatorsv1alpha1.OperatorSpec{
PackageName: packageName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/uuid"
featuregatetesting "k8s.io/component-base/featuregate/testing"
"k8s.io/utils/pointer"

Expand Down Expand Up @@ -207,6 +208,10 @@ func TestMakeInstalledPackageVariables(t *testing.T) {
return operatorsv1alpha1.Operator{
ObjectMeta: metav1.ObjectMeta{
Name: name,
// We manually set a fake UID here because the code we test
// uses UID to determine Operator CR which
// owns `BundleDeployment`
UID: uuid.NewUUID(),
},
Spec: operatorsv1alpha1.OperatorSpec{
PackageName: packageName,
Expand Down