argoproj-labs / argoproj-labs/appsource
Create a testing framework for future contributions
- Dominant language
- Go
- Stars
- 25
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
# Summary
Up until now, testing the AppSource controller has been done by spinning up a local (and then containerized) instance of the controller, and attempting to successfully use the sample manifests found in `manifests/samples`. For future contributions — it would be helpful to have a testing framework that tests the controller against a series of Admin ConfigMaps and AppSource instances, both correct and incorrectly defined ones.
# Motivation
Having a uniform way of testing contributions to the project and assuring that every contribution is still meeting the level of correctness previous iterations passed.
# Proposal
Make a script with argument path to a series of test environments (Admin configmaps and AppSource manifests) and expected results (ArgoCD resources that should have been created or errors that should have been popped up)
```bash
# Example path to test env
tests
| test1
| | config
| | | sample_admin_config.yaml
| | instances
| | | sample_appsource_instance1.yaml
| | | sample_appsource_instance2.yaml
| | expected
| | | projects
| | | | expected_argocd_project.yaml
| | | applications
| | | | expected_argocd_application1.yaml
| | | | expected_argocd_application2.yaml
| test2
| | config
| | | sample_admin_config.yaml
| | instances
| | | sample_appsource_instance.yaml
| | expected
| | | projects
| | | | expected_argocd_project.yaml
| | | applications
| | | | # Omitting an expected application/project means you expect it to throw an error
```
- Bool Flag `--local` determines whether the controller should be spun up as a local instance or as a deployment within the cluster.
- Bool flag `--rolling` determines whether the controller and ArgoCD env should be reset after every test or if the test script should just re-apply any manifests found between tests.
# Resources
- [Kubernetes EnvTest, more lightweight way of setting up cluster environment for testing](https://book.kubebuilder.io/reference/envtest.html)
Contributor guide
Research direction
Start by reviewing the current controller workflow and the sample manifests in manifests/samples. Compare the proposed test-directory layout with Kubernetes EnvTest and define how --local and --rolling affect setup and cleanup. Done means the framework exercises valid and invalid Admin ConfigMaps and AppSource instances, verifies expected ArgoCD resources or errors, and supports both reset modes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kubernetes
- Domain
- devops, testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100