forked from pangeo-forge/pangeo-forge-runner
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main' into add-release-yaml
- Loading branch information
Showing
9 changed files
with
136 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from typing import Optional | ||
from unittest.mock import patch | ||
|
||
import pytest | ||
|
||
from pangeo_forge_runner.bakery.flink import FlinkOperatorBakery | ||
|
||
|
||
@pytest.mark.parametrize("parallelism, max_parallelism", [(None, None), (100, 100)]) | ||
def test_pipelineoptions( | ||
parallelism: Optional[int], | ||
max_parallelism: Optional[int], | ||
): | ||
""" | ||
Quickly validate some of the PipelineOptions set | ||
""" | ||
fob = FlinkOperatorBakery() | ||
fob.parallelism = parallelism | ||
fob.max_parallelism = max_parallelism | ||
|
||
# FlinkOperatorBakery.get_pipeline_options calls `kubectl` in a subprocess, | ||
# so we patch subprocess here to skip that behavior for this test | ||
with patch("pangeo_forge_runner.bakery.flink.subprocess"): | ||
po = fob.get_pipeline_options("job", "some-container:some-tag", {}) | ||
# some flink args, e.g. 'parallelism', are apparently 'unknown_options' from | ||
# the perspective of PipelineOptions, so we retain those here for the test. | ||
# it doesn't seem like their 'unknown' status prevents them from being passed to | ||
# flink in an actual deployment, though. | ||
opts = po.get_all_options(retain_unknown_options=True) | ||
|
||
assert opts["flink_version"] == "1.15" | ||
|
||
for optional_arg, value in dict( | ||
parallelism=parallelism, | ||
max_parallelism=max_parallelism, | ||
).items(): | ||
# if these args are not passed, we don't want them to appear in | ||
# the pipeline opts, so we verify here that is actually happening. | ||
if value is None: | ||
assert optional_arg not in opts | ||
else: | ||
assert opts[optional_arg] == value |