Skip to content

test(fileservice): isolate external object storage tests - #28291

Closed
gouhongshen wants to merge 2 commits into
matrixorigin:mainfrom
gouhongshen:agent/issue-26541-da4122fe
Closed

gouhongshen wants to merge 2 commits into
matrixorigin:mainfrom
gouhongshen:agent/issue-26541-da4122fe

Conversation

@gouhongshen

@gouhongshen gouhongshen commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

Related to #26541

What this PR does / why we need it:

Root cause

The fileservice test argument helper mixed the local disk fixture with s3.json, s3_fs_test_new.xml, and all ambient TEST_S3FS_* variables. Consequently, coverage's go test -short could execute live Aliyun/QCloud tests whenever credentials were present, so an unrelated external TCP timeout failed the unit-test job.

Changes

  • split local disk and external object-storage argument sources
  • retain shared object-storage and S3FS contract assertions while exposing explicit external test entry points
  • require both non-short mode and MO_RUN_EXTERNAL_OBJECT_STORAGE_TESTS=1 before external configuration is read or a provider can be contacted
  • fail an explicitly enabled external run when its configuration is absent or malformed
  • defer XML test configuration loading until the explicitly enabled external test starts

This is test-only: no production API, storage format, retry behavior, or runtime path changes.

Issue-to-test proof

  • TestShouldRunExternalObjectStorageTests covers the explicit opt-in contract, disabled default, short-mode precedence, and invalid values.
  • TestLocalObjectStorageArgumentsIgnoreExternalConfiguration proves a poisoned TEST_S3FS_ALIYUN value cannot enter the local tier.
  • The focused object-storage run with poisoned Aliyun/QCloud specs pointed at 127.0.0.1:1 executes only the disk fixture and passes in both short and normal modes.
  • All external entry points explicitly skip without the opt-in, preventing ambient credentials from reaching a provider.

Validation

  • TEST_S3FS_ALIYUN=...127.0.0.1:1 .agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=120s -short -run '^(TestShouldRunExternalObjectStorageTests|TestLocalObjectStorageArgumentsIgnoreExternalConfiguration|TestObjectStorages)$' ./pkg/fileservice
  • TEST_S3FS_ALIYUN=...127.0.0.1:1 .agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=120s -run '^(TestObjectStoragesExternal|TestS3FSFromExternalSpecs|TestNewS3FSFromSpec|TestQCloudSDK)$' ./pkg/fileservice
  • TEST_S3FS_ALIYUN=...127.0.0.1:1 .agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=120s -run '^TestObjectStorages$' ./pkg/fileservice
  • CGO_CFLAGS="-I$PWD/cgo -I$PWD/thirdparties/install/include" CGO_LDFLAGS="-L$PWD/thirdparties/install/lib" GOWORK=off go vet -mod=readonly ./pkg/fileservice
  • git diff --check

The full short package suite was also attempted with poisoned Aliyun/QCloud specs. It failed in the untouched local TestMinioSDK/file_service because the local MinIO process returned Access Denied; the same isolated test failed with that error.

Residual risk

Live provider integration was intentionally not run: it requires a maintained endpoint and explicit credentials. This PR makes that dependency opt-in so provider/network availability can no longer make required unit coverage flaky.

Landing condition

Do not land this PR alone. Current matrixorigin/CI coverage still provides TEST_S3FS_ALIYUN and TEST_S3FS_QCLOUD only to go test -short, so the new external tier would be skipped without a paired CI rollout. Before landing, a matrixorigin/CI change must remove provider credentials from coverage and add trusted, provider-isolated, non-short exact-head jobs with MO_RUN_EXTERNAL_OBJECT_STORAGE_TESTS=1, triggered pre-merge for fileservice/dependency paths and also scheduled/manual.

Latest rebase validation (2026-09-12)

Rebased onto e2580f993a5a742f562f3cfcd0f53ca89a9ee373; head 5c5279f938f408c44d842c1a34bcc317a7c85f69. No conflicts; git range-diff confirms the patch is unchanged and the PR still changes only the four fileservice test files.

The focused native-wrapper suite passed with -v -count=1 -timeout=180s in normal mode with MO_RUN_EXTERNAL_OBJECT_STORAGE_TESTS=0 (2.451s), and in -short mode with the opt-in set to 1 (2.065s). Both runs supplied Aliyun/QCloud specs pointing to http://127.0.0.1:1. Selection included TestShouldRunExternalObjectStorageTests, TestLocalObjectStorageArgumentsIgnoreExternalConfiguration, TestObjectStorages, TestS3FSFromSpecs, and all four external entry points. Local contracts executed and passed; external entry points skipped as required. git diff --check origin/main...HEAD passed. No fresh live-provider or full-package pass is claimed.

The coverage-handoff P1 remains unresolved: matrixorigin/CI@e43e7077e87ebdcefa66b12e3b1778b984cc3ce2 still exports provider specs into short coverage. Implementing the required paired automation needs the CI owners; MatrixOne .github/workflows/** and .github/ci/** are protected for this task. The landing condition above remains mandatory.

Paired rollout status (2026-09-15)

The existing P1 stays unresolved until those two supporting changes land and this PR demonstrates that the provider contracts actually execute.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed exact head b8a8d529d792ccb3f6e60d0f9016a7ea5575cf3c. The four changed test files are unchanged from the previously reviewed 3fa1d644eb13c142c30e863210ee688bec35c479; the previous coverage handoff blocker remains open.

[P1] Supply the replacement automated provider tier before disabling its current consumer

Concrete trigger: merge this PR with current matrixorigin/CI@e6127926a2a2de795b07877f1a00dd944058b71c. Its .github/workflows/coverage-ut.yaml:254-255 still exports Aliyun/QCloud test credentials and line 275 invokes go test ... -short. The new guard in pkg/fileservice/object_storage_arguments_test.go:80-90 requires non-short mode AND MO_RUN_EXTERNAL_OBJECT_STORAGE_TESTS=1, so these previously selected live-provider contracts now always skip. Adding the opt-in to the existing short job would not restore them.

I refreshed the CI main workflow inventory/open PRs and searched for the new opt-in consumer; there is still no paired external-provider automation. This is an actual loss of existing automated coverage, not merely missing evidence for new tests. The PR body's explicit “Do not land this PR alone” condition correctly describes the unresolved dependency, but has no linked implemented replacement.

Please land or atomically roll out a paired trusted exact-head, non-short provider tier that sets the opt-in, isolates provider credentials/jobs, retains relevant pre-merge and scheduled/manual execution, and then removes credentials from short coverage. Link its caller and paired change so this handoff is verifiable. The local/external split itself can remain.

The shared object-storage/S3FS assertions remain intact, external configuration is deferred, local disk tests cannot discover ambient provider configuration, and no production runtime/API/storage-format change is introduced. No new concurrency, cleanup or production-performance blocker was found. Reused the unchanged prior focused/race/negative-opt-in validation; git diff --check passes. No fresh live-provider or full native package run is claimed, and no CI wait was performed. Request changes solely for the still-unresolved automation handoff.

@gouhongshen

gouhongshen commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor Author

Unrelated CI blockers:

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed head 55f3fdc against base 0b195e4. Read all four changed test files. The local/external fixture split is coherent; shared assertions remain, disabled runs cannot load external configuration, and no production path changes.

[P1] The replacement automated provider tier is still missing.
I refreshed matrixorigin/CI's coverage-ut.yaml (blob 2dc2316ad2bb12560166954f8129689744b80b87): lines 254-255 still export TEST_S3FS_ALIYUN/TEST_S3FS_QCLOUD and line 275 still runs go test -short. This PR's guard requires BOTH non-short mode AND MO_RUN_EXTERNAL_OBJECT_STORAGE_TESTS=1, so the existing automated provider coverage becomes unconditionally skipped. Repository code search currently finds no consumer of that opt-in, and the PR still documents “Do not land this PR alone” without a linked replacement.

Please provide the paired CI rollout: trusted exact-PR-head, non-short provider-isolated jobs with the explicit opt-in; relevant pre-merge selection plus scheduled/manual runs; then remove provider credentials from short coverage. Link the implemented caller/workflow and demonstrate actual external test selection (not an all-skipped green job). Adding the opt-in to the existing short job is insufficient.

Decision remains REQUEST_CHANGES for the verified coverage handoff gap, not for the isolation approach. Existing focused poisoned-endpoint/guard evidence remains relevant; no live-provider or full native suite was run in this review. The reported local MinIO failure is not treated as a provider-tier pass or a new production defect.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed exact head e6a79b6 against base/merge-base b2f0f3f. All four changed test files are unchanged from the previously reviewed 55f3fdc head. The local/external split, deferred configuration loading, short-mode precedence and shared contract assertions are coherent; no new production, concurrency or resource-lifetime defect was found.

[P1] Preserve the automated provider tier before switching off its current consumer.

The trigger is landing this head with the current CI default branch e6127926a2a2de795b07877f1a00dd944058b71c. At pkg/fileservice/object_storage_arguments_test.go:80-89, short mode unconditionally skips the external tier. CI's coverage-ut.yaml still exports TEST_S3FS_ALIYUN and TEST_S3FS_QCLOUD and executes go test -short (https://github.com/matrixorigin/CI/blob/e6127926a2a2de795b07877f1a00dd944058b71c/.github/workflows/coverage-ut.yaml#L254). The previously selected cloud-backed TestObjectStorages/TestS3FSFromSpecs contracts therefore disappear from automated execution. Setting the opt-in on that short job cannot restore them. I refreshed the CI workflow inventory and opt-in code search and checked this MatrixOne head's workflow/runner paths; there is still no replacement consumer.

This is a deterministic loss of existing automated test coverage, not a request to block merely because a new test lacks execution evidence. The PR body's 'Do not land this PR alone' condition acknowledges the missing handoff but does not implement it.

Please provide the paired trusted exact-head, non-short provider jobs with MO_RUN_EXTERNAL_OBJECT_STORAGE_TESTS=1, isolate provider credentials/jobs, retain relevant pre-merge plus scheduled/manual selection, and remove cloud credentials from short coverage once that replacement is in place. Link the implemented consumer so the landing dependency is verifiable.

Evidence: current source/caller review, unchanged prior poisoned-endpoint/explicit-enable/focused-race validation, green current PR checks in run 34185504362, and git diff --check. No live-provider run or new full native suite is claimed. Request changes solely for the unresolved coverage handoff.

@gouhongshen gouhongshen left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified and replied in the unresolved external-provider CI thread; no MatrixOne-only code change can satisfy the paired CI ownership requirement.

}

func objectStorageArgumentsForTest(defaultName string, t *testing.T) (ret []ObjectStorageArguments) {
const runExternalObjectStorageTestsEnv = "MO_RUN_EXTERNAL_OBJECT_STORAGE_TESTS"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Classification: valid, but outside this MatrixOne-only PR’s executable scope.

I verified the quoted premise on matrixorigin/CI@e6127926a2a2de795b07877f1a00dd944058b71c: .github/workflows/coverage-ut.yaml exports TEST_S3FS_ALIYUN and TEST_S3FS_QCLOUD at lines 254–255 and invokes go test ... -short at line 275. An organization code search still returns no MO_RUN_EXTERNAL_OBJECT_STORAGE_TESTS consumer. With pkg/fileservice/object_storage_arguments_test.go requiring both non-short mode and the opt-in, the current coverage job necessarily skips the external tier.

The needed trusted exact-head runner, provider-secret isolation, and scheduled/manual trigger belong to an authorized matrixorigin/CI rollout, tracked by #26541; they cannot be safely implemented in this four-file MatrixOne test PR. The PR body retains that landing condition. No local code change can restore that provider tier, so this thread remains unresolved until the paired CI caller is linked.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed exact head e683b200c61217f7b73b29874ac17a1a1cd0ec9a against base 585a38efd152fadf216c8675b7b997a35ca8deb1. All four changed test files are unchanged from my prior reviewed e6a79b6d75bba345fac64deb4ba5168f4f5ea582; I reread the complete hunks and current review/thread history. The local/external split itself remains sound: the shared contract assertions survive, local disk cannot discover ambient providers, short mode wins, configuration loading is deferred, and explicit opt-in/no-config fails. No new production, cleanup or concurrency blocker was found.

[P1] The existing automated provider coverage is still removed without its replacement consumer.

Trigger: land this head with currently deployed matrixorigin/CI@e6127926a2a2de795b07877f1a00dd944058b71c. pkg/fileservice/object_storage_arguments_test.go:80-89 requires non-short mode AND the new opt-in; current CI coverage-ut.yaml still exports TEST_S3FS_ALIYUN/TEST_S3FS_QCLOUD at lines 254-255 and invokes go test -short at line 275 (https://github.com/matrixorigin/CI/blob/e6127926a2a2de795b07877f1a00dd944058b71c/.github/workflows/coverage-ut.yaml#L254). Thus previously selected live object-storage/S3FS contracts deterministically skip. I refreshed the CI default head, workflow inventory and opt-in search, and checked this MatrixOne head's automation paths: no paired external tier is present. The author still confirms the unresolved handoff and explicitly says not to land alone.

Please land or coordinate an atomic rollout of the trusted exact-head, non-short provider-isolated opt-in jobs with relevant pre-merge and scheduled/manual selection, then remove provider credentials from short coverage. Link the implemented caller and paired change. Merely setting the variable on the existing short invocation cannot restore the tier.

This remains an actual removal of existing automated coverage, not a REQUEST_CHANGES for missing fresh execution evidence. No unrelated redesign or additional source blocker is requested. I reuse the unchanged prior focused poisoned-endpoint/negative-opt-in/race evidence; current queue gates are green, but no new live-provider or native full-suite run is claimed. REQUEST_CHANGES solely for the still-open rollout dependency.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed exact head 92ca9e91ada4a971d971136607af0d5b3703bd4c, base/merge-base 84def69e615f68fc2325970c4feaefd4ec6213e5. REQUEST_CHANGES solely for the existing automated-provider coverage handoff blocker.

All four changed test files are identical to the previously reviewed e683b200c61217f7b73b29874ac17a1a1cd0ec9a; I reread the complete PR hunks. Local disk isolation, deferred external configuration, short-mode precedence, explicit-enable validation and shared object-storage/S3FS assertions remain coherent. The test helper refactor introduces no new production API, retry/concurrency contract or persistent resource owner. Prior source-matched poisoned-endpoint, negative-opt-in and focused-race evidence is reused; no new live-provider or native full-suite run is claimed.

[P1] The replacement automated external tier is still missing

I refreshed matrixorigin/CI@main, which is now 2ab1af3a85ca3c4e4eab7483201aca3e1913dd99 rather than the old SHA cited in earlier reviews. Despite the new bounded coverage runner, coverage-ut.yaml lines 299–300 still export TEST_S3FS_ALIYUN/TEST_S3FS_QCLOUD, and line 477 still invokes go test ... -short. This PR's guard at pkg/fileservice/object_storage_arguments_test.go:80–89 requires non-short mode AND MO_RUN_EXTERNAL_OBJECT_STORAGE_TESTS=1; consequently merging it still unconditionally skips the existing automated cloud-backed contract tier. Adding the opt-in to that same short command cannot restore coverage.

The refreshed CI workflow inventory/open PRs and opt-in search show no paired external consumer; the MatrixOne exact-head automation paths also contain none. The CI delta since the previously inspected default head consists of coverage workflow/runner/reporting changes, not the missing provider tier. The PR's unchanged 'Do not land this PR alone' condition acknowledges rather than resolves this dependency.

Please land or coordinate an atomic rollout of the trusted exact-head, non-short provider-isolated jobs with the explicit opt-in, relevant pre-merge selection and scheduled/manual execution; then remove cloud credentials from short coverage. Link the implemented consumer and evidence that actual external tests execute rather than all skipping. No unrelated implementation redesign is requested.

Exact-head MatrixOne CI run 34280239073 completed successfully and git diff --check passed, but those green checks do not close the disabled-provider coverage handoff. This decision is for a verified loss of existing automated coverage, not merely missing fresh tests or unavailable live credentials. The self-review evidence-reuse/test-contract and unhappy-path checks guided this review. No repository code was changed.

@fengttt fengttt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure this is what we should do.

Are we saying AliYun S3 is NOT reliable?

@gouhongshen

Copy link
Copy Markdown
Contributor Author

@fengttt

“Are we saying AliYun S3 is NOT reliable?”

No. This PR does not make a reliability claim about Aliyun (or QCloud). It separates hermetic unit coverage from live-provider integration: credentials, DNS/TCP reachability, authentication, service-side state, and provider availability are external dependencies regardless of provider quality. The provider contract tests remain in TestObjectStoragesExternal, TestS3FSFromExternalSpecs, TestNewS3FSFromSpec, and TestQCloudSDK; they require a non-short, explicit opt-in so they run in a dedicated provider job rather than the required go test -short coverage job.

I refreshed matrixorigin/CI@2ab1af3a85ca3c4e4eab7483201aca3e1913dd99: coverage still injects both provider specs (lines 299–300) into go test ... -short (line 477), with no MO_RUN_EXTERNAL_OBJECT_STORAGE_TESTS consumer. Therefore I agree with the existing P1: this PR must not land until the paired exact-head, non-short, provider-isolated CI tier is available. I left that thread unresolved and made no code change.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed exact head 61b0228 against main 9a5dd0c. REQUEST_CHANGES solely for the existing provider-coverage handoff blocker.

[P1] The replacement automated external tier is still missing.

I refreshed matrixorigin/CI main, still 2ab1af3a85ca3c4e4eab7483201aca3e1913dd99. Its coverage workflow exports TEST_S3FS_ALIYUN/TEST_S3FS_QCLOUD at lines 299–300, then invokes go test -short at line 477. This PR requires BOTH non-short mode and MO_RUN_EXTERNAL_OBJECT_STORAGE_TESTS=1. Landing it therefore deterministically skips the previously automated provider contracts. Setting the flag on the existing short job cannot restore them.

The refreshed CI workflow inventory and organization opt-in search still show no replacement consumer. The latest author reply and PR-body landing condition explicitly acknowledge that dependency; the new approval does not supply the missing workflow. Please land or coordinate an atomic rollout of the trusted exact-head, non-short, provider-isolated opt-in tier with relevant pre-merge and scheduled/manual selection, then remove cloud credentials from short coverage. Link the actual consumer and verify it executes provider cases rather than an all-skipped run.

I reread the full four-file PR diff and previous review/thread history. Compared with reviewed head 92ca9e9, both object-storage helper/contract files have identical blobs; the QCloud/S3FS file deltas are inherited base tests/lifecycle changes, not changes to this isolation refactor. Shared assertions, provider dispatch and scoped contexts remain intact; local arguments cannot load ambient external configuration, XML loading is deferred, and enabled generic external runs fail for absent/malformed configuration. No new independent implementation, cleanup, concurrency or production-performance blocker was found.

This is loss of existing automated coverage, not a demand for optional additional evidence or a claim that a provider is unreliable. Previous focused poisoned-endpoint/guard/race results remain relevant to the unchanged refactor; I did not run live providers or a new full native suite, and did not wait for CI. No repository files were modified.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed abb619d against main 23b20ea. The previous coverage-handoff P1 remains open; no new independent implementation blocker found.

[P1] Land the replacement provider automation before disabling its existing consumer. The live CI default head is now e43e7077e87ebdcefa66b12e3b1778b984cc3ce2. Its coverage-ut.yaml still exports TEST_S3FS_ALIYUN/TEST_S3FS_QCLOUD at lines 299-300 and invokes go test ... -short at line 477: https://github.com/matrixorigin/CI/blob/e43e7077e87ebdcefa66b12e3b1778b984cc3ce2/.github/workflows/coverage-ut.yaml#L299 . This PR's guard requires BOTH non-short mode and MO_RUN_EXTERNAL_OBJECT_STORAGE_TESTS=1, so landing it with that workflow deterministically skips the formerly automated provider contracts. Setting the variable on the same short invocation cannot restore coverage.

I refreshed the CI workflow inventory and organization opt-in search: no replacement automated consumer is present. The latest author thread and unchanged 'Do not land this PR alone' condition explicitly acknowledge this unresolved dependency. Please land or atomically coordinate the trusted exact-head, non-short, provider-isolated opt-in jobs with relevant pre-merge and scheduled/manual selection, then remove cloud credentials from short coverage. Link the implemented caller and evidence of real provider-test selection, not an all-skipped green job.

I reread the complete four-file current diff and previous findings/author responses. Local disk selection cannot read ambient external configuration; the guard precedes external file/environment parsing; malformed generic external configuration fails; shared storage/S3FS assertions are retained. XML loading is deferred, existing provider dispatch/context cleanup remains, and no production API, storage format or runtime retry/performance path changes. The old source-level isolation and poisoned-endpoint/focused-race evidence remains relevant; no live-provider or fresh native package suite was run here. This decision is for removal of existing automated coverage, not optional supplementary evidence or an assertion that Aliyun/QCloud is unreliable.

Exact head/base rechecked before posting; CI was not awaited and no source files were modified.

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working kind/test-ci size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants