brigadecore / brigade

Event-driven scripting for Kubernetes
https://brigade.sh/
Apache License 2.0
2.41k stars 246 forks source link

Test data access code against a live database #1811

Closed krancour closed 2 years ago

krancour commented 2 years ago

⚠️ Important: This issue is currently reserved as a potential Google Summer of Code project. No one should do any work on this without first being formally paired with our project for GSoC'22.

Brigade is composed of many components. Among them, the API server could be considered the platform's brain and central nervous system. The API implements a clean abstraction over underlying services such as our database (MongoDB), our messaging system (Artemis), and our workload execution substrate (Kubernetes). All other Brigade components accomplish most of their work through API calls.

Where integration with the database is concerned, API server code is currently unit-tested against mock implementations of MongoDB client interfaces. These tests have been adequate for asserting that queries and statements are constructed properly (look like we think they should) and that mock query and statement results can be unmarshaled without error into domain types, but this approach cannot assert that DB queries and statement are logically correct and actually achieve the desired results, since a live database would be required to accomplish that. We do also have a suite of integration tests that run against a live instance of Brigade (database and all), but they are closer to end-to-end tests, so they do not isolate data access code. They may detect issues from time to time, but they're a poor way of pinpointing the root cause.

Given the importance of the data access code, we would like to develop a new suite of integration tests directly targeted at that code. These new tests should run against a live (and disposable) MongoDB database and assert that all queries and statements achieve the desired results. If the new suite of tests exposes bugs in the existing data access code, correcting those bugs is within the scope of this project as well.

No significant prior knowledge of Brigade or its codebase is required to work on this issue since the work is highly localized to a few discrete packages. The successful candidate will have strong Go and git skills and at least a working knowledge of Docker, since containers are likely the easiest way to quickly stand up and tear down a disposable test database. Prior knowledge of MongoDB would be an asset, but it is entirely possible that a successful candidate will be able to learn MongoDB as they go.

The expected outcome of this GSoC project is the new test suite merged into Brigade's main branch and fully integrated into our CI/CD processes.

This is estimated to be a low difficulty project that a qualified candidate can complete with roughly 175 hours of effort.

meetguogengli commented 2 years ago

Hey, @krancour I would like to contribute to this issue since GSOC is approaching and the CNCF is one of the orgs I want to apply for. Can you please help me get started so that I can get familiar with the codebase and other things about the project

krancour commented 2 years ago

@meetguogengli please find me on the Kubernetes slack if you've got specific questions.

meetguogengli commented 2 years ago

Hi @krancour, I just added you on slack. Can you see my message?

krancour commented 2 years ago

This has not been selected as a GSOC project, so I am going to decompose this epic-sized issue into much smaller ones and then close this one.