Add custom matcher for verifying generator function replacement
This MR was part of !62 (closed)
This MR provides a custom matcher, SatisfyReplacement
, that can be used to programmatically verify the replacement of the generator function. A basic implementation of the matcher is provided.
Here is an example:
generated := gitlabctl.ShellDeployment(gitlab)
templated := template.Query().DeploymentByComponent("gitlab-shell")
Expect(templated).NotTo(BeNil())
Expect(templated).To(SatisfyReplacement(generated))
/* ignore specific fields, e.g. ObjectMeta.Name and ObjectMeta.Labels, etc. */
Expect(templated).To(
SatisfyReplacement(generated,
IgnoreFields(metav1.ObjectMeta{}, "Name", "Labels"),
IgnoreFields(appsv1.DeploymentSpec{}, "Strategy")))
Related to #33 (closed)
Edited by Hossein Pursultani