forked from kyma-project/lifecycle-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Explicit version for module template (kyma-project#1699)
* Add explicit version attribute * Add test * Add test * Fix lint * Fix test * review fix * Fix compilation errors * Update api/v1beta2/moduletemplate_types.go Co-authored-by: Christoph Schwägerl <acc.pius@mailbox.org> * ignore new fields in version comparison --------- Co-authored-by: Christoph Schwägerl <acc.pius@mailbox.org> chore: Sync main to feature branch (kyma-project#1718) * chore: Refactor NewCachedDescriptorProvider (kyma-project#1695) * remove parameter for NewCachedDescriptorProvider * fix dead link * adjust unit test coverage * fix flaky test * docs: Update KLM Local Test Setup Guide (kyma-project#1680) fix errors in local test setup documentation add version info * feat: Drop multiple ways to reference modules in Kyma CR (kyma-project#1672) * remove module reference by namespace/name * remove module reference by objectmeta name * remove module reference by FQDN * add initial test structure * add test cases for different module reference scenarios * fix tests * update documentation * address review comments * address more review comments * fix linting issues * rearrange imports * adjust documentation * chore: Configure different requeue intervals for Manifest reconciliation (kyma-project#1690) * Add different requeue intervals for Manifest reconciliation * Empty-Commit * code review comments * chore: Bump k8s deps (kyma-project#1703) * chore: Bump k8s deps * retrigger jobs * bump api folder as well --------- Co-authored-by: Nesma Badr <Nesma.badr@sap.com> * fix: Manifest CR should update by moduletemplate generation changes (kyma-project#1702) * when moduletemplate generation updated, then manifest CR should also updated. * refactor regular_test.go --------- Co-authored-by: Benjamin Lindner <50365642+lindnerby@users.noreply.github.com> * fix bug due to modified ModuleName --------- Co-authored-by: Amritanshu Sikdar <amritanshu.sikdar@sap.com> Co-authored-by: Amritanshu Sikdar <amritanshu.sikdar@gmail.com> Co-authored-by: Nesma Badr <Nesma.badr@sap.com> Co-authored-by: Benjamin Lindner <50365642+lindnerby@users.noreply.github.com> feat: Add Version to Kyma.Spec.Modules (kyma-project#1694) * add version to kyma.spec.modules list * add missing manifest update base on moduletemplate generation change. * remove parameter for NewCachedDescriptorProvider * fix dead link * adjust unit test coverage * fix flaky test * chore: Refactor NewCachedDescriptorProvider (kyma-project#1695) * remove parameter for NewCachedDescriptorProvider * fix dead link * adjust unit test coverage * fix flaky test * refactor FilterTemplate * add integration test * Update tests/integration/controller/kyma/kyma_module_channel_test.go Co-authored-by: Tomasz Smelcerz <tomasz.smelcerz@sap.com> * Update tests/integration/controller/kyma/kyma_module_version_test.go Co-authored-by: Tomasz Smelcerz <tomasz.smelcerz@sap.com> * fix existing test --------- Co-authored-by: Tomasz Smelcerz <tomasz.smelcerz@sap.com> chore: Update branch to main (kyma-project#1753) * update base branch to main * update base branch to main feat: Module catalog improvements implementation (kyma-project#1748) * Implement changes in module catalog handling * review fix * review fix * review fix * remove test * fix lint * review fix feat: Remove kyma.spec.modules[].version from api (kyma-project#1837) * remove kyma.spec.modules[n].version from api * Skip test * disable test * skip test * Skip test * Update api/v1beta2/kyma_types.go Co-authored-by: Christoph Schwägerl <acc.pius@mailbox.org> --------- Co-authored-by: Christoph Schwägerl <acc.pius@mailbox.org> wip wip wip review fix
- Loading branch information
1 parent
d8f8526
commit d49de0b
Showing
45 changed files
with
1,729 additions
and
177 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
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,14 @@ | ||
package shared | ||
|
||
import "strings" | ||
|
||
type Channel string | ||
|
||
const ( | ||
// NoneChannel when this value is defined for the ModuleTemplate, it means that the ModuleTemplate is not assigned to any channel. | ||
NoneChannel Channel = "none" | ||
) | ||
|
||
func (c Channel) Equals(value string) bool { | ||
return string(c) == strings.ToLower(value) | ||
} |
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,105 @@ | ||
package v1beta2 | ||
|
||
import ( | ||
"strings" | ||
"testing" | ||
|
||
"github.com/kyma-project/lifecycle-manager/api/shared" | ||
apimetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
func Test_GetVersion(t *testing.T) { | ||
const testVersion = "1.0.1" | ||
const otherVersion = "0.0.1" | ||
tests := []struct { | ||
name string | ||
m *ModuleTemplate | ||
expectedVersion string | ||
expectedErr string | ||
}{ | ||
{ | ||
name: "Test GetVersion() by annotation (legacy)", | ||
m: &ModuleTemplate{ | ||
ObjectMeta: apimetav1.ObjectMeta{ | ||
Annotations: map[string]string{ | ||
shared.ModuleVersionAnnotation: testVersion, | ||
}, | ||
}, | ||
}, | ||
expectedVersion: testVersion, | ||
}, | ||
{ | ||
name: "Test GetVersion() by explicit version in Spec", | ||
m: &ModuleTemplate{ | ||
Spec: ModuleTemplateSpec{ | ||
Version: testVersion, | ||
}, | ||
}, | ||
expectedVersion: testVersion, | ||
}, | ||
{ | ||
name: "Test GetVersion() with both version in Spec and annotation", | ||
m: &ModuleTemplate{ | ||
ObjectMeta: apimetav1.ObjectMeta{ | ||
Annotations: map[string]string{ | ||
shared.ModuleVersionAnnotation: otherVersion, | ||
}, | ||
}, | ||
Spec: ModuleTemplateSpec{ | ||
Version: testVersion, | ||
}, | ||
}, | ||
expectedVersion: testVersion, | ||
}, | ||
{ | ||
name: "Test GetVersion without any version info", | ||
m: &ModuleTemplate{ | ||
ObjectMeta: apimetav1.ObjectMeta{ | ||
Annotations: map[string]string{}, | ||
}, | ||
Spec: ModuleTemplateSpec{}, | ||
}, | ||
expectedErr: ErrInvalidVersion.Error(), | ||
}, | ||
{ | ||
name: "Test GetVersion with invalid version", | ||
m: &ModuleTemplate{ | ||
Spec: ModuleTemplateSpec{ | ||
Version: "invalid", | ||
}, | ||
}, | ||
expectedErr: "Invalid Semantic Version", | ||
}, | ||
} | ||
for _, tt := range tests { | ||
tt := tt | ||
t.Run(tt.name, func(t *testing.T) { | ||
tt := tt | ||
actualVersion, err := tt.m.GetVersion() | ||
if err != nil { | ||
if actualVersion != nil { | ||
t.Errorf("GetVersion(): Returned version should be nil when error is not nil") | ||
} | ||
if tt.expectedErr == "" { | ||
t.Errorf("GetVersion(): Unexpected error: %v", err) | ||
} | ||
if !strings.Contains(err.Error(), tt.expectedErr) { | ||
t.Errorf("GetVersion(): Actual error = %v, expected error: %v", err, tt.expectedErr) | ||
} | ||
return | ||
} | ||
|
||
if actualVersion == nil { | ||
t.Errorf("GetVersion(): Returned version should not be nil when error is nil") | ||
} | ||
|
||
if tt.expectedVersion == "" { | ||
t.Errorf("GetVersion(): Expected version is empty but non-nil version is returned") | ||
} | ||
|
||
if actualVersion.String() != tt.expectedVersion { | ||
t.Errorf("GetVersion(): actual version = %v, expected version: %v", actualVersion.String(), tt.expectedVersion) | ||
} | ||
}) | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.