Skip to content

Commit 324cd8e

Browse files
Nilushiya.KNilushiya.K
authored andcommitted
function rename and remove dublication
Signed-off-by: Nilushiya.K <Nilushiya.K@cloudsolutions.com.sa>
1 parent 045f105 commit 324cd8e

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

core/pkg/sync/kubernetes/kubernetes_sync.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ var (
2727
featureFlagResource = v1beta1.GroupVersion.WithResource("featureflags")
2828
)
2929

30+
const invalidAPIVersionMsg = "invalid api version %s, expected %s"
31+
3032
type SyncOption func(s *Sync)
3133

3234
type Sync struct {
@@ -241,7 +243,7 @@ func commonHandler(obj interface{}, object types.NamespacedName, emitEvent Defau
241243
}
242244

243245
if u.GetAPIVersion() != apiVersion {
244-
return fmt.Errorf("invalid api version %s, expected %s", u.GetAPIVersion(), apiVersion)
246+
return fmt.Errorf(invalidAPIVersionMsg, u.GetAPIVersion(), apiVersion)
245247
}
246248

247249
if u.GetName() == object.Name {
@@ -263,7 +265,7 @@ func updateFuncHandler(oldObj interface{}, newObj interface{}, object types.Name
263265
}
264266

265267
if ffOldObj.GetAPIVersion() != apiVersion {
266-
return fmt.Errorf("invalid api version %s, expected %s", ffOldObj.GetAPIVersion(), apiVersion)
268+
return fmt.Errorf(invalidAPIVersionMsg, ffOldObj.GetAPIVersion(), apiVersion)
267269
}
268270

269271
ffNewObj, err := asUnstructured(newObj)
@@ -272,7 +274,7 @@ func updateFuncHandler(oldObj interface{}, newObj interface{}, object types.Name
272274
}
273275

274276
if ffNewObj.GetAPIVersion() != apiVersion {
275-
return fmt.Errorf("invalid api version %s, expected %s", ffNewObj.GetAPIVersion(), apiVersion)
277+
return fmt.Errorf(invalidAPIVersionMsg, ffNewObj.GetAPIVersion(), apiVersion)
276278
}
277279

278280
if object.Name == ffNewObj.GetName() && ffOldObj.GetResourceVersion() != ffNewObj.GetResourceVersion() {

core/pkg/sync/kubernetes/kubernetes_sync_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func Test_parseURI(t *testing.T) {
7474
}
7575
}
7676

77-
func Test_asUnstructured(t *testing.T) {
77+
func TestAsUnstructured(t *testing.T) {
7878
validFFCfg := v1beta1.FeatureFlag{
7979
TypeMeta: Metadata,
8080
}

0 commit comments

Comments
 (0)