kubernetes-sigs / cluster-api-provider-cloudstack

A Kubernetes Cluster API Provider implementation for Apache CloudStack.
https://cluster-api-cloudstack.sigs.k8s.io/
Apache License 2.0
37 stars 35 forks source link

Refactor tests to improve development cycles efficiency #256

Closed chrisdoherty4 closed 8 months ago

chrisdoherty4 commented 1 year ago

/kind feature

Summary

When developers enter the typical development cycle they can experience challenges. This issue outlines some of those challenges with the hope of creating smaller issues to address the concerns.

Development cycle challenges

The use of Ginkgo in unit tests has created hard to follow test logic

When reading the test source developers can find themselves jumping between stacked BeforeEach statements to identify mocking expectations that aren't necessarily obvious in individual tests.

It would be helpful if unit tests were more self contained (using little or no BeforeEach statements spread vertically across the test sources) and/or relied solely on native testing capabilities in the language.

The Makefile test depends on generation and linting

Depending on generation and linting in the test recipe inflates the test cycle. When tests are compiled it will become obvious mocks aren't defined correctly (IDEs may catch the issues earlier). Linting is its own recipe and can be removed from test (again IDEs may highlight linting issues early and the CI will catch them). We may want a recipe that still runs runs the various generation and linting recipes, however its important developers can iterate quickly and the existing setup creates a poor experience.

These concerns are orthogonal to the CI. The CI should run checks to ensure generated sources are up to date and lint the code.

Running individual tests can be challenging

Go developers are usually accustomed to go test. However, go test doesn't work on several of our packages as we've munged integration tests that leverage envtest with unit tests. Consequently unit tests, that are ideally invokable with just go test, can't be run independently. Furthermore, the test recipe doesn't offer a filter for running tests in isolation making it difficult to focus in on problem areas.

The code structure makes adding new tests challenging

The code architecture bundles significant logic into algorithms, particularly in the /pkg/cloud package. In some instances, this may be appropriate, but in others it seems we've exported methods for better testability (code smell). The code could benefit from some restructuring to make it more testable and transitively easier to work with.

k8s-triage-robot commented 10 months ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot commented 9 months ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot commented 8 months ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

k8s-ci-robot commented 8 months ago

@k8s-triage-robot: Closing this issue, marking it as "Not Planned".

In response to [this](https://github.com/kubernetes-sigs/cluster-api-provider-cloudstack/issues/256#issuecomment-2025872567): >The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. > >This bot triages issues according to the following rules: >- After 90d of inactivity, `lifecycle/stale` is applied >- After 30d of inactivity since `lifecycle/stale` was applied, `lifecycle/rotten` is applied >- After 30d of inactivity since `lifecycle/rotten` was applied, the issue is closed > >You can: >- Reopen this issue with `/reopen` >- Mark this issue as fresh with `/remove-lifecycle rotten` >- Offer to help out with [Issue Triage][1] > >Please send feedback to sig-contributor-experience at [kubernetes/community](https://github.com/kubernetes/community). > >/close not-planned > >[1]: https://www.kubernetes.dev/docs/guide/issue-triage/ Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.