Skip to content

cdsbalancer: priority LB name generation logic creates new names everytime when the EDS resource has no localities #8994

@easwars

Description

@easwars

This unit test can help repro the problem:

func (s) TestNameGenerator_Generate_EmptyLocalities(t *testing.T) {
    ng := newNameGenerator(0)
    // Repeated calls to generate with an empty list of localities should generate the same single name.
    for i := 0; i < 5; i++ {
        if diff := cmp.Diff(ng.generate([][]xdsresource.Locality{{}}), []string{"priority-0-0"}); diff != "" {
            t.Errorf("generate() = got: %v, want: %v, diff (-got +want): %s", ng.generate(nil), []string{"priority-0-0"}, diff)
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions