Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[test helper] fix nad test helper to return valid json config #581

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/common/test/helpers/networkattachmentdefinition.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (tc *TestHelper) CreateNetworkAttachmentDefinition(name types.NamespacedNam
Namespace: name.Namespace,
},
Spec: networkv1.NetworkAttachmentDefinitionSpec{
Config: "",
Config: `{}`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

empty string isn't a valid json object I assume?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, unmarshal it as part of https://github.com/openstack-k8s-operators/lib-common/blob/main/modules/common/networkattachment/networkattachment.go#L158 would fail with:

  2024-11-13T15:33:24+01:00     ERROR   Reconciler error        {"controller": "cinder", "controllerGroup": "cinder.openstack.org", "controllerKind": "Cinder", "Cind
er": {"name":"cinder-6af4b","namespace":"4eed3b56-5a11-486a-a472-00a9499f9289"}, "namespace": "4eed3b56-5a11-486a-a472-00a9499f9289", "name": "cinder-6af4b", "reconcileID": "526ff203-812e-4e6e-9608-7f1a28b8084b", "error": "failed create network annotation from [internalapi]: failed to unmarshal JSON data: unexpected end of JSON input"} 

},
}
gomega.Expect(tc.K8sClient.Create(tc.Ctx, instance)).Should(gomega.Succeed())
Expand Down
Loading