cluster-api-provider-azure icon indicating copy to clipboard operation
cluster-api-provider-azure copied to clipboard

Add unit tests for kubebuilder validation annotations

Open invidian opened this issue 3 years ago • 14 comments

/kind feature

Describe the solution you'd like

Right now, the following code: https://github.com/kubernetes-sigs/cluster-api-provider-azure/blob/c5b5f632207a9a9595728d544bbd6655dc5e4193/api/v1beta1/azureimage_validation.go#L100-L116 could be completely removed, as there are kubebuilder type annotations already which enforce those rules: https://github.com/kubernetes-sigs/cluster-api-provider-azure/blob/c5b5f632207a9a9595728d544bbd6655dc5e4193/api/v1beta1/types.go#L332-L347 However, within existing test coverage, the webhooks are not really executed, so those annotations cannot be tested.

Perhaps similar approach should be used as in CAPA, where test cluster is being used to validate types, which properly use webhooks: https://github.com/kubernetes-sigs/cluster-api-provider-aws/blob/913ee944c83f94549f4ebd0afc618e0bf7053598/api/v1beta1/awscluster_webhook_test.go#L36-L261

The disadvantage of such though, is that for running those tests, extra binaries will be needed, as etcd and kube-apiserver will be running locally, which brings it's own set of issues (e.g. https://github.com/kubernetes-sigs/cluster-api/issues/4278)

Anything else you would like to add:

Found while working on #2277.

invidian avatar May 09 '22 07:05 invidian

NOTE: To avoid making default developer experience more complex, webhook tests can be put behind a build tag like integration, so they are not run by default, but can always be run on CI for example.

invidian avatar May 15 '22 15:05 invidian

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

This bot triages issues and PRs 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:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

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

/lifecycle stale

k8s-triage-robot avatar Aug 13 '22 15:08 k8s-triage-robot

/remove-lifecycle stale

invidian avatar Aug 13 '22 20:08 invidian

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

This bot triages issues and PRs 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:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

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

/lifecycle stale

k8s-triage-robot avatar Nov 11 '22 20:11 k8s-triage-robot

/remove-lifecycle stale

invidian avatar Nov 12 '22 08:11 invidian

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

This bot triages un-triaged 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:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

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

/lifecycle stale

k8s-triage-robot avatar Feb 10 '23 08:02 k8s-triage-robot

/remove-lifecycle stale

invidian avatar Feb 10 '23 08:02 invidian

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

This bot triages un-triaged 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:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

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

/lifecycle stale

k8s-triage-robot avatar May 11 '23 09:05 k8s-triage-robot

/remove-lifecycle stale

invidian avatar May 11 '23 10:05 invidian

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

This bot triages un-triaged 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:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

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

/lifecycle stale

k8s-triage-robot avatar Jan 20 '24 02:01 k8s-triage-robot

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:

  • 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:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

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

/lifecycle rotten

k8s-triage-robot avatar Feb 19 '24 03:02 k8s-triage-robot

/remove-lifecycle rotten

nawazkh avatar Feb 20 '24 19:02 nawazkh

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

This bot triages un-triaged 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:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

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

/lifecycle stale

k8s-triage-robot avatar May 20 '24 20:05 k8s-triage-robot