Skip to content
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

Merged
merged 2 commits into from
Oct 9, 2016

Conversation

soltysh
Copy link
Contributor

@soltysh soltysh commented Oct 6, 2016

sizedImage("id3", registryURL+"/foo/bar@id3", 200, nil),
),
streams: streamList(
stream(registryURL, "foo", "bar", tags(
Copy link

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?

Copy link
Contributor Author

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.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see, nevermind.

Copy link

@miminar miminar left a 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
Copy link

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok.

@soltysh
Copy link
Contributor Author

soltysh commented Oct 7, 2016

@miminar updated, except for the additional test, as mentioned the filtering is done one layer above. ptal

@miminar
Copy link

miminar commented Oct 7, 2016

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?

@soltysh
Copy link
Contributor Author

soltysh commented Oct 7, 2016

Due to some refactoring I had to do to make the code testable I've split that into 2nd commit, ptal

Copy link

@miminar miminar left a 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() {
Copy link

@miminar miminar Oct 7, 2016

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() {
Copy link

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,
Copy link

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() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not empty actions.

@soltysh
Copy link
Contributor Author

soltysh commented Oct 7, 2016

@miminar nitpicks also addressed

@miminar
Copy link

miminar commented Oct 7, 2016

LGTM, thanks!

@soltysh
Copy link
Contributor Author

soltysh commented Oct 7, 2016

[merge]

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to af137c1

@openshift-bot
Copy link
Contributor

[Test]ing while waiting on the merge queue

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to af137c1

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test FAILURE (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/9750/)

@openshift-bot
Copy link
Contributor

openshift-bot commented Oct 9, 2016

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/9785/) (Image: devenv-rhel7_5156)

@openshift-bot openshift-bot merged commit 3d24bd1 into openshift:master Oct 9, 2016
@soltysh soltysh deleted the issue9502 branch October 10, 2016 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants