Resolve SERVICE_UNAVAILABLE in IdP IntegTest (#54700)

The SamlIdentityProviderTests IntegTests would sometimes encounter a
service unavailable exception when registering a new service provider.

This change ensure that there is a data node, and that the cluster
state is recovered before registering providers

Backport of: #54622
This commit is contained in:
Tim Vernum 2020-04-06 11:23:08 +10:00 committed by GitHub
parent b2cd858f29
commit cf442aae38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -299,6 +299,9 @@ public class SamlIdentityProviderTests extends IdentityProviderIntegTestCase {
} }
private void registerServiceProvider(String entityId, String acsUrl) throws Exception { private void registerServiceProvider(String entityId, String acsUrl) throws Exception {
internalCluster().ensureAtLeastNumDataNodes(1);
ensureYellowAndNoInitializingShards();
Map<String, Object> spFields = new HashMap<>(); Map<String, Object> spFields = new HashMap<>();
spFields.put(SamlServiceProviderDocument.Fields.ACS.getPreferredName(), acsUrl); spFields.put(SamlServiceProviderDocument.Fields.ACS.getPreferredName(), acsUrl);
spFields.put(SamlServiceProviderDocument.Fields.ENTITY_ID.getPreferredName(), entityId); spFields.put(SamlServiceProviderDocument.Fields.ENTITY_ID.getPreferredName(), entityId);