-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: create new ttr for tiertemplate updates #1130
base: master
Are you sure you want to change the base?
Conversation
/retest updated e2e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only have 2 slight readability improvement suggestions, otherwise looks great!
Co-authored-by: Lukas Krejci <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1130 +/- ##
==========================================
- Coverage 79.52% 79.41% -0.11%
==========================================
Files 80 81 +1
Lines 8087 8129 +42
==========================================
+ Hits 6431 6456 +25
- Misses 1471 1484 +13
- Partials 185 189 +4
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great 👍
_, inUse := item.Status.Revisions[obj.GetName()] | ||
if !inUse { | ||
// this tier doesn't use the template | ||
continue | ||
} | ||
// the tier uses this template | ||
req = append(req, reconcile.Request{ | ||
NamespacedName: types.NamespacedName{ | ||
Namespace: item.Namespace, | ||
Name: item.Name, | ||
}, | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be simplified to
_, inUse := item.Status.Revisions[obj.GetName()] | |
if !inUse { | |
// this tier doesn't use the template | |
continue | |
} | |
// the tier uses this template | |
req = append(req, reconcile.Request{ | |
NamespacedName: types.NamespacedName{ | |
Namespace: item.Namespace, | |
Name: item.Name, | |
}, | |
}) | |
if _, inUse := item.Status.Revisions[obj.GetName()]; inUse { | |
// the tier uses this template | |
req = append(req, reconcile.Request{ | |
NamespacedName: types.NamespacedName{ | |
Namespace: item.Namespace, | |
Name: item.Name, | |
}, | |
}) | |
} |
// given | ||
// both tiers are without revisions | ||
base1nsTier := tiertest.Base1nsTier(t, tiertest.CurrentBase1nsTemplates) | ||
otherTier := tiertest.AppStudioEnvTier(t, tiertest.AppStudioEnvTemplates) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw, the tests don't verify when the NSTemplateTier has revisions, but not the specific TierTemplate:
otherTier := tiertest.AppStudioEnvTier(t, tiertest.AppStudioEnvTemplates) | |
otherTier := tiertest.AppStudioEnvTier(t, tiertest.AppStudioEnvTemplates) | |
prepareTierWithRevisions(otherTier) | |
delete(otherTier.Status.Revisions, "base1ns-clusterresources-123456new") |
@@ -338,6 +316,119 @@ func TestReconcile(t *testing.T) { | |||
|
|||
} | |||
|
|||
func TestUpdateNSTemplateTier(t *testing.T) { | |||
logf.SetLogger(zap.New(zap.UseDevMode(true))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
out of curiosity - why do we need to configure the logger in the unit test?
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: MatousJobanek, mfrancisc The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Quality Gate passedIssues Measures |
This PR triggers a TTR creation when the tiertemlpate content changes or there is a change in the NSTemplateTier parameters field.
follow up from #1103
Paired with: codeready-toolchain/toolchain-e2e#1102
Jira: https://issues.redhat.com/browse/KUBESAW-257