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

Add missing test coverage for azuremanagedcontrolplane_webhook.go

Open willie-yao opened this issue 1 year ago • 6 comments

/kind cleanup

Describe the solution you'd like****Describe the solution you'd like Currently, azuremanagedcontrolplane_webhook.go is missing unit tests in the following areas:

  • validateManagedClusterNetwork() requires a new unit test function:
    • Create a fake client like so: https://github.com/kubernetes-sigs/cluster-api-provider-azure/blob/main/azure/scope/cluster_test.go#L173
    • Test various ownerClusters that are added to the fake client to cover different scenarios in validateManagedClusterNetwork()
  • validateAPIServerAccessProfileUpdate() requires the following test cases to be added to the ValidateUpdate() test:
    • old.Spec.APIServerAccessProfile != nil

Environment:

  • cluster-api-provider-azure version:
  • Kubernetes version: (use kubectl version):
  • OS (e.g. from /etc/os-release):

willie-yao avatar Apr 14 '23 23:04 willie-yao