Open ross-p-smith opened 9 months ago
Extra information. We cannot enable the ProductPolicy and ProductApi samples test until the Product sample is enabled. If we enable the Product sample test then this is the output of the integration test
[controller:test-integration-envtest] logr.go:284: I2023-12-19T14:42:58Z] ProductController "msg"="Encountered error, re-queuing..." name="asotestaachpc" namespace="aso-test-samples-creationanddeletion-test-apimanagement-v-88dd7" result=reconcile.Result{Requeue:false, RequeueAfter:60000000000}
[controller:test-integration-envtest] kube_per_test_context.go:548:
[controller:test-integration-envtest] Timed out after 1800.000s.
[controller:test-integration-envtest] Expected
[controller:test-integration-envtest] <*v1api20220801.Product | 0xc002055180>: {
[controller:test-integration-envtest] TypeMeta: {Kind: "", APIVersion: ""},
[controller:test-integration-envtest] ObjectMeta: {
[controller:test-integration-envtest] Name: "asotestaachpc",
[controller:test-integration-envtest] GenerateName: "",
[controller:test-integration-envtest] Namespace: "aso-test-samples-creationanddeletion-test-apimanagement-v-88dd7",
[controller:test-integration-envtest] SelfLink: "",
[controller:test-integration-envtest] UID: "7e47404a-6b38-4b0d-9c7b-4a057af651b8",
[controller:test-integration-envtest] ResourceVersion: "1421",
[controller:test-integration-envtest] Generation: 2,
[controller:test-integration-envtest] CreationTimestamp: {
[controller:test-integration-envtest] Time: 2023-12-19T13:46:49Z,
[controller:test-integration-envtest] },
[controller:test-integration-envtest] DeletionTimestamp: {
[controller:test-integration-envtest] Time: 2023-12-19T14:13:25Z,
[controller:test-integration-envtest] },
[controller:test-integration-envtest] DeletionGracePeriodSeconds: 0,
[controller:test-integration-envtest] Labels: {
[controller:test-integration-envtest] "serviceoperator.azure.com/owner-group-kind": "Service.apimanagement.azure.com",
[controller:test-integration-envtest] "serviceoperator.azure.com/owner-name": "asotestxrhkfo",
[controller:test-integration-envtest] },
[controller:test-integration-envtest] Annotations: {
[controller:test-integration-envtest] "serviceoperator.azure.com/latest-reconciled-generation": "1",
[controller:test-integration-envtest] "serviceoperator.azure.com/resource-id": "/subscriptions/xxxx/resourceGroups/asotest-rg-nnxzgr/providers/Microsoft.ApiManagement/service/asotestxrhkfo/products/asotestaachpc",
[controller:test-integration-envtest] },
[controller:test-integration-envtest] OwnerReferences: [
[controller:test-integration-envtest] {
[controller:test-integration-envtest] APIVersion: "apimanagement.azure.com/v1api20220801storage",
[controller:test-integration-envtest] Kind: "Service",
[controller:test-integration-envtest] Name: "asotestxrhkfo",
[controller:test-integration-envtest] UID: "3b626492-8cf8-4b59-bed8-5d8740d28a9a",
[controller:test-integration-envtest] Controller: nil,
[controller:test-integration-envtest] BlockOwnerDeletion: nil,
[controller:test-integration-envtest] },
[controller:test-integration-envtest] ],
[controller:test-integration-envtest] Finalizers: [
[controller:test-integration-envtest] "serviceoperator.azure.com/finalizer",
[controller:test-integration-envtest] ],
[controller:test-integration-envtest] ManagedFields: [
[controller:test-integration-envtest] {
[controller:test-integration-envtest] Manager: "controllers.test",
[controller:test-integration-envtest] Operation: "Update",
[controller:test-integration-envtest] APIVersion: "apimanagement.azure.com/v1api20220801",
[controller:test-integration-envtest] Time: {
[controller:test-integration-envtest] Time: 2023-12-19T13:46:49Z,
[controller:test-integration-envtest] },
[controller:test-integration-envtest] FieldsType: "FieldsV1",
[controller:test-integration-envtest] FieldsV1: {
[controller:test-integration-envtest] Raw: "{\"f:spec\":{\".\":{},\"f:description\":{},\"f:displayName\":{},\"f:owner\":{\".\":{},\"f:name\":{}},\"f:subscriptionRequired\":{}}}",
[controller:test-integration-envtest] },
[controller:test-integration-envtest] Subresource: "",
[controller:test-integration-envtest] },
[controller:test-integration-envtest] {
[controller:test-integration-envtest] Manager: "controllers.test",
[controller:test-integration-envtest] Operation: "Update",
[controller:test-integration-envtest] APIVersion: "apimanagement.azure.com/v1api20220801storage",
[controller:test-integration-envtest] Time: {
[controller:test-integration-envtest] Time: 2023-12-19T14:09:57Z,
[controller:test-integration-envtest] },
[controller:test-integration-envtest] FieldsType: "FieldsV1",
[controller:test-integration-envtest] FieldsV1: {
[controller:test-integration-envtest] Raw: "{\"f:metadata\":{\"f:annotations\":{\".\":{},\"f:serviceoperator.azure.com/latest-reconciled-generation\":{},\"f:serviceoperator.azure.com/resource-id\":{}},\"f:finalizers\":{\".\":{},\"v:\\\"serviceoperator.azure.com/finalizer\\\"\":{}},\"f:labels\":{\".\":{},\"f:serviceoperator.azure.com/owner-group-kind\":{},\"f:serviceoperator.azure.com/owner-name\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"3b626492-8cf8-4b59-bed8-5d8740d28a9a\\\"}\":{}}}}",
[controller:test-integration-envtest] },
[controller:test-integration-envtest] Subresource: "",
[controller:test-integration-envtest] },
[controller:test-integration-envtest] {
[controller:test-integration-envtest] Manager: "controllers.test",
[controller:test-integration-envtest] Operation: "Update",
[controller:test-integration-envtest] APIVersion: "apimanagement.azure.com/v1api20220801storage",
[controller:test-integration-envtest] Time: {
[controller:test-integration-envtest] Time: 2023-12-19T14:17:33Z,
[controller:test-integration-envtest] },
[controller:test-integration-envtest] FieldsType: "FieldsV1",
[controller:test-integration-envtest] FieldsV1: {
[controller:test-integration-envtest] Raw: "{\"f:status\":{\"f:approvalRequired\":{},\"f:conditions\":{},\"f:description\":{},\"f:displayName\":{},\"f:id\":{},\"f:name\":{},\"f:state\":{},\"f:subscriptionRequired\":{},\"f:type\":{}}}",
[controller:test-integration-envtest] },
[controller:test-integration-envtest] Subresource: "status",
[controller:test-integration-envtest] },
[controller:test-integration-envtest] ],
[controller:test-integration-envtest] },
[controller:test-integration-envtest] Spec: {
[controller:test-integration-envtest] ApprovalRequired: nil,
[controller:test-integration-envtest] AzureName: "asotestaachpc",
[controller:test-integration-envtest] Description: "A product for customer 1",
[controller:test-integration-envtest] DisplayName: "Customer 1",
[controller:test-integration-envtest] Owner: {
[controller:test-integration-envtest] Name: "asotestxrhkfo",
[controller:test-integration-envtest] ARMID: "",
[controller:test-integration-envtest] },
[controller:test-integration-envtest] State: nil,
[controller:test-integration-envtest] SubscriptionRequired: true,
[controller:test-integration-envtest] SubscriptionsLimit: nil,
[controller:test-integration-envtest] Terms: nil,
[controller:test-integration-envtest] },
[controller:test-integration-envtest] Status: {
[controller:test-integration-envtest] ApprovalRequired: false,
[controller:test-integration-envtest] Conditions: [
[controller:test-integration-envtest] {
[controller:test-integration-envtest] Type: "Ready",
[controller:test-integration-envtest] Status: "False",
[controller:test-integration-envtest] Severity: "Warning",
[controller:test-integration-envtest] LastTransitionTime: {
[controller:test-integration-envtest] Time: 2023-12-19T14:17:33Z,
[controller:test-integration-envtest] },
[controller:test-integration-envtest] ObservedGeneration: 2,
[controller:test-integration-envtest] Reason: "Failed",
[controller:test-integration-envtest] Message: "failed to delete product \"asotestaachpc\": DELETE https://management.azure.com/subscriptions/xxxx/resourceGroups/asotest-rg-nnxzgr/providers/Microsoft.ApiManagement/service/asotestxrhkfo/products/asotestaachpc\n--------------------------------------------------------------------------------\nRESPONSE 404: 404 Not Found\nERROR CODE: ResourceGroupNotFound\n--------------------------------------------------------------------------------\n{\n \"error\": {\n \"code\": \"ResourceGroupNotFound\",\n \"message\": \"Resource group 'asotest-rg-nnxzgr' could not be found.\"\n }\n}\n--------------------------------------------------------------------------------\n",
[controller:test-integration-envtest] },
[controller:test-integration-envtest] ],
[controller:test-integration-envtest] Description: "A product for customer 1",
[controller:test-integration-envtest] DisplayName: "Customer 1",
[controller:test-integration-envtest] Id: "/subscriptions/xxxx/resourceGroups/asotest-rg-nnxzgr/providers/Microsoft.ApiManagement/service/asotestxrhkfo/products/asotestaachpc",
[controller:test-integration-envtest] Name: "asotestaachpc",
[controller:test-integration-envtest] State: "notPublished",
[controller:test-integration-envtest] SubscriptionRequired: true,
[controller:test-integration-envtest] SubscriptionsLimit: nil,
[controller:test-integration-envtest] Terms: nil,
[controller:test-integration-envtest] Type: "Microsoft.ApiManagement/service/products",
[controller:test-integration-envtest] },
[controller:test-integration-envtest] }
[controller:test-integration-envtest] to be deleted
[controller:test-integration-envtest] --- FAIL: Test_Samples_CreationAndDeletion (0.00s)
[controller:test-integration-envtest] --- FAIL: Test_Samples_CreationAndDeletion/Test_Apimanagement_v1api20220801_CreationAndDeletion (3424.36s)
[controller:test-integration-envtest] FAIL
[controller:test-integration-envtest] FAIL github.com/Azure/azure-service-operator/v2/internal/controllers 3425.551s
[controller:test-integration-envtest] FAIL
I think that the resource group is being deleted before apim; and because product is a child of the apim, it doesn't know that it's been deleted. Is there a way to force the delete order?
I notice that in https://github.com/Azure/azure-service-operator/blob/d037d2b5dec18ae7d9dd587e923333da91bad57c/v2/internal/testcommon/samples_tester.go#L221 we only set the owner if it's a resource group. Could/Should this be amended to allow for child resourcesof apim?
PR #3552 enables ProductPolicy and ProductApi. However, the samples tests are commented out because they take a long time to provision APIM.
Describe the improvement In
v2/internal/testcommon/samples_tester.go
there are some exclusions defined on L62 - we should capture recordings for these.Additional context You will need to delete the recording and re-record after removing these exclusions.