Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates the tests to remove exceptions now that Cloud will be on pydantic v2 #29

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 5 additions & 26 deletions test_oss_cloud_api_compatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,26 +282,6 @@ def extract_types(d):
# - new Cloud fields aren't required (this is difficult to check right now as it's method dependent!)
assert cloud_props[0] == oss_props[0]

# Handling of aliases is different between Pydantic v2 and v1, so we'll force
# some name overrides here
KNOWN_ALIASES = {
"/api/flow_runs/history": {
"post": {
"history_interval": "history_interval_seconds",
}
},
"/api/task_runs/history": {
"post": {
"history_interval": "history_interval_seconds",
}
},
"/api/ui/schemas/validate": {
"post": {
"json_schema": "schema",
}
},
}

# ensure every OSS field is present in Cloud
# ensure the property attributes are the same or a subset (like in the case of type)
for (
Expand All @@ -311,11 +291,6 @@ def extract_types(d):
oss_default,
oss_deprecated,
) in oss_props[1].values():
if endpoint in KNOWN_ALIASES:
if method in KNOWN_ALIASES[endpoint]:
if oss_name in KNOWN_ALIASES[endpoint][method]:
oss_name = KNOWN_ALIASES[endpoint][method][oss_name]

# Note, this print is here intentionally to make it easier to understand test
# failures when looping over fields
print("parameter name:", oss_name)
Expand All @@ -339,7 +314,11 @@ def extract_types(d):
# while Cloud does not.
oss_types.discard("null")

known_incompatible_props = KNOWN_INCOMPATIBLE_API_REQUEST_PROPS.get(endpoint, {}).get(method, {}).get(oss_name, set())
known_incompatible_props = (
KNOWN_INCOMPATIBLE_API_REQUEST_PROPS.get(endpoint, {})
.get(method, {})
.get(oss_name, set())
)

if "name" not in known_incompatible_props:
assert oss_name == cloud_name
Expand Down
Loading