Skip to content

Commit

Permalink
Fix broken documentation link (#4004)
Browse files Browse the repository at this point in the history
* Improve headers for debugging logs

* Fix broken link

* Fix paragraph formatting
  • Loading branch information
theunrepentantgeek authored May 9, 2024
1 parent b521df8 commit 74baaec
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,13 @@ WorkspaceProperties:

## Write a CRUD test for the resource

The best way to do this is to start from an [existing test](https://github.com/Azure/azure-service-operator/blob/main/v2/internal/controllers/crd_cosmosdb_mongodb_test.go) and modify it to work for your resource. It can also be helpful to refer to examples in the [ARM templates GitHub repo](https://github.com/Azure/azure-quickstart-templates).
The best way to do this is to start from an [existing test](https://github.com/Azure/azure-service-operator/blob/main/v2/internal/controllers/documentdb_mongodb_crud_v20231115_test.go) and modify it to work for your resource. It can also be helpful to refer to examples in the [ARM templates GitHub repo](https://github.com/Azure/azure-quickstart-templates).

Every new resource should have a handwritten test as there is always the possibility that the way a particular resource provider behaves will change with a new version.

Given that we don't want to have to maintain tests for every version of every resource, and each additional test makes our CI test suite take lo
nger, consider removing tests for older versions of resources when we add tests for newer versions. This is a judgment call, and we recommend di
scussion with the team first.
Given that we don't want to have to maintain tests for every version of every resource, and each additional test makes our CI test suite take
longer, consider removing tests for older versions of resources when we add tests for newer versions. This is a judgment call, and we recommend
discussion with the team first.

As an absolute minimum, we want to have tests for

Expand Down
13 changes: 10 additions & 3 deletions v2/internal/testcommon/kube_per_test_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,16 @@ func (tc *KubePerTestContext) CreateTestResourceGroupAndWait() *resources.Resour
// CreateResource creates a resource and registers it for cleanup. It does not wait for the resource
// to be created, use CreateResourceAndWait for that
func (tc *KubePerTestContext) CreateResource(obj client.Object) {
tc.LogSubsectionf(
"Creating resource %s",
obj.GetName())
if arm, ok := obj.(genruntime.ARMMetaObject); ok {
tc.LogSubsectionf(
"Creating %s resource %s",
arm.GetType(),
obj.GetName())
} else {
tc.LogSubsectionf(
"Creating resource %s",
obj.GetName())
}

tc.CreateResourceUntracked(obj)
tc.registerCleanup(obj)
Expand Down

0 comments on commit 74baaec

Please sign in to comment.