Skip to content

bug: E2E pagination test intermittently fails with incorrect exporter count #415

@ambient-code

Description

@ambient-code

Summary

The pagination E2E test (test 45) intermittently fails at [ "$count" -eq 101 ] — the count of exporters returned by jmp get exporters -o yaml does not equal 101.

Observed Failure

The test creates 101 exporters labeled pagination=true, then lists them and counts name: lines in the YAML output:

count=$(echo "$output" | grep -c '^ *name:')
[ "$count" -eq 101 ]  # FAILS

Example CI run: https://github.com/jumpstarter-dev/jumpstarter/actions/runs/24060390906/job/70175302716?pr=254

Likely Causes

1. Nested name: fields in YAML inflate the count

If the exporter YAML includes a nested credential: {name: ...} field per exporter, each exporter contributes 2 lines matching ^ *name: instead of 1, making the count ~202 instead of 101. The test's grep-based counting approach is fragile.

2. Exporter creation failures under controller load

The race condition introduced by PR #397 (see #414) causes exporter reconnect churn that may overload the controller during the 101-exporter creation loop. If any create exporter call times out or fails, fewer than 101 exporters are created and the count check fails intermittently.

Proposed Fix

Replace the fragile grep -c '^ *name:' count with a more specific selector that only matches top-level exporter names, for example counting unique exporter entries or using yq to extract the list length:

# Instead of:
count=$(echo "$output" | grep -c '^ *name:')

# Use yq to count top-level items:
count=$(echo "$output" | yq '. | length')

Or alternatively structure the test to count items at the correct YAML nesting level to avoid false matches from nested fields.

Also consider adding retry/wait logic around the creation loop to handle transient controller errors.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions