strip_none

safir.testing.kubernetes.strip_none(model)

Strip None values from a serialized Kubernetes object.

Comparing Kubernetes objects against serialized expected output is a bit of a pain, since Kubernetes objects often contain tons of optional parameters and the to_dict serialization includes every parameter. The naive result is therefore tedious to read or understand.

This function works around this by taking a serialized Kubernetes object and dropping all of the parameters that are set to None. The to_dict form of a Kubernetes object should be passed through it first before comparing to the expected output.

Parmaters

model

Kubernetes model serialized with to_dict.

returns:

Cleaned-up model with None parameters removed.

rtype:

dict

param model:

type model:

dict[str, Any]