-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: odubajDT <[email protected]>
- Loading branch information
Showing
80 changed files
with
1,443 additions
and
5,550 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,5 @@ testbin/* | |
*.swo | ||
*~ | ||
|
||
go.work | ||
go.work.sum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package v1beta1 | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/open-feature/open-feature-operator/apis/core/v1beta1/common" | ||
"github.com/stretchr/testify/require" | ||
corev1 "k8s.io/api/core/v1" | ||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/types" | ||
) | ||
|
||
func Test_FeatureFlag(t *testing.T) { | ||
ff := FeatureFlag{ | ||
ObjectMeta: v1.ObjectMeta{ | ||
Name: "ffconf1", | ||
Namespace: "test", | ||
OwnerReferences: []v1.OwnerReference{ | ||
{ | ||
APIVersion: "ver", | ||
Kind: "kind", | ||
Name: "ffconf1", | ||
UID: types.UID("5"), | ||
Controller: common.TrueVal(), | ||
}, | ||
}, | ||
}, | ||
Spec: FeatureFlagSpec{ | ||
FlagSpec: FlagSpec{ | ||
Flags: map[string]Flag{}, | ||
}, | ||
}, | ||
} | ||
|
||
require.Equal(t, v1.OwnerReference{ | ||
APIVersion: ff.APIVersion, | ||
Kind: ff.Kind, | ||
Name: ff.Name, | ||
UID: ff.UID, | ||
Controller: common.TrueVal(), | ||
}, ff.GetReference()) | ||
|
||
name := "cmname" | ||
namespace := "cmnamespace" | ||
references := []v1.OwnerReference{ | ||
{ | ||
APIVersion: "ver", | ||
Kind: "kind", | ||
Name: "ffconf1", | ||
UID: types.UID("5"), | ||
Controller: common.TrueVal(), | ||
}, | ||
} | ||
|
||
cm, _ := ff.GenerateConfigMap(name, namespace, references) | ||
|
||
require.Equal(t, corev1.ConfigMap{ | ||
ObjectMeta: v1.ObjectMeta{ | ||
Name: name, | ||
Namespace: namespace, | ||
Annotations: map[string]string{ | ||
"openfeature.dev/featureflag": name, | ||
}, | ||
OwnerReferences: references, | ||
}, | ||
Data: map[string]string{ | ||
"cmnamespace_cmname.flagd.json": "{\"flags\":{}}", | ||
}, | ||
}, *cm) | ||
} |
Oops, something went wrong.