var img = document.createElement('img'); img.src = "https://terradocs.matomo.cloud//piwik.php?idsite=2&rec=1&url=https://feather.terra.money" + location.pathname; img.style = "border:0"; img.alt = "tracker"; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(img,s);
Skip to main content

Testing Feather

Unit tests​

To run all go unit tests *_test.go in the cli directory:


go test ./...

Integration tests​

The main integration test is between Feather CLI and the Coordinator smart contract (currently deployed on pisco-1) which lives in the coordinator directory.

You must uncomment t.Skip() before running the test or the test is simply skipped. It prevents integration tests being run with unit tests during go test ./... (until a better way is found).


go test -run ^TestTerraClient$ github.com/terra-money/feather/internal/pkg/terra

E2E tests​

Involves:

  1. Starting Feather daemon
  2. Starting the autoapprover, which polls and approves chain join requests as they arrive
  3. Publishing a chain (which Feather Daemon subscribes to)
  4. Signing MsgDelegate transactions that the chain deployer must do before chain launch with the feather chaindeployer admin command
  5. Verifying the chain successfully on the Kubernetes Cluster
  6. Cleanup and deleting all Kubernetes resources

Running autoapprover​

To use autoapprover, install Feather with the dev-facing commands:


make install-dev

Then, simply run:


feather start-autoapprover --key <key> --launch-id <launch_id>

Note that --key must be the same as the key used to create the launch --launch-id

Resetting persistent state​

To reset Feather to a clean slate, do the following:

  1. Delete feather launch configs: rm -rf ~/.feather/launches
  2. Delete k8s secrets: kubectl -n feather get secret and kubectl -n feather delete secret ...
  3. Delete k8s services: kubectl -n feather get service and kubectl -n feather delete service ...
  4. Delete k8s stateful sets: kubectl -n feather get statefulset and kubectl -n feather delete statefulset ...
  5. Delete k8s persistent volume claims: kubectl -n feather get persistentvolumeclaim and kubectl -n feather delete persistentvolumeclaim ...
  6. Start feather daemon with the --reset flag enabled (clears crash recovery checkpoints/action logs)

Mocking interfaces​

It is recommended to use mockgen to generate mocks for interfaces.

  1. Install mockgen according to https://github.com/uber-go/mock
  2. Generate mock e.g. internal/pkg/lcd/lcd_mock.go

# The working directory affects what source path is used in the generated file
cd internal/pkg/lcd
mockgen -source=./lcd.go -destination=./lcd_mock.go -package=lcd -typed