-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Bug 1371511 - add namespace awareness to oadm prune commands #11249
Conversation
sizedImage("id3", registryURL+"/foo/bar@id3", 200, nil), | ||
), | ||
streams: streamList( | ||
stream(registryURL, "foo", "bar", tags( |
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.
One more test having at least two image streams where one belongs to different namespace?
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.
It doesn't make sense, since namespace filtering is done when listing objects.
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.
Oh I see, nevermind.
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.
Just a few remarks. Otherwise, it looks good to me.
@@ -825,6 +829,10 @@ func (p *pruner) Prune( | |||
errs := []error{} | |||
|
|||
errs = append(errs, pruneStreams(p.g, prunableImageNodes, streamPruner)...) | |||
// if namespace is specified prune only ImageStreams and nothing more |
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'd avoid computing graphWithoutPrunableImages
and prunableComponents
if we prune only image streams.
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.
ok.
@miminar updated, except for the additional test, as mentioned the filtering is done one layer above. ptal |
But I would still like to see at least one test that ensures the pruning affects only chosen namespace. Could you please provide integration or cmd test? |
Due to some refactoring I had to do to make the code testable I've split that into 2nd commit, ptal |
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.
Few more nitpicks.
t.Errorf("Unexpected error: %v", err) | ||
} | ||
|
||
for _, a := range osFake.Actions() { |
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.
Assert also there's at least one action in Actions list.
t.Errorf("Unexpected namespace while pruning %s: %s", a.GetResource(), a.GetNamespace()) | ||
} | ||
} | ||
for _, a := range kFake.Actions() { |
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.
Same as above.
|
||
OSClient: osFake, | ||
KClient: kFake, | ||
Out: ioutil.Discard, |
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.
Heh nice! Need to remember this one.
t.Errorf("Unexpected namespace while pruning %s: %s", a.GetResource(), a.GetNamespace()) | ||
} | ||
} | ||
for _, a := range kFake.Actions() { |
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.
Not empty actions.
@miminar nitpicks also addressed |
LGTM, thanks! |
[merge] |
Evaluated for origin merge up to af137c1 |
[Test]ing while waiting on the merge queue |
Evaluated for origin test up to af137c1 |
continuous-integration/openshift-jenkins/test FAILURE (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/9750/) |
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/9785/) (Image: devenv-rhel7_5156) |
Fixes #9502 and https://bugzilla.redhat.com/show_bug.cgi?id=1371511.
@miminar ptal