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

Issue#360 - Create stress/load test which should cover all APIs with mocked OP #365

Merged
merged 13 commits into from
Sep 17, 2019

Conversation

duttarnab
Copy link
Collaborator

Issue#360 - Create stress/load test which should cover all APIs with mocked OP

#360

Changes Done:

  1. For running the Mock test cases all the OP_HOST clients have been mocked using factory class OpClientFactoryMockImpl.java

  2. To run Mocked test cases (for load testing) set isLoadTest parameter in oxd-server/testng.xml to true and uncomment org.gluu.oxd.mock.listener.EnableMocksListener which will disable all unit test cases.

To run unit test case (not the mocked ones) set isLoadTest parameter in oxd-server/testng.xml to false and comment org.gluu.oxd.mock.listener.EnableMocksListener .

  1. We have added org.gluu.oxd.mock.AuthorizationCodeFlowTest and org.gluu.oxd.mock.UmaFullTest to mock test authorization and UMA code flow.

return UmaClientFactory.instance();
}

public Validator createValidator(Jwt idToken, OpenIdConfigurationResponse discoveryResponse, PublicOpKeyService keyService) {
Copy link
Contributor

Choose a reason for hiding this comment

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

we shouldn't mock validator, we want real validator to run. Is it because internal client it not created via client factory?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done. We have mocked RSASigner otherwise we need JwksUri which required op_host.

}

public ResourceRegistrar createResourceRegistrar(PatProvider patProvider, ServiceProvider serviceProvider) {
return new ResourceRegistrar(patProvider, serviceProvider);
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks wrong too, we should mock ServiceProvider and PatProvider provider instead. But if it's more convenient then we can leave it for now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We have left this for now.

import java.lang.reflect.Constructor;
import java.lang.reflect.Method;

public class EnableMocksListener implements IAnnotationTransformer {
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess we can add "mock" package exclusion since load test will be run only manually.

Copy link
Collaborator Author

@duttarnab duttarnab Sep 11, 2019

Choose a reason for hiding this comment

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

Created 'tesng-load.xml' for mocked test cases so that the mocked test cases are excluded when running the unit test cases on jenkins.

public class SetUpTest {

private static final Logger LOG = LoggerFactory.getLogger(SetUpTest.class);

public static DropwizardTestSupport<OxdServerConfiguration> SUPPORT = null;


@Parameters({"host", "opHost", "redirectUrls"})
@Parameters({"host", "opHost", "redirectUrls", "isLoadTest"})
Copy link
Contributor

Choose a reason for hiding this comment

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

Lets introduce SetUpMockServerTest which pick it up (with code re-use without copy/pastes). It would be nice to not mess between our normal tests and load tests.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@@ -24,10 +24,10 @@
*/
public class UpdateSiteTest {

@Parameters({"host", "opHost", "redirectUrls"})
@Parameters({"host", "opHost", "redirectUrls", "isLoadTest"})
Copy link
Contributor

Choose a reason for hiding this comment

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

redundant, we should not mess normal and load tests

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@@ -5,6 +5,7 @@
<parameter name="host" value="http://localhost"/>
<parameter name="opHost" value="https://${test.server.name}"/>
<parameter name="opDiscoveryPath" value=""/>
<parameter name="isLoadTest" value="false"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

create separate testng-load.xml. isLoadTest should not be here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

<!--<listeners>
<listener class-name="org.gluu.oxd.mock.listener.EnableMocksListener"></listener>
</listeners>-->

Copy link
Contributor

Choose a reason for hiding this comment

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

redundant line, remove please.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@@ -247,6 +253,15 @@
<class name="io.swagger.client.api.UmaGetClaimsGatheringUrlTest"/>
</classes>
</test>


<!-- Mock tests-->
Copy link
Contributor

Choose a reason for hiding this comment

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

It should go in separate testng-load.xml.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@@ -0,0 +1,21 @@
test.server.name=ce-dev5.gluu.org
Copy link
Contributor

Choose a reason for hiding this comment

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

if we want to keep it for ce-dev5.gluu.org then rename this file to ce-dev5.properties

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not Required, so removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants