WriteOnlyProperty removed before calling a Delete handler - Contract tests failure due to language specific plugin
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 42/100
Línea de trabajo
Empieza leyendo el flujo de pruebas del contrato descrito en el issue y la documentación del contrato de tipo de recurso de CloudFormation enlazada allí, especialmente los requisitos de eliminación. Después, sigue el recorrido para determinar dónde se eliminan las writeOnlyProperties y dónde se valida la solicitud de eliminación en este plugin de Java. El trabajo estará terminado cuando el controlador de eliminación reciba la propiedad write-only requerida, o cuando se evite adecuadamente la validación de propiedades requeridas, y la prueba contract_create_delete pase.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Hi,
My resource has a property "SchemaHandlerPackage", which is both a required property and a writeOnlyProperty. I am running contract_create_delete on my resource. The create handler is invoked and returns success after creating the resource. I return all required properties and the primary ID in the resourceModel after creating the resource.
My create handler returns IN_PROGRESS two times because it takes sometime to create the resource. For these two calls, I see the "SchemaHandlerPackage" in the response(because I return it in the intermediate response as well), something like this(in rpdk.log):
[2020-10-19T19:46:46Z] DEBUG - Received response
{
'status': 'IN_PROGRESS',
'callbackContext': {removed the values here},
'callbackDelaySeconds': 5,
'resourceModel': {
'Arn': 'arn:aws:cloudformation:us-west-2:336098619110:type/resource/Organization-Service-Resource17/00000033',
'SchemaHandlerPackage': 's3: //cloudformationsampleresourcetype/organization-service-resource17.zip',
'TypeName': 'Organization::Service::Resource17'
}
}
But when the handler returns success, the "SchemaHandlerPackage" is disappeared from the response, even though I set it in the code:
[2020-10-19T19:47:32Z] DEBUG - Received response{
'status': 'SUCCESS',
'callbackDelaySeconds': 0,
'resourceModel': {
'Arn': 'arn:aws:cloudformation:us-west-2:336098619110:type/resource/Organization-Service-Resource17/00000033',
'Description': 'Anexampleresourceschemademonstratingsomebasicconstructsandvalidationrules.',
'IsDefaultVersion': False,
'LastUpdated': '2020-10-19T19: 46: 50.047Z',
'ProvisioningType': 'FULLY_MUTABLE',
'Schema': {},
'SourceUrl': 'https: //github.com/aws-cloudformation/aws-cloudformation-rpdk.git',
'TimeCreated': '2020-10-19T19: 46: 50.047Z',
'TypeName': 'Organization::Service::Resource17',
'VersionId': '00000033',
'Visibility': 'PRIVATE'
}
}
I later found out that the writeOnlyProperties are removed before framing the request to the delete handler. By doing this, the writeOnlyProperty, which is also a required property is getting removed, hence the delete handler fails due to a validation error, which results in that contract test failure.
[2020-10-19T19:48:07Z] DEBUG - Received response
{'status': 'FAILED', 'errorCode': 'InvalidRequest', 'message': 'Model validation failed (#: required key [SchemaHandlerPackage] not found)', 'callbackDelaySeconds': 0}
[2020-10-19T19:48:08Z] DEBUG - Caught exit recommendation
Solution: Is the "required property validation" necessary for a delete handler? Checking for a Primary Id should be enough for a delete handler as per https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-type-test-contract.html#resource-type-test-contract-delete Or you can remove a writeOnlyProperty only if it's not a required property.
Thanks,
Uma
- Lenguaje dominante
- Java
- Estrellas
- 30
- Forks
- 48
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de aws-cloudformation/cloudformation-cli-java-plugin
-
Runtime compatibility issue Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
aws-cloudformation/cloudformation-cli-java-plugin#415 · 1 comentario ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 42/100
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 20/100
-
injectCredentialsAndInvokeV2 method in proxy class doesn't support API's like PutObject from S3. Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
Todos los issues de aws-cloudformation/cloudformation-cli-java-plugin
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
checkstyle/test-configs#263 ·
-
bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
apache/cloudstack#14222 ·
-
[BUG]茶杯方块在取茶时会引发崩溃 Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
-
Cannot differ own consent and managed consents in My Consents view and detailed consent view. Abierto1.0.0-alpha2 Type/Improvement
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
wso2/dpdp-accelerator#272 ·