fix: flaky wopi test due to app registry ordering#540
Conversation
013f51e to
42bd786
Compare
kobergj
left a comment
There was a problem hiding this comment.
small question. Approach itself looks good 👍
| apps, err := client.GetAppProviders(ctx, &appregistry.GetAppProvidersRequest{ | ||
| ResourceInfo: statRes.Info, | ||
| }) | ||
| if err != nil { | ||
| writeError(w, r, appErrorServerError, "error getting app providers", err) | ||
| return | ||
| } | ||
| if apps.Status.Code != rpc.Code_CODE_OK { | ||
| writeError(w, r, appErrorServerError, "error getting app providers", nil) | ||
| return | ||
| } | ||
| if len(apps.Providers) == 0 { | ||
| writeError(w, r, appErrorProviderNotFound, "no app providers found", nil) | ||
| return | ||
| } |
There was a problem hiding this comment.
Why do we still need this logic here? Shouldn't GetDefaultAppProviderForMimeType already resolve that for us?
There was a problem hiding this comment.
apps.Providers[0] would be a last resort fallback - reva support priority config. Can be removed if can be a source of further errors.
There was a problem hiding this comment.
I think we'd need to do a SetDefaultAppProviderForMimeType call somewhere. We can't set a default from the AddAppProvider call.
This needs to be setup by the admin, likely via environment variables (not done at the moment). And we need to assume that the admin won't do it.
There was a problem hiding this comment.
ocis test FakeOffice config: src
Added stable sorting here in handler and in registry that should be enough to fix test issue.
Good point, for no-config (quickstart) case there could be some auto register for default app - I'd take into a separate issue.
|
From a user's perspective, I don't think the server should change too much: the user will want to open the files with the app he chooses. The only reason for the user to open the file with a random app would be because he could choose the app in the first place. Now, assuming the user doesn't provide an app name for whatever reason, I agree the result should be as predictable as possible. In general, the changes in this PR looks good to me.
This way, the results are more predictable. With those changes, we have 2 options for the tests:
|
137df61 to
942bdcb
Compare
a3dbbbf to
6129757
Compare
0461d41 to
d69d5e9
Compare
Fixes potential cause of flakiness in wopi.feature, failed 10 pipelines in ocis/master last 200 commits alone
Likely root cause: Test assumes default app = FakeOffice when no
app_name; server uses first provider from registry (order = priority then registration, or snapshot timing); that first provider is not guaranteed to be FakeOffice./app/open-with-web?...with noapp_namein the second example row; FeatureContext::theJsonDataOfTheResponseShouldMatch() assertsurimatches a pattern withapp=FakeOffice./app/listbefore asserting; the second row does not sendapp_name=FakeOfficeeven though the assertion requires it.app_nameis empty, appprovider.go 394–411 setsappName = apps.Providers[0].Name; the handler never usesdefault_appor GetDefaultProviderForMimeType (registry config inocis/tests/config/drone/app-registry.yamlhasdefault_app: FakeOfficebut that is not honored).Providers: pfrom FindProviders(ctx, MimeType); order = registry order (static: static.go 153–178 heap/registration order; micro: micro/manager.go 219–236sortByPriority(lst)then registration order intom.mimeTypes).uricontainsapp=Collaboraand the schema patternapp=FakeOfficefails; or (b) updateProvidersFromMicroRegistry() snapshot (manager.go 63, ticker 69–86 every 30s) was taken before FakeOffice registered, so FakeOffice is missing from the list and Providers[0] is again another app (e.g. Collabora)."app=Collabora"inurivs expectedapp=FakeOffice; failed step is localApiTests-wopi; scenario e.g. open file with .odt extension (open-with-web) at wopi.feature 348 (second example row).Possible fixes
open-with-webfallback inreva/internal/http/services/appprovider/appprovider.goto resolve default app viaGetDefaultProviderForMimeType(or equivalent deterministic policy) instead ofapps.Providers[0]. default_app for that MIME type (in oCIS CI that’s default_app: FakeOffice in tests/config/drone/app-registry.yaml), making the chosen app deterministic and matching what the WOPI tests assert.sortByPriorityalways yields stable first provider. reva has priority config, however oCIS does not expose it./app/list(or any valid provider) rather than hardcodedapp=FakeOffice.