Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

☂️ Build out tests and test infrastructure so we can deploy with confidence (umbrella issue) #102

Open
2 of 6 tasks
joostdecock opened this issue Dec 2, 2024 · 0 comments
Labels

Comments

@joostdecock
Copy link
Member

joostdecock commented Dec 2, 2024

This is an umbrella issue for the high-level goal of being able to automatically run (integration) tests so we can build new releases and deploy with confidence.

Next steps

History

When we initially started working on Morio, we created unit tests for both the core and api REST APIs.
Running these tests was always a bit of a hassle because these services run in containers that (in the case of core) spawn other containers, but we made it work, somewhat.

Things got more complicated once we added support for clustering. For starters, the core service now has 3 main tasks:

  • Resolve the configuration, make sure everything is as we want it
  • Run the core REST API
  • Handle inter-node cluster communication and keep the cluster state

The core REST API unit tests really only cover the second item on that list, with a bit of the first.
Testing the code that handles the clustering part is non-trivial, and mocking all of the moving parts seems like it would be a lot.

So, we kicked the can down the road thinking we would run unit tests for what we can test locally, and run integration tests for the rest.

Goals

Unit tests

We should not abondon unit tests altogether. They are still the fastest feedback loop available for developers to know that their code does what it should and, crucially, that a change does not introduce a regression.

Currently, the unit tests for both the core and api REST APIs lag behind changes. Which is not so surprising since we're still in alpha.

We should get this back up and running and, crucially, we should figure out how we can run these unit tests in CI.
However, GitHub actions won't grant access to the docker socket, so we need to find a workaround for this. Either mocking everything around core, or perhaps we can bring our own runner where we can map the docker socket.

Integration tests

To get closer to a real world scenario, we also need to run end-to-end test.
I'm open to suggestions, but I imaging something like this:

Single node

  • Trigger happens (we should be able to run this manually, or ideally from a pull request that has a specific label or comment)
  • A new VM is deployed on AWS (For this, I think terraform is the obvious choice)
  • Morio is installed on it from the build artifacts (from the .deb package) (perhaps ansible for this?)
  • We run one or many ansible playbooks to test what needs testing
  • We report back the results of the tests
  • We destroy the new VM that was created

Clustering

  • We should be able to run all the steps above for a 3, 5, 7, and 9-node cluster
  • While we probably want to test things on a 3-node cluster, we should at least have the option to test on different cluster sizes too, even if we don't do it every time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant