Note: in this case, the behavior is even asynchronous, and thus a tool "asyncFn" is used to keep the test as simple as possible.
Co-authored-by: Janne Savolainen <janne.savolainen@live.fi>
Signed-off-by: Mikko Aspiala <mikko.aspiala@gmail.com>
This is a kludge because extraction of segregated interface for KubeObject is very difficult. This commit uses actual instance of KubeObject instead as a fake.
Signed-off-by: Janne Savolainen <janne.savolainen@houston-inc.com>
Notice how interface is in fact segregated, i.e. it only advertises the minimal properties currently required.
With this we satisfy Interface Segregation Principle and thus permit e.g. minimal requirement for stubbing in future unit tests.
Signed-off-by: Janne Savolainen <janne.savolainen@houston-inc.com>
This is to make a step towards satisfaction of Dependency Inversion Principle. It's not fully satisfied because we still depend on concrete instances of classes instead of interfaces.
This will start chain of thought to pursue warm and friendly unit testing and introduction of SOLID principles.
Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com>
This was done in a naive way by disregarding stuff such as:
- Avoidance of shared global state (dependency inversion principle)
- Unit testing
- Minimal implementation over defensive code (elvis, just in case)
- Full understanding for use cases of all different kube objects
Signed-off-by: Janne Savolainen <janne.savolainen@houston-inc.com>
* refactor kube api to common
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
* refactor more utils to common
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
* refactor more utils to common
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
* fix tests
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
* switch to use node-fetch on both sides
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
* cleanup
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
* improve logger
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
* fix lint errors
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
* fix/improve tests
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
* fix tests
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
* fix node-fetch require error on prod build
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
* preload fix
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
* fixes
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
* read serverAddress from apiBase
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
* cleanup
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>