-
Notifications
You must be signed in to change notification settings - Fork 827
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
Further Integration Tests for Alias Identity Providers Feature #2722
Further Integration Tests for Alias Identity Providers Feature #2722
Conversation
We have created an issue in Pivotal Tracker to manage this: https://www.pivotaltracker.com/story/show/187017042 The labels on this github issue will be updated when the story is started. |
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's hard to review as I don't know what code was moved (and git thinks it was deleted and rewritten), and which code is indeed new, and which one was deleted.
Do you think you could try to split it into multiple smaller commits?
@@ -327,85 +373,358 @@ protected UpdateBase(final boolean aliasFeatureEnabled) { | |||
void setUp() { | |||
arrangeAliasFeatureEnabled(aliasFeatureEnabled); | |||
} | |||
} | |||
|
|||
@Nested |
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.
This is confusing.
It looks like you didn't actually delete this, but that git is confused and believes so. It makes it harder to review. That's one of the many reasons I like smaller commits, it makes it easier on git and us.
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.
For this particular PR, it might be easier to just consider the new version of the test class and ignore the diffs git generated. The PDF I posted in the Slack channel might be helpful as well.
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.
But then I don't see what is being deleted. I can't validate that we are not removing test coverage.
The commit says that it adds further tests, but I see lots of lines of code being deleted.
As discussed in last week's sync up, @adrianhoelzl-sap when you have updated the commits for this, I'll review as @bruce-ricard is out this week. |
be1add2
to
115bad4
Compare
We have created an issue in Pivotal Tracker to manage this: https://www.pivotaltracker.com/story/show/187268528 The labels on this github issue will be updated when the story is started. |
Thanks for the update. I'll convert this PR back from draft to regular once it is ready for review. |
…ias and the aliasId is set in the update payload (valid for enabled and disabled alias feature)
…e to alias in existing IdP if alias feature is disabled
…xists and the update payload contains a non-empty aliasZid
…iesChangedWhileAliasPropertiesUnchanged to nested class ExistingAlias
…PropertiesToNull to nested class ExistingAlias
…ertiesToNullAndChangeOtherProperties to nested class ExistingAlias
…AliasIdOfExistingIdpMissing to nested class ExistingAlias
…DanglingReference to nested class ExistingAlias
…etToNull to nested class ExistingAlias
…SetToNull to nested class ExistingAlias
@Test | ||
void shouldReject_AliasIdNotSetInPayload_CustomToUaaZone() throws Exception { | ||
shouldReject_AliasIdNotSetInPayload(customZone, IdentityZone.getUaa()); | ||
} |
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 good. Leaving comments to track my progress as this is challenging to read through.
@Test | ||
void shouldReject_AliasIdNotSetInPayload_UaaToCustomZone() throws Exception { | ||
shouldReject_AliasIdNotSetInPayload(IdentityZone.getUaa(), customZone); | ||
} |
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 good. Leaving comments to track my progress as this is challenging to read through.
@Test | ||
void shouldAccept_OtherPropertiesOfIdpWithAliasAreChanged_CustomToUaaZone() throws Exception { | ||
shouldAccept_OtherPropertiesOfIdpWithAliasAreChanged(customZone, IdentityZone.getUaa()); | ||
} |
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 good. Leaving comments to track my progress as this is challenging to read through.
class ExistingAlias { | ||
@Test | ||
void shouldAccept_OtherPropertiesOfIdpWithAliasAreChanged_UaaToCustomZone() throws Exception { | ||
shouldAccept_OtherPropertiesOfIdpWithAliasAreChanged(IdentityZone.getUaa(), customZone); |
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 good. Leaving comments to track my progress as this is challenging to read through.
); | ||
idp.setAliasZid(zone.getId()); | ||
shouldRejectUpdate(zone, idp, HttpStatus.UNPROCESSABLE_ENTITY); | ||
} |
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 good. Leaving comments to track my progress as this is challenging to read through.
@Test | ||
void shouldReject_AliasZidSetToSameZone_CustomZone() throws Exception { | ||
shouldReject_AliasZidSetToSameZone(customZone); | ||
} |
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 good. Leaving comments to track my progress as this is challenging to read through.
@Test | ||
void shouldReject_AliasZidSetToSameZone_UaaZone() throws Exception { | ||
shouldReject_AliasZidSetToSameZone(IdentityZone.getUaa()); | ||
} |
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 good. Leaving comments to track my progress as this is challenging to read through.
// try to create an alias for the IdP -> should fail because of the IdP's type | ||
createdProvider.setAliasZid(zone2.getId()); | ||
shouldRejectUpdate(zone1, createdProvider, HttpStatus.UNPROCESSABLE_ENTITY); | ||
} |
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 good. Leaving comments to track my progress as this is challenging to read through.
private void shouldReject_AliasNotSupportedForIdpType(final IdentityZone zone1, final IdentityZone zone2) throws Exception { | ||
final IdentityProvider<?> uaaIdp = buildUaaIdpWithAliasProperties(zone1.getId(), null, null); | ||
final IdentityProvider<?> createdProvider = createIdp(zone1, uaaIdp); | ||
assertThat(createdProvider.getAliasZid()).isBlank(); |
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 good. Leaving comments to track my progress as this is challenging to read through.
@Test | ||
void shouldReject_AliasNotSupportedForIdpType_CustomZone() throws Exception { | ||
shouldReject_AliasNotSupportedForIdpType(customZone, IdentityZone.getUaa()); | ||
} |
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 good. Leaving comments to track my progress as this is challenging to read through.
@Test | ||
void shouldReject_AliasNotSupportedForIdpType_UaaToCustomZone() throws Exception { | ||
shouldReject_AliasNotSupportedForIdpType(IdentityZone.getUaa(), customZone); | ||
} |
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 good. Leaving comments to track my progress as this is challenging to read through.
|
||
// the alias IdP should have its reference removed | ||
assertReferenceWasRemovedFromAlias(initialAliasId, initialAliasZid); | ||
} |
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 good. Leaving comments to track my progress as this is challenging to read through.
@Test | ||
void shouldAccept_SetOnlyAliasPropertiesToNull_UaaToCustomZone() throws Throwable { | ||
shouldAccept_SetOnlyAliasPropertiesToNull(IdentityZone.getUaa(), customZone); | ||
} |
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 good. Leaving comments to track my progress as this is challenging to read through.
existingIdp.setAliasId(null); | ||
existingIdp.setAliasZid(null); | ||
existingIdp.setName("some-new-name"); | ||
shouldRejectUpdate(zone1, existingIdp, HttpStatus.UNPROCESSABLE_ENTITY); |
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 good. Leaving comments to track my progress as this is challenging to read through.
|
||
// check if the returned IdP has a redacted relying party secret | ||
assertRelyingPartySecretIsRedacted(updatedIdp); | ||
} |
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 good. Leaving comments to track my progress as this is challenging to read through.
final String newAliasId, | ||
final String newAliasZid | ||
) throws Throwable { | ||
shouldReject_ChangingAliasPropertiesOfIdpWithAlias(newAliasId, newAliasZid, IdentityZone.getUaa(), customZone); |
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 good. Leaving comments to track my progress as this is challenging to read through.
final String newAliasId, | ||
final String newAliasZid | ||
) throws Throwable { | ||
shouldReject_ChangingAliasPropertiesOfIdpWithAlias(newAliasId, newAliasZid, customZone, IdentityZone.getUaa()); |
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 good. Leaving comments to track my progress as this is challenging to read through.
); | ||
@Test | ||
void shouldReject_OnlyAliasZidSetToNull_UaaToCustomZone() throws Throwable { | ||
shouldReject_OnlyAliasZidSetToNull(IdentityZone.getUaa(), customZone); |
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 good. Leaving comments to track my progress as this is challenging to read through.
assertThat(originalIdp.getAliasZid()).isNotBlank(); | ||
@Test | ||
void shouldReject_OnlyAliasZidSetToNull_CustomToUaaZone() throws Throwable { | ||
shouldReject_OnlyAliasZidSetToNull(customZone, IdentityZone.getUaa()); |
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 good. Leaving comments to track my progress as this is challenging to read through.
shouldReject_OnlyAliasZidSetToNull(customZone, IdentityZone.getUaa()); | ||
} | ||
originalIdp.setAliasId(null); | ||
shouldRejectUpdate(zone1, originalIdp, HttpStatus.UNPROCESSABLE_ENTITY); |
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 good. Leaving comments to track my progress as this is challenging to read through.
shouldReject_OnlyAliasZidSetToNull(IdentityZone.getUaa(), customZone); | ||
} | ||
assertThat(originalIdp.getAliasId()).isNotBlank(); | ||
assertThat(originalIdp.getAliasZid()).isNotBlank(); |
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 good. Leaving comments to track my progress as this is challenging to read through.
private IdentityProvider<?> updateIdpViaDb(final String zoneId, final IdentityProvider<?> idp) { | ||
final JdbcIdentityProviderProvisioning identityProviderProvisioning = webApplicationContext | ||
.getBean(JdbcIdentityProviderProvisioning.class); | ||
return identityProviderProvisioning.update(idp, zoneId); |
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 good. Leaving comments to track my progress as this is challenging to read through.
assertThat(originalIdp.getAliasZid()).isNotBlank(); | ||
|
||
originalIdp.setAliasZid(null); | ||
shouldRejectUpdate(zone1, originalIdp, HttpStatus.UNPROCESSABLE_ENTITY); |
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 good. Leaving comments to track my progress as this is challenging to read through.
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 believe I have covered all the changes, but they are very difficult to read through. I would highly suggest keeping PRs separated between Added New tests and Updating/Refactoring existing tests.
see #2505
This PR adds additional MockMvc tests for some yet uncovered paths as well as for the GET IdPs endpoint.