groovytron / maracker

API aiming to make Human Brain Project's Medical Informatics Platform's developped apps deployment on Mesos Marathon easier.
0 stars 2 forks source link

Handle non-existent docker image #2

Open groovytron opened 7 years ago

groovytron commented 7 years ago

MipApplication's model is populated using Microbadger's API using the pre_save method. How is it possible to handle a non-existent image and trigger an error?

This part of the logic might have to be moved into the serializer. It's a good idea if the API is called only when the instance needs to be updated or created. Otherwise performances will be affected. It looks like it's only called on creation and update: http://www.django-rest-framework.org/api-guide/serializers/#validation

groovytron commented 7 years ago

Another case could be that either the namespace or the image is empty (or None). Adding a unit test for this case might be needed.

groovytron commented 7 years ago

Also think about making tests at the API level to ensure that the API always answer with a valid HTTP status and the MicrobadgerService does not slows it down too much (thinking about trying to push a non-existent docker image or an image that has been indexed in MicroBadger yet).

How to handle the cases where the image has not been indexed by MicroBadger?

greut commented 7 years ago

Mock! mock! and mock!