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

Add integration tests for rest resources #18

Closed
codefromthecrypt opened this issue Aug 23, 2013 · 16 comments
Closed

Add integration tests for rest resources #18

codefromthecrypt opened this issue Aug 23, 2013 · 16 comments
Labels

Comments

@codefromthecrypt
Copy link

I'm hoping @jmnarloch can give the new arquillian integration a whirl on a real prod app that uses karyon.

My suggestion would be to make a test that just does a list with no params on https://github.com/Netflix/genie/blob/master/genie-server/src/main/java/com/netflix/genie/server/resources/HiveConfigResourceV0.java#L117 for starters.

@codefromthecrypt
Copy link
Author

cc @NiteshKant let's see how this works!

@jmnarloch
Copy link
Contributor

Sure. No problem. I will try to find some time this week. Should i use a
snapshot to do that?
23 sie 2013 04:08, "Adrian Cole" notifications@github.com napisa³(a):

I'm hoping @jmnarloch https://github.com/jmnarloch can give the new arquillian
integrationhttps://github.com/Netflix/karyon/tree/master/karyon-examples/hello-netflix-ossa whirl on a real prod app that uses karyon.

My suggestion would be to make a test that just does a list with no params
on
https://github.com/Netflix/genie/blob/master/genie-server/src/main/java/com/netflix/genie/server/resources/HiveConfigResourceV0.java#L117for starters.

Reply to this email directly or view it on GitHubhttps://github.com//issues/18
.

@sriramkrishnan
Copy link
Contributor

Sounds cool. You can use a snapshot:
https://github.com/Netflix/genie#builds

I have some end-to-end Python tests, which may be a good starting point:
https://github.com/Netflix/genie/tree/master/genie-web/src/test/python/config

Feel free to get in touch if you have trouble with installing anything.

@codefromthecrypt
Copy link
Author

@jmnarloch sorry about the karyon snapshot being missing. We'll try and sort that out soon!

@jmnarloch
Copy link
Contributor

I have made a simple test case, although I got some error when I try to run it:

#23

@jmnarloch
Copy link
Contributor

I got stack, whatever I try to do the archaius.deployment.applicationIdis not being set, even setting this manually through the build.gradle, does not resolve the issue.

2013-09-04 21:51:22,230 WARN com.netflix.karyon.server.ArchaiusIntegrationInterceptor:34 [localhost-startStop-1] [onPhase] Application identifier not defined, skipping application level properties loading. You must set a property 'archaius.deployment.applicationId' to be able to load application level properties.

@sriramkrishnan
Copy link
Contributor

Hi @jmnarloch, how are you setting the archaius.deployment.applicationId=genie?

Did you try to set your JAVA_OPTS to something like this - "-Darchaius.deployment.applicationId=genie -Darchaius.deployment.environment=dev".

Thanks!
Sriram

@jmnarloch
Copy link
Contributor

I tried two things: first I've build the genie-web, deployed that on the standalone tomcat and set the CATALINA_OPTS this seems to be working perfectly fine. Now the trick is I'm trying to run the application through arquillian in the embedded tomcat, neither setting the System.property("archaius.deployment.applicationId", "genie") does not work. I recall that this was the valid way of initializing the application id used in kayron integration tests.

Is there other way to set this parameter, not through system/environment variable?

@sriramkrishnan
Copy link
Contributor

This is actually a question for @NiteshKant - does that property need to be set when the JVM starts up? If not, is there a way to do this as @jmnarloch expects?

@jmnarloch
Copy link
Contributor

I've resolved the problem made a and made a minimal implementation for the mentioned resource, although there are things that need clarification:

  • Since the test suite comes with kayron 1.0.21 (currently I used a SNAPSHOT build on my machine) I had updated all the dependencies.
  • The gradle build is running enhancement, this is way I am loading the build WAR from the genie-web module. If we would want to do that from when creating the arquillian deployment we would have to run the enhancement programmatically.
  • The WAR artifact path at the moment is hardcoded, so it would be nice to have so smart way for loading it.
  • I do not have much knowledge about configuring the genie, so at the moment I have used the existing files. You should be able to set up the configuration so that you could run the the tests for example with your continues integration server.

@sriramkrishnan
Copy link
Contributor

Thanks for your contribution @jmnarloch - this is a great starting point. I can start moving some of my Python-based integration tests to this framework now.

sriramkrishnan added a commit that referenced this issue Sep 13, 2013
@sriramkrishnan
Copy link
Contributor

@jmnarloch only problem is - if I run "./gradlew clean test", it fails because it expects a war file to be present. Let me see if i can fix this.

@jmnarloch
Copy link
Contributor

I have been running each time: clean build for running the integration test.

To resolve your issue: I have tried adding: test.dependsOn ':genie-web:build' to the integration tests sub module, but there is some classloading issue, that loads not the ehnanced classes and I got the error during deployment from the openjpa that the classes can not be enhanced at the runtime.

Other option would be to add a condition to the test sub module, so that the test would run only when the war file is actually present: http://www.gradle.org/docs/current/userguide/userguide_single.html#N10E97

@sriramkrishnan
Copy link
Contributor

I have checked in a "workaround" (see above). Basically I am not running the test under :genie-web-int:tests - since it is supposed to be run under build anyways. So both the test and build targets work now.

@sriramkrishnan
Copy link
Contributor

We can continue to add more tests, but the initial setup is complete. I will close this issue.

@jmnarloch
Copy link
Contributor

OK, thanks!

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

No branches or pull requests

3 participants