Skip to content

Commit

Permalink
fix: csharp executor proxy ci failure (#3018)
Browse files Browse the repository at this point in the history
# Description

fix 2 test on Windows:
promptflow-devkit/tests/sdk_cli_test/e2etests/test_csharp_sdk.py

- test_destroy_with_terminates_gracefully
- test_destroy_with_force_kill

# All Promptflow Contribution checklist:
- [ ] **The pull request does not introduce [breaking changes].**
- [ ] **CHANGELOG is updated for new features, bug fixes or other
significant changes.**
- [ ] **I have read the [contribution guidelines](../CONTRIBUTING.md).**
- [ ] **Create an issue and link to the pull request to get dedicated
review from promptflow team. Learn more: [suggested
workflow](../CONTRIBUTING.md#suggested-workflow).**

## General Guidelines and Best Practices
- [ ] Title of the pull request is clear and informative.
- [ ] There are a small number of commits, each of which have an
informative message. This means that previously merged commits do not
appear in the history of the PR. For more information on cleaning up the
commits in your PR, [see this
page](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md).

### Testing Guidelines
- [ ] Pull request includes test coverage for the included changes.
  • Loading branch information
elliotzh authored Apr 25, 2024
1 parent 40c054d commit 935176f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,19 @@ class TestCSharpSdk:
"language": {"default": "chinese", "type": "string"},
"topic": {"default": "ocean", "type": "string"},
},
"outputs": {"output": {"type": "object"}},
"outputs": {
"Answer": {"type": "string"},
"AnswerLength": {"type": "int"},
"PoemLanguage": {"type": "string"},
},
},
id="function_mode_basic",
),
pytest.param(
{
"init": {"connection": {"type": "AzureOpenAIConnection"}, "name": {"type": "string"}},
"inputs": {"question": {"default": "What is Promptflow?", "type": "string"}},
"outputs": {"output": {"type": "object"}},
"outputs": {"output": {"type": "string"}},
},
id="class_init_flex_flow",
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import json
import platform
import signal
import socket
import subprocess
from pathlib import Path
Expand Down Expand Up @@ -62,7 +64,10 @@ async def test_destroy_with_terminates_gracefully(self):
await executor_proxy.destroy()

mock_process.poll.assert_called_once()
mock_process.terminate.assert_called_once()
if platform.system() != "Windows":
mock_process.terminate.assert_called_once()
else:
mock_process.send_signal.assert_called_once_with(signal.CTRL_BREAK_EVENT)
mock_process.wait.assert_called_once_with(timeout=5)
mock_process.kill.assert_not_called()

Expand All @@ -77,7 +82,10 @@ async def test_destroy_with_force_kill(self):
await executor_proxy.destroy()

mock_process.poll.assert_called_once()
mock_process.terminate.assert_called_once()
if platform.system() != "Windows":
mock_process.terminate.assert_called_once()
else:
mock_process.send_signal.assert_called_once_with(signal.CTRL_BREAK_EVENT)
mock_process.wait.assert_called_once_with(timeout=5)
mock_process.kill.assert_called_once()

Expand Down

0 comments on commit 935176f

Please sign in to comment.