Skip to content
This repository was archived by the owner on Nov 3, 2024. It is now read-only.
This repository was archived by the owner on Nov 3, 2024. It is now read-only.

tester package retrieves no objects for List when not providing namespace #68

@jacobdonenfeld

Description

@jacobdonenfeld
func (c *Client) List(ctx context.Context, objList kclient.ObjectList, opts ...kclient.ListOption) error {

...

var ns string
	if listOpts.Namespace != "" {
		ns = listOpts.Namespace
	}

	// put objects into a map because c.objects() returns both created and updated objects, with updates coming after
	// created. this will ensure the last object in is what is returned
	resultObjs := make(map[string]runtime.Object)
	for _, testObj := range c.objects() {
		if testObj.GetNamespace() != ns {
			continue
		}

if a namespace is not provided in ListOptions, it is set to an empty string, which will not match testObj.GetNamespace(), resulting in no items fetched.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions