Skip to content

Fix/uploads cli no async consumer - #3603

Open
butonic wants to merge 2 commits into
mainfrom
fix/uploads-cli-no-async-consumer
Open

butonic wants to merge 2 commits into
mainfrom
fix/uploads-cli-no-async-consumer

Conversation

@butonic

@butonic butonic commented Sep 25, 2026

Copy link
Copy Markdown
Member

after merging #3591 the tests became flaky because the cli no longer waits for the command to finish - and there cli command would register itself as a consumer for the main-queue. with the event based approach this could lead to the cli itself consuming the event and then killing itself ... losing the event in the process.

  Scenario: restart upload sessions that are in postprocessing                         # /woodpecker/src/github.com/opencloud-eu/opencloud-internal/tests/acceptance/features/cliCommands/uploadSessions.feature:89
    Given user "Alice" has uploaded file with content "upload content" to "/file1.txt" # FeatureContext::userHasUploadedAFileWithContentTo()
    And the config "POSTPROCESSING_DELAY" has been set to "10s"                        # OcConfigContext::theConfigHasBeenSetTo()
    And user "Alice" has uploaded file with content "upload content" to "/file2.txt"   # FeatureContext::userHasUploadedAFileWithContentTo()
    When the administrator restarts the upload sessions that are in postprocessing     # CliContext::theAdministratorRestartsTheUploadSessionsThatAreInPostprocessing()
    Then the command should be successful                                              # CliContext::theCommandShouldBeSuccessful()
    And the CLI response should contain these entries:                                 # CliContext::theCLIResponseShouldContainTheseEntries()
      | file2.txt |
    And the CLI response should not contain these entries:                             # CliContext::theCLIResponseShouldContainTheseEntries()
      | file1.txt |
      The resource 'file1.txt' was found in the response.
      Failed asserting that true is not true.

…ueue

The uploads sessions command builds a posix driver with async file
uploads enabled, which makes it join the "dcfs" JetStream queue group.
Clean/restart/resume events published by the command itself can then be
routed to the CLI's own short-lived consumer; the nats client auto-acks
them and they are lost when the process exits, leaving stale upload
sessions behind.

Disable asyncfileuploads for the CLI driver instance so it only lists
sessions and publishes events. Also emit [] instead of null when the
session list is empty so the JSON output stays parseable.
The AfterScenario hook only asserted that the clean command returned
200, but cleaning sessions happens asynchronously in the daemon. Poll
the session list until it is empty (60s deadline) so leftover sessions
do not leak into the next scenario.
@butonic
butonic force-pushed the fix/uploads-cli-no-async-consumer branch from 7d7b503 to eab5eb3 Compare September 25, 2026 15:34
@codacy-production

codacy-production Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

🟢 Coverage 0.00% diff coverage · +0.01% coverage variation

Metric Results
Coverage variation ✅ +0.01% coverage variation (-1.00%)
Diff coverage ✅ 0.00% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (f7e6d5d) 89085 21492 24.13%
Head commit (eab5eb3) 89090 (+5) 21502 (+10) 24.14% (+0.01%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#3603) 10 0 0.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@butonic
butonic marked this pull request as ready for review September 25, 2026 19:57
@butonic
butonic requested review from micbar and v-scharf September 25, 2026 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Qualification

Development

Successfully merging this pull request may close these issues.

1 participant