Telescope
Developing
Starship Tests

Starship Tests

Starship's setup for testing generated features on a virtual environment.

Starship tests can be found in: 'telescope/packages/starship'.

Dependencies

Dockers

Install and start docker, then check in the panel: "Settings -> Kubernetes" to make sure k8s’s enabled and running.

Cluster tools

Install related cluster tools following the instruction here (opens in a new tab):

  • kind
  • kubectl
  • helm
  • yq

Start Starship

Go to the folder 'telescope/packages/starship'.

  • Double check you do clean up before start, skip this if you're sure previous pods have been cleaned up:
make stop
# using kubectl get pods to know the status of running pods
kubectl get pods
#or keep watching by:
kubectl get pods -w
# wait for "No resources found in default namespace."
  • With these two steps you’re ready to go:
  1. To start pods
make install
# using kubectl get pods to know the status of running pods
kubectl get pods
#or keep watching by:
kubectl get pods -w
# wait for all listed pods running like:
# cosmos-2-genesis-0     3/3
# explorer-5575dc8774-kxs8v  1/1
# etc...
  1. To open ports for access
make port-forward

Generate Code

Setup scripts for generating code in the folder 'telescope/packages/starship/scripts/codegen.js'

Generate code using:

npm run codegen

Code'll be generated in the folder 'telescope/packages/starship/src/codegen'

Test

# do tests, don't run all tests at the same time on your local machine:
# 1 setup:
npx jest __tests__/v1/setup.test.ts
 
# 2 authz:
npx jest __tests__/v1/authz.test.ts

Stop the infra

When tests have finished, better stop the infra for starting successfully next time.

npm run e2e:stop

Which will

  • Stop port-forwarding the traffic to your local
  • Delete all the helm charts deployed

Cleanup kind (optional)

If you are using kind for your kubernetes cluster, you can delete it with

npm run e2e:clean