jakubschwan commented on code in PR #447:
URL:
https://github.com/apache/incubator-kie-kogito-serverless-operator/pull/447#discussion_r1572249254
##########
api/metadata/annotations.go:
##########
@@ -73,3 +73,30 @@ const (
// Ideally used in production use cases
GitOpsProfile ProfileType = "gitops"
)
+
+const (
+ DefaultProfile = PreviewProfile
+)
+
+var supportedProfiles = map[ProfileType]ProfileType{DevProfile: DevProfile,
PreviewProfile: PreviewProfile, GitOpsProfile: GitOpsProfile}
Review Comment:
Add note that deprecated profile is not supported
```suggestion
// deprecated prod profile is deprecate and not supported, use preview
profile
var supportedProfiles = map[ProfileType]ProfileType{DevProfile: DevProfile,
PreviewProfile: PreviewProfile, GitOpsProfile: GitOpsProfile}
```
Not sure how exactly we handle deprecated profiles, but it would be good to
add there some note. In case we do not need deprecated profile anymore, we can
also remove it for next release.
##########
api/metadata/annotations_test.go:
##########
@@ -0,0 +1,42 @@
+// Copyright 2024 Apache Software Foundation (ASF)
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package metadata
+
+import (
+ "testing"
+)
+
+func TestGetProfile(t *testing.T) {
+ type args struct {
+ annotation map[string]string
+ }
+ tests := []struct {
+ name string
+ args args
+ want ProfileType
+ }{
+ {"Empty Annotations", args{annotation: nil}, DefaultProfile},
+ {"Non-existent Profile", args{annotation:
map[string]string{Profile: "IDontExist"}}, DefaultProfile},
+ {"Regular Annotation", args{annotation:
map[string]string{Profile: GitOpsProfile.String()}}, GitOpsProfile},
+ {"Deprecated Annotation", args{annotation:
map[string]string{Profile: ProdProfile.String()}}, DefaultProfile},
Review Comment:
Add Dev profile to tests
```suggestion
{"Empty Annotations", args{annotation: nil}, DefaultProfile},
{"Non-existent Profile", args{annotation:
map[string]string{Profile: "IDontExist"}}, DefaultProfile},
{"Regular Annotation", args{annotation:
map[string]string{Profile: GitOpsProfile.String()}}, GitOpsProfile},
{"Deprecated Annotation", args{annotation:
map[string]string{Profile: ProdProfile.String()}}, DefaultProfile},
{"Dev Annotation", args{annotation: map[string]string{Profile:
DevProfile.String()}}, DevProfile},
```
##########
controllers/profiles/gitops/profile_gitops_test.go:
##########
@@ -29,7 +29,7 @@ import (
)
func Test_Reconciler_ProdOps(t *testing.T) {
- workflow := test.GetBaseSonataFlowWithProdOpsProfile(t.Name())
+ workflow := test.GetBaseSonataFlowWithGitOpsProfile(t.Name())
Review Comment:
Is this change correct, as instead of prod profile should be used preview?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]