rest: add tests for read and list in readclient pkg#231
Conversation
6eed322 to
13c769f
Compare
| // mapper expects to be called once. | ||
| // It returns the list of mapped workspaces (just objectmeta) |
There was a problem hiding this comment.
These two lines are over-indented.
There was a problem hiding this comment.
this also happens below, but it's done by go fmt itself
| Expect(err).ToNot(HaveOccurred()) | ||
| Expect(actualWorkspaces.Items).To(HaveLen(1)) | ||
| Expect(actualWorkspaces.Items[0].ObjectMeta).To(Equal(expectedObjectMeta)) | ||
| }) |
There was a problem hiding this comment.
I think we might need two more happy-path tests:
- More than one workspace matches the label selector.
- No workspaces match the label selector.
Thoughts?
There was a problem hiding this comment.
good idea, let me work on this two test cases
| Expect(err).NotTo(HaveOccurred()) | ||
| Expect(returnedWorkspace).To(Equal(mappedWorkspace)) | ||
| // test data is deepcopied | ||
| Expect(&returnedWorkspace).NotTo(BeIdenticalTo(&mappedWorkspace)) |
There was a problem hiding this comment.
I'm not convinced this check is correct. Both returnedWorkspace and mappedWorkspace are distinct variables defined in this scope, so taking their addresses and comparing them will always be a false comparison (so this check will always pass).
|
Also looks like it's got a merge conflict that needs to be resolved. |
Signed-off-by: Francesco Ilario <filario@redhat.com>
f3fc815 to
f52f7a1
Compare
Signed-off-by: Francesco Ilario <filario@redhat.com>
| oww := make([]metav1.ObjectMeta, len(actualWorkspaces.Items)) | ||
| for i, w := range actualWorkspaces.Items { | ||
| oww[i] = w.ObjectMeta | ||
| } | ||
| Expect(oww).To(BeEquivalentTo(expectedObjectMetas)) |
There was a problem hiding this comment.
I have a way of doing this without copying the ObjectMeta fields out, but it's longer than this. This is more than fine for now.
Signed-off-by: Francesco Ilario <filario@redhat.com>
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: filariow, sadlerap The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Signed-off-by: Francesco Ilario filario@redhat.com