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

Isolation segments cleanup #723

Merged
merged 11 commits into from
Dec 9, 2016

Conversation

ScarletTanager
Copy link
Contributor

@ScarletTanager ScarletTanager commented Nov 16, 2016

  • Move state logic to sequel validations
  • refactor to accommodate recent changes to master
  • cleanup of specs
  • add IsolationSegmentDelete action
  • add is_shared_segment? check for individual objects rather than re-query DB
  • sort by organization id when doing POST bulk updates

Story reference https://www.pivotaltracker.com/story/show/133869287

Dan Lavine and others added 10 commits November 16, 2016 15:48
Signed-off-by: Sandy Cash <scarlet.tanager@gmail.com>
…egmentAssign actions

[#133869287]

Signed-off-by: Dan Lavine <dlavine@us.ibm.com>
- add shared segment equality method

[#133869287]

Signed-off-by: Dan Lavine <dlavine@us.ibm.com>
from the Space controller to the Space model.

[#133869287]

Signed-off-by: Dan Lavine <dlavine@us.ibm.com>
[#133869287]

Signed-off-by: Sandy Cash <scarlet.tanager@gmail.com>
…for IS <-> orgs

[#133869287]

Signed-off-by: Dan Lavine <dlavine@us.ibm.com>
[#133869287]

Signed-off-by: Dan Lavine <dlavine@us.ibm.com>
- Use IsolationSegmentModel.is_shared_segment?
- Fix specs after rebase
- Rubocop
- Allow org.default_isolation_segment_model to go from nil to shared

[finishes #133869287]

Signed-off-by: Sandy Cash <scarlet.tanager@gmail.com>
@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/134468621

The labels on this github issue will be updated when the story is started.

@cfdreddbot
Copy link

Hey ScarletTanager!

Thanks for submitting this pull request! I'm here to inform the recipients of the pull request that you and the commit authors have already signed the CLA.

Copy link
Contributor

@luan luan left a comment

Choose a reason for hiding this comment

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

Changes look mostly good. I didn't know about contain_exactly, will probably be using that instead of include from now on since it's almost always what we want.

Added a few line comments for minor things to change, happy to merge after those are addressed.

@@ -8,14 +8,22 @@ module VCAP::CloudController
let(:org2) { Organization.make }

it 'sorts the organizations passed in for assignment' do
org.update(guid: 'b')
org2.update(guid: 'a')
rval = Random.new.rand(1..2)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prefer having two tests with the two scenarios instead of one test that randomly picks one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good!


org.reload
org2.reload
if rval == 1
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above about random tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good!


context 'associating an isolation_segment' do
context 'when the space contains no apps' do
Copy link
Contributor

Choose a reason for hiding this comment

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

We're curious about what drove us to remove these tests. Are they no longer necessary? Are we covering these scenarios somewhere else?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@luan Yes, @DanLavine and I moved these into the model spec for space, since the check is now in a validation in that class.

Copy link
Contributor

Choose a reason for hiding this comment

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

@ScarletTanager We were able to find the tests for when spaces contains apps, but we were unable to find the tests for spaces that had no apps in them, particularly testing associating the space with the isolation segment as different roles. Could you point us to where those tests landed?

Copy link

@ghost ghost Dec 5, 2016

Choose a reason for hiding this comment

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

@thausler786 What is the difference in the space having apps or not when assigning an Isolation Segment? If the user is unable to perform the action, then they will get a 403 regardless. Those tests are still in this spaces_controller_spec.rb file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@SocalNick I'm not sure who's in the queue to pick this up, but hopefully we've answered the question here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Community pair changes every day. Maybe ping us in Slack to see if you can get some realtime confirmation during working hours today.

'Adding the Isolation Segment to the Space',
"Only Isolation Segments in the Organization's allowed list can be used.")
end
raise CloudController::Errors::ApiError.new_from_details('ResourceNotFound', 'Isolation Segment not found') if
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a little confusing to read. It may be the go developer talking but I don't really like the if at the end of the line with no conditions. If you were to merge the condition in the same line it'd be a really long line. So I'd prefer if this was just a regular if around the raise.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

- Replace randomized sort tests with individual tests for each possible order
- Reformat conditional raise

[#133869287]

Signed-off-by: Dan Lavine <dlavine@us.ibm.com>
@ScarletTanager
Copy link
Contributor Author

@luan - Pushed a commit with the requested changes. Thanks!

@ScarletTanager & @DanLavine

@aashah aashah merged commit 3d60e8c into cloudfoundry:master Dec 9, 2016
aashah pushed a commit that referenced this pull request Dec 9, 2016
@ScarletTanager ScarletTanager deleted the isolation_segments_cleanup branch January 23, 2017 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants