d-exclaimation / over-layer

A GraphQL over Websocket Stream-based Transport Layer on Akka.
https://overlayer.netlify.app/
Apache License 2.0
2 stars 1 forks source link

Enhancement: Integrate Unit Test #2

Closed d-exclaimation closed 3 years ago

d-exclaimation commented 3 years ago

Description

Adding Unit Tests to the package would be great. Automating that with Github Actions can be also a nice thing to have. At the moment, I have an end-to-end test working but I don't know how to set that one up with Github Actions, but still probably be needing a proper unit test as well.

d-exclaimation commented 3 years ago

Unit Tests

General basic library

  1. ~Library compiles.~
  2. ~Library has no dependencies vunelerabilities.~

Websocket capabilities

  1. Using a simple schema, does OverTransportLayer properly set up Flow.
  2. Using a simple schema, does OverTransportLayer properly respond to subscriptions-transport-ws messages. a. Respond with GQL_CONNECTION_INIT with GQL_CONNECTION_ACK and GQL_CONNECTION_KEEP_ALIVE. b. Handle GQL_START if query is correct and register a stream. c. Able to push GQL_DATA after successful GQL_START. d. Able to stop pushing GQL_DATA after GQL_STOP.
  3. Using a simple schema, does OverTransportLayer properly respond to graphql-ws messages. a. Respond with ConnectionInit with ConnectionAck. b. Handle Subscribe if query is correct and register a stream. c. Able to push Next after successful Subscribe. d. Able to stop pushing Next after Stop. e. Abble to respond to Ping with Pong.
  4. Handle invalid websocket message.

Internal GraphQL API Implementation

  1. Able to resubscribe after unsubscribing or connection lost.
  2. Sync and copy data to all same subscriber ("hot" stream).

Working Examples

  1. "Getting started" guide application work with no issue.
d-exclaimation commented 3 years ago

Testing Actors

What happened?

Testing this package require a lot of setup. My last approaches on testing didn't do that properly for a test environment. Hence, I removed them and opted to the current private end-to-end test system that does test most of the part I need.

What now?

To be fair, Akka has their own test kit combined with Scalatest, which should be something I used to make sure the setup is done properly.

Akka has two ways of testing Asynchronous testing and Behavior synchronous testing. Haven't tried both. Will be experimenting later on see which approaches I should go.

From what I can tell, Async testing will be for individual actors.

I will be closing this issue for now and re-opening it later once I got testing actually working.