Running end-to-end tests

The next step is to make your plugin being used. For development purposes, we offer an open source test harness which, by default:

  • Launches a local copy of Channel manager
  • Uses environment variables to configure your running plugin
  • Maps a random product
  • Checks availability for the above product for one month ahead
  • Makes a booking for random day available
  • Cancels the above booking

The above could be done by running the following commands:

First, check the test harness and build it:

> git clone git@github.com:Bokun/inventory_plugin_harness.git

> cd <your harness root directory>

> ./gradlew build

Second, export necessary parameter for IS to know where to connect to:

> export PLUGIN_URL=localhost:8080

Third, export parameters to configure the plugin itself, as defined in the SamplePlugin.Configuration class:

> export PLUGIN_CONFIG_SAMPLE_API_SCHEME=https

> export PLUGIN_CONFIG_SAMPLE_API_HOST=your.host.com

> export PLUGIN_CONFIG_SAMPLE_API_PORT=443

> export PLUGIN_CONFIG_SAMPLE_API_PATH=/posts

> export PLUGIN_CONFIG_SAMPLE_API_USERNAME=test

> export PLUGIN_CONFIG_SAMPLE_API_PASSWORD=test

Finally, just run the test harness itself:

> ./gradlew run --args="-grpc"

or

> ./gradlew run --args="-rest"

This should produce a lot of output but a successful run should end with:

2018-01-11 14:16:59,425 INFO CreateReservationAction:70 - Success for ::createReservation@localhost:8080 2018-01-11 14:16:59,428 INFO Harness:227 - Successfully reserved booking successfulReservation { reservationConfirmationCode: "f780f1a7-e276-4d43-8ba3-302fe2425c93" } 2018-01-11 14:16:59,430 INFO ConfirmBookingAction:40 - Calling ::confirmBooking@localhost:8080 2018-01-11 14:16:59,449 INFO ConfirmBookingAction:70 - Success for ::confirmBooking@localhost:8080 2018-01-11 14:16:59,459 INFO Harness:249 - Successfully confirmed booking successfulBooking { bookingConfirmationCode: "170cb543-231a-4aa0-a1f5-93b375786f48" bookingTicket { qrTicket { ticketBarcode: "170cb543-231a-4aa0-a1f5-93b375786f48_ticket" } } } 2018-01-11 14:16:59,461 INFO CancelBookingAction:40 - Calling ::cancelBooking@localhost:8080 2018-01-11 14:16:59,473 INFO CancelBookingAction:70 - Success for ::cancelBooking@localhost:8080 2018-01-11 14:16:59,475 INFO Harness:261 - Successfully cancelled booking successfulCancellation { } 2018-01-11 14:16:59,476 INFO Harness:262 - Exiting…

There are a few extra environment variables which can optionally be enabled for TLS/SSL and/or shared secret support:

  • USE_TLS=true - for the harness tool to use TLS/SSL
  • SSL_CERT_FILE=/path/to/certificate.crt - for the harness tool to use your self-signed or otherwise untrusted certificate
  • SHARED_SECRET=yourVerySecureString - for the harness tool to use the secret when authenticating with the plugin
Did this answer your question?
😞
😐
🤩