Skip to content

Commit 0dd7dde

Browse files
Per Goncalves da Silvaperdasilva
Per Goncalves da Silva
authored andcommitted
Refactor synthetic auth exported functions
Signed-off-by: Per Goncalves da Silva <[email protected]>
1 parent 3f8c450 commit 0dd7dde

File tree

2 files changed

+4
-21
lines changed

2 files changed

+4
-21
lines changed

Diff for: internal/operator-controller/authentication/synthetic.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ import (
88
ocv1 "github.com/operator-framework/operator-controller/api/v1"
99
)
1010

11-
func SyntheticUserName(ext ocv1.ClusterExtension) string {
11+
func syntheticUserName(ext ocv1.ClusterExtension) string {
1212
return fmt.Sprintf("olm:clusterextensions:%s", ext.Name)
1313
}
1414

15-
func SyntheticGroups(_ ocv1.ClusterExtension) []string {
15+
func syntheticGroups(_ ocv1.ClusterExtension) []string {
1616
return []string{
1717
"olm:clusterextensions",
1818
"system:authenticated",
@@ -21,7 +21,7 @@ func SyntheticGroups(_ ocv1.ClusterExtension) []string {
2121

2222
func SyntheticImpersonationConfig(ext ocv1.ClusterExtension) transport.ImpersonationConfig {
2323
return transport.ImpersonationConfig{
24-
UserName: SyntheticUserName(ext),
25-
Groups: SyntheticGroups(ext),
24+
UserName: syntheticUserName(ext),
25+
Groups: syntheticGroups(ext),
2626
}
2727
}

Diff for: internal/operator-controller/authentication/synthetic_test.go

-17
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,6 @@ import (
1010
"github.com/operator-framework/operator-controller/internal/operator-controller/authentication"
1111
)
1212

13-
func TestSyntheticUserName(t *testing.T) {
14-
syntheticUserName := authentication.SyntheticUserName(ocv1.ClusterExtension{
15-
ObjectMeta: metav1.ObjectMeta{
16-
Name: "my-ext",
17-
},
18-
})
19-
require.Equal(t, "olm:clusterextensions:my-ext", syntheticUserName)
20-
}
21-
22-
func TestSyntheticGroups(t *testing.T) {
23-
syntheticGroups := authentication.SyntheticGroups(ocv1.ClusterExtension{})
24-
require.Equal(t, []string{
25-
"olm:clusterextensions",
26-
"system:authenticated",
27-
}, syntheticGroups)
28-
}
29-
3013
func TestSyntheticImpersonationConfig(t *testing.T) {
3114
config := authentication.SyntheticImpersonationConfig(ocv1.ClusterExtension{
3215
ObjectMeta: metav1.ObjectMeta{

0 commit comments

Comments
 (0)