-
Notifications
You must be signed in to change notification settings - Fork 2
Testing
Tests that are made manually, with debug on, only local glassfish, looking all the operations are performed correctly. Clusterjsp application is used:
-
Start a new session. Clear all cookies in the browser and start a new session. The session is requested to be created (createSession) and it is locked while creation. Then the unlock and the save (always a save).
-
Update or refresh test. The session is located in internal map and returned. The lock and unlock operations are executed and finally a save (set or cas) is done. Since 0.3 no touch is done, so update or refresh perform a cas/set.
-
External attributes: Here test the external attributes, big attributes that are stored in another couchbase object):
- add: create a new big attribute, and do not use it til a new object in couchbase is created.
- get: after that read the attribute from couchbase.
- delete: delete a big attr used as external, delete in couchbase.
- set big: set an old little value a big value, the attribute is transformed into an external one after some time not using it.
- set little: set an old big attribute externalized as a little value, the external object is deleted and the little one integrated into the session.
- re-integration: an externalized attribute is re-inserted as internal because usage ratio.
- test the touch: with an external attr, do not read the attr and force the touch of the attr.
-
Test of session recover. Stop and start the domain. The session is not found locally so it is searched in couchbase. It is recovered, added to local map, locked and unlocked. Always saved cos it is just created again. Do this tests with external attributes.
-
Session invalidation. Session is found locally, locked but then removed. The session is removed from couchbase and after that from the local pool. Glassfish checks expiration after the invalidation, here there is a race. It can happen to be completely deleted and it is searched again in couchbase and not found or it can be found locally (cos not yet completed the operation) but in NOT FOUND state (deleted). Do this test with external attrs.
-
Test with an invalidated session. After the deletion, push the browser back button and refresh. The session is searched both locally and in couchbase but not found. A new session is requested to be created (the rest of the process is exactly the same as 1).
-
Expiration time. Wait the session timeout (10 min in my examples), check the processExpires finally detects the session as expired, background locks it, checks it does not exists in couchbase, and deletes it from local pool. Do this tests with external attrs.
-
Error in couchbase. Create a new session and then stop couchbase. Click the application to check the session is put in ERROR state and a exception is returned (sticky needs two clicks). Start again the couchbase server. Click the application again. The session should be read from couchbase inside the lock foreground (cos it is in ERROR), then a normal save is executed.
- Repeat the tests four times (sticky and non-sticky / glassfish V3 and V4).
This tests haven been automatized via maven.
This tests are done with the web service client application after deploying the server in the two-instanced glassfish cluster. Check no errors are reported by the application or in the glassfish logs (no debug, just warn and error).
-
Blocking tests. One client thread but two children sharing the same session (locks and starvation in non-sticky, nothing special in sticky). Two tests with sleep of 100ms and 0 (no sleep, testing locking). In non-sticky it has to be seen long starvation from one child over the other and big variance.
java -cp . es.rickyepoderi.managertest.client.Tester -b "http://192.168.122.21/manager-test/SessionTest?wsdl" -ci 1 -ct 2 -ci 1000 -ts 100/0 -d
-
Refresh/Updates tests. Just one client but doing a lot of refresh/updates (I have to change the manager test to manage Strings and not byte[] cos currently byte[] never refresh, always updates). No starvation or variance with 100ms, a bit with 0 (maybe still locked in the background save).
java -cp . es.rickyepoderi.managertest.client.Tester -b "http://192.168.122.21/manager-test/SessionTest?wsdl" -ci 1 -ct 1 -ci 1000 -ts 100/0 -d
-
Create/Delete tests. Just one client but doing a lot of iterations of create and delete. Check no errors in glassfish logs.
java -cp . es.rickyepoderi.managertest.client.Tester -b "http://192.168.122.21/manager-test/SessionTest?wsdl" -ci 1 -ct 1 -i 1000 -ci 5 -ts 100/0 -d
-
External attributes tests: Similar to create / delete tests but the thread in this tests creates big attributes and only accesses one of them. The inner iterations are 50 so all the attributes are separated as external.
java -cp . es.rickyepoderi.managertest.client.Tester -b "http://192.168.122.21/manager-test/SessionTest?wsdl" -ci 1 -ct 1 -i 50 -ci 50 -s 6000 -ts 100/0 -d
-
Performance tests. The one I usually do in the blog posts. I have modified performance tests since version 0.4.0 (external attributes):
java -cp . es.rickyepoderi.managertest.client.Tester -b "http://192.168.122.21/manager-test/SessionTest?wsdl" -t 16 -i 20 -ci 50 -ts 500 -a 4 -s 50
java -cp . es.rickyepoderi.managertest.client.Tester -b "http://192.168.122.21/manager-test/SessionTest?wsdl" -t 16 -i 20 -ci 50 -ts 500 -a 20 -s 200
java -cp . es.rickyepoderi.managertest.client.Tester -b "http://192.168.122.21/manager-test/SessionTest?wsdl" -t 16 -i 20 -ci 50 -ts 500 -a 10 -s 8000 -u 1
java -cp . es.rickyepoderi.managertest.client.Tester -b "http://192.168.122.21/manager-test/SessionTest?wsdl" -t 16 -i 20 -ci 50 -ts 500 -a 10 -s 8000 -u 10
-
Remember to check sticky and non-sticky. Sticky should use 192.168.122.22 and non-sticky 192.168.122.21 in the wsdl definition.
After the mavenization of the project there are several tests that can be executed using mvn:
-
io: Only one test that checks if the special input/output streams for session works well.
-
couchbase: Simple tests to check the proper working of couchbase. It always checks the localhost URL: http://localhost:8091/pools
-
simplews: WebServices tests that execute normal session management (internal, external attributes and create, update, invalidation and expiration of the session).
-
blocking: tests which uses several inner threads to do blocks (testing non-sticky proper behavior).
-
refresh-update: tests for session updates.
-
create-delete: tests for session creation and invalidation.
-
external: tests for external attributes.
-
performance: long tests for performance.
In order to test new versions the following tests should run without errors (twice, one for glassfish V3 and the other for V4):
- Deploy manager-test in non-sticky (192.168.122.21 is non-sticky):
mvn test -Dgroups=blocking,refresh-update,create-delete,external,simplews -DbaseUrl="http://192.168.122.21/manager-test/SessionTest?wsdl"
mvn test -Dgroups=performance -DbaseUrl="http://192.168.122.21/manager-test/SessionTest?wsdl"
- Deploy manager-test in sticky configuration (192.168.122.21):
mvn test -Dgroups=blocking,refresh-update,create-delete,external,simplews -DbaseUrl="http://192.168.122.22/manager-test/SessionTest?wsdl"
mvn test -Dgroups=performance -DbaseUrl="http://192.168.122.22/manager-test/SessionTest?wsdl"
How to install it?
Sticky vs Non-Sticky
[External atttibutes] (wiki/External-Attributes)
[JavaEE session listeners] (wiki/JavaEE-Session-Listeners)
[Compiling from github] (wiki/Compiling-from-github)
couchbase-manager-0.1
couchbase-manager-0.2
couchbase-manager-0.3
couchbase-manager-0.4
couchbase-manager-0.5