Skip to content

fakeClient.List tries to populate UnstructuredList with objects of underlying type #1511

@wbrefvem

Description

@wbrefvem

If I have an UnstructuredList with a known GVK, passing it to fakeClient.List returns an error:

item[0]: can't assign or convert unstructured.Unstructured into <myGV>.<myKind> 

Running in the debugger revealed that fakeClient.List passes the underlying type to client-go, which returns a list of the underlying type. So it makes sense that fake client would error when trying to populate the UnstructuredList with objects it gets from client-go.

There should be some way for fakeClient.List to handle Unstructured* objects. IIUC the real client delegates to an unstructured client. That seems heavy-handed here, but it may be the only way to avoid a bunch of spaghetti in fakeClient.List just to handle UnstructuredList as a special case.

This is related to #702 but is not the same issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions