Skip to content

Commit

Permalink
fixed issue with flaky tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei Neagu authored and sanderegg committed Aug 11, 2022
1 parent b3e2482 commit 2b2499b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ def _get_environment_variables(
"DY_SIDECAR_PATH_OUTPUTS": f"{scheduler_data.paths_mapping.outputs_path}",
"DY_SIDECAR_PROJECT_ID": f"{scheduler_data.project_id}",
"DY_SIDECAR_RUN_ID": f"{scheduler_data.dynamic_sidecar.run_id}",
"DY_SIDECAR_STATE_EXCLUDE": json_dumps([f"{x}" for x in state_exclude]),
"DY_SIDECAR_STATE_EXCLUDE": json_dumps(f"{x}" for x in state_exclude),
"DY_SIDECAR_STATE_PATHS": json_dumps(
[f"{x}" for x in scheduler_data.paths_mapping.state_paths]
f"{x}" for x in scheduler_data.paths_mapping.state_paths
),
"DY_SIDECAR_USER_ID": f"{scheduler_data.user_id}",
"DYNAMIC_SIDECAR_COMPOSE_NAMESPACE": compose_namespace,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def expected_dynamic_sidecar_spec(run_id: UUID) -> dict[str, Any]:
"DY_SIDECAR_PATH_INPUTS": "/tmp/inputs",
"DY_SIDECAR_PATH_OUTPUTS": "/tmp/outputs",
"DY_SIDECAR_PROJECT_ID": "dd1d04d9-d704-4f7e-8f0f-1ca60cc771fe",
"DY_SIDECAR_STATE_EXCLUDE": json_dumps(["/tmp/strip_me/*", "*.py"]),
"DY_SIDECAR_STATE_EXCLUDE": json_dumps({"*.py", "/tmp/strip_me/*"}),
"DY_SIDECAR_STATE_PATHS": json_dumps(
["/tmp/save_1", "/tmp_save_2"]
),
Expand Down Expand Up @@ -360,6 +360,24 @@ def test_get_dynamic_proxy_spec(
"TaskTemplate": {"ContainerSpec": {"Env": True}},
}

# NOTE: some falkyness here
# state_exclude is a set and does not preserve order
# when dumping to json it gets converted to a list
dynamic_sidecar_spec.TaskTemplate.ContainerSpec.Env[
"DY_SIDECAR_STATE_EXCLUDE"
] = sorted(
dynamic_sidecar_spec.TaskTemplate.ContainerSpec.Env[
"DY_SIDECAR_STATE_EXCLUDE"
]
)
expected_dynamic_sidecar_spec_model.TaskTemplate.ContainerSpec.Env[
"DY_SIDECAR_STATE_EXCLUDE"
] = sorted(
expected_dynamic_sidecar_spec_model.TaskTemplate.ContainerSpec.Env[
"DY_SIDECAR_STATE_EXCLUDE"
]
)

assert dynamic_sidecar_spec.dict(
exclude=exclude_keys
) == expected_dynamic_sidecar_spec_model.dict(exclude=exclude_keys)
Expand Down

0 comments on commit 2b2499b

Please sign in to comment.