Skip to content

Commit f54ca51

Browse files
authored
Merge pull request #218 from UiPath/chore/update-integrationtests-no-job-key
CI: make integration tests run also without jobkey
2 parents c6870ed + 5796209 commit f54ca51

File tree

8 files changed

+121
-147
lines changed

8 files changed

+121
-147
lines changed

testcases/company-research-agent/run.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#!/bin/bash
2+
set -e
3+
14
echo "Syncing dependencies..."
25
uv sync
36

@@ -11,4 +14,8 @@ echo "Packing agent..."
1114
uv run uipath pack
1215

1316
echo "Running agent..."
14-
uv run uipath run agent --file input.json
17+
uv run uipath run agent --file input.json
18+
19+
echo "Running agent again with empty UIPATH_JOB_KEY..."
20+
export UIPATH_JOB_KEY=""
21+
uv run uipath run agent --file input.json >> local_run_output.log
Lines changed: 28 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,46 @@
11
import os
2-
import sys
32
import json
43

54
print("Checking company research agent output...")
65

76
# Check NuGet package
87
uipath_dir = ".uipath"
9-
if not os.path.exists(uipath_dir):
10-
print("NuGet package directory (.uipath) not found")
11-
sys.exit(1)
8+
assert os.path.exists(uipath_dir), "NuGet package directory (.uipath) not found"
129

1310
nupkg_files = [f for f in os.listdir(uipath_dir) if f.endswith('.nupkg')]
14-
if not nupkg_files:
15-
print("NuGet package file (.nupkg) not found in .uipath directory")
16-
sys.exit(1)
11+
assert nupkg_files, "NuGet package file (.nupkg) not found in .uipath directory"
1712

1813
print(f"NuGet package found: {nupkg_files[0]}")
1914

2015
# Check agent output file
2116
output_file = "__uipath/output.json"
22-
if not os.path.isfile(output_file):
23-
print("Agent output file not found")
24-
sys.exit(1)
17+
assert os.path.isfile(output_file), "Agent output file not found"
2518

2619
print("Agent output file found")
2720

2821
# Check status and required fields
29-
try:
30-
with open(output_file, 'r', encoding='utf-8') as f:
31-
output_data = json.load(f)
32-
33-
# Check status
34-
status = output_data.get("status")
35-
if status != "successful":
36-
print(f"Agent execution failed with status: {status}")
37-
sys.exit(1)
38-
39-
print("Agent execution status: successful")
40-
41-
# Check required fields for company research agent
42-
if "output" not in output_data:
43-
print("Missing 'output' field in agent response")
44-
sys.exit(1)
45-
46-
output_content = output_data["output"]
47-
if "response" not in output_content:
48-
print("Missing 'response' field in output")
49-
sys.exit(1)
50-
51-
response = output_content["response"]
52-
if not response or response.strip() == "":
53-
print("Response field is empty")
54-
sys.exit(1)
55-
56-
print("Required fields validation passed")
57-
print("Company research agent working correctly.")
58-
59-
except Exception as e:
60-
print(f"Error checking output: {e}")
61-
sys.exit(1)
22+
with open(output_file, 'r', encoding='utf-8') as f:
23+
output_data = json.load(f)
24+
25+
# Check status
26+
status = output_data.get("status")
27+
assert status == "successful", f"Agent execution failed with status: {status}"
28+
29+
print("Agent execution status: successful")
30+
31+
# Check required fields for company research agent
32+
assert "output" in output_data, "Missing 'output' field in agent response"
33+
34+
output_content = output_data["output"]
35+
assert "response" in output_content, "Missing 'response' field in output"
36+
37+
response = output_content["response"]
38+
assert response and response.strip() != "", "Response field is empty"
39+
40+
with open("local_run_output.log", 'r', encoding='utf-8') as f:
41+
local_run_output = f.read()
42+
43+
# Check if response contains 'Successful execution.'
44+
assert "Successful execution." in local_run_output, f"Response does not contain 'Successful execution.'. Actual response: {local_run_output}"
45+
46+
print("Required fields validation passed")

testcases/init-flow/run.sh

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#!/bin/bash
2+
set -e
3+
14
echo "Syncing dependencies..."
25
uv sync
36

@@ -24,10 +27,6 @@ uv run uipath pack
2427
echo "Input from input.json file"
2528
uv run uipath run agent --file input.json
2629

27-
source /app/testcases/common/print_output.sh
28-
print_uipath_output
29-
30-
echo "Validating output..."
31-
python src/assert.py || { echo "Validation failed!"; exit 1; }
32-
33-
echo "Testcase completed successfully."
30+
echo "Running agent again with empty UIPATH_JOB_KEY..."
31+
export UIPATH_JOB_KEY=""
32+
uv run uipath run agent --file input.json >> local_run_output.log

testcases/init-flow/src/assert.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,10 @@
3737
report = output_content["report"]
3838
assert report and isinstance(report, str), "Report field is empty or not a string"
3939

40+
with open("local_run_output.log", 'r', encoding='utf-8') as f:
41+
local_run_output = f.read()
42+
43+
# Check if response contains 'Successful execution.'
44+
assert "Successful execution." in local_run_output, f"Response does not contain 'Successful execution.'. Actual response: {local_run_output}"
45+
4046
print("Required fields validation passed")

testcases/simple-local-mcp/run.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#!/bin/bash
2+
set -e
3+
14
echo "Syncing dependencies..."
25
uv sync
36

@@ -11,6 +14,8 @@ echo "Packing agent..."
1114
uv run uipath pack
1215

1316
echo "Running agent..."
14-
echo "Input from input.json file"
1517
uv run uipath run agent --file input.json
1618

19+
echo "Running agent again with empty UIPATH_JOB_KEY..."
20+
export UIPATH_JOB_KEY=""
21+
uv run uipath run agent --file input.json >> local_run_output.log
Lines changed: 28 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,46 @@
11
import os
2-
import sys
32
import json
43

54
print("Checking simple local MCP agent output...")
65

76
# Check NuGet package
87
uipath_dir = ".uipath"
9-
if not os.path.exists(uipath_dir):
10-
print("NuGet package directory (.uipath) not found")
11-
sys.exit(1)
8+
assert os.path.exists(uipath_dir), "NuGet package directory (.uipath) not found"
129

1310
nupkg_files = [f for f in os.listdir(uipath_dir) if f.endswith('.nupkg')]
14-
if not nupkg_files:
15-
print("NuGet package file (.nupkg) not found in .uipath directory")
16-
sys.exit(1)
11+
assert nupkg_files, "NuGet package file (.nupkg) not found in .uipath directory"
1712

1813
print(f"NuGet package found: {nupkg_files[0]}")
1914

2015
# Check agent output file
2116
output_file = "__uipath/output.json"
22-
if not os.path.isfile(output_file):
23-
print("Agent output file not found")
24-
sys.exit(1)
17+
assert os.path.isfile(output_file), "Agent output file not found"
2518

2619
print("Agent output file found")
2720

2821
# Check status and required fields
29-
try:
30-
with open(output_file, 'r', encoding='utf-8') as f:
31-
output_data = json.load(f)
32-
33-
# Check status
34-
status = output_data.get("status")
35-
if status != "successful":
36-
print(f"Agent execution failed with status: {status}")
37-
sys.exit(1)
38-
39-
print("Agent execution status: successful")
40-
41-
# Check required fields for simple local MCP agent
42-
if "output" not in output_data:
43-
print("Missing 'output' field in agent response")
44-
sys.exit(1)
45-
46-
output_content = output_data["output"]
47-
if "messages" not in output_content:
48-
print("Missing 'messages' field in output")
49-
sys.exit(1)
50-
51-
messages = output_content["messages"]
52-
if not messages or not isinstance(messages, list):
53-
print("Messages field is empty or not a list")
54-
sys.exit(1)
55-
56-
print("Required fields validation passed")
57-
print("Simple local MCP agent working correctly.")
58-
59-
except Exception as e:
60-
print(f"Error checking output: {e}")
61-
sys.exit(1)
22+
with open(output_file, 'r', encoding='utf-8') as f:
23+
output_data = json.load(f)
24+
25+
# Check status
26+
status = output_data.get("status")
27+
assert status == "successful", f"Agent execution failed with status: {status}"
28+
29+
print("Agent execution status: successful")
30+
31+
# Check required fields for simple local MCP agent
32+
assert "output" in output_data, "Missing 'output' field in agent response"
33+
34+
output_content = output_data["output"]
35+
assert "messages" in output_content, "Missing 'messages' field in output"
36+
37+
messages = output_content["messages"]
38+
assert messages and isinstance(messages, list), "Messages field is empty or not a list"
39+
40+
with open("local_run_output.log", 'r', encoding='utf-8') as f:
41+
local_run_output = f.read()
42+
43+
# Check if response contains 'Successful execution.'
44+
assert "Successful execution." in local_run_output, f"Response does not contain 'Successful execution.'. Actual response: {local_run_output}"
45+
46+
print("Required fields validation passed")

testcases/ticket-classification/run.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#!/bin/bash
2+
set -e
3+
14
echo "Syncing dependencies..."
25
uv sync
36

@@ -16,3 +19,7 @@ uv run uipath run agent --file input.json
1619
echo "Resuming agent run by default with {'Answer': true}..."
1720
uv run uipath run agent '{"Answer": true}' --resume;
1821

22+
echo "Running agent again with empty UIPATH_JOB_KEY..."
23+
export UIPATH_JOB_KEY=""
24+
uv run uipath run agent --file input.json >> local_run_output.log
25+
uv run uipath run agent '{"Answer": true}' --resume >> local_run_output.log
Lines changed: 32 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,51 @@
11
import os
2-
import sys
32
import json
43

54
print("Checking ticket classification agent output...")
65

76
# Check NuGet package
87
uipath_dir = ".uipath"
9-
if not os.path.exists(uipath_dir):
10-
print("NuGet package directory (.uipath) not found")
11-
sys.exit(1)
8+
assert os.path.exists(uipath_dir), "NuGet package directory (.uipath) not found"
129

1310
nupkg_files = [f for f in os.listdir(uipath_dir) if f.endswith('.nupkg')]
14-
if not nupkg_files:
15-
print("NuGet package file (.nupkg) not found in .uipath directory")
16-
sys.exit(1)
11+
assert nupkg_files, "NuGet package file (.nupkg) not found in .uipath directory"
1712

1813
print(f"NuGet package found: {nupkg_files[0]}")
1914

2015
# Check agent output file
2116
output_file = "__uipath/output.json"
22-
if not os.path.isfile(output_file):
23-
print("Agent output file not found")
24-
sys.exit(1)
17+
assert os.path.isfile(output_file), "Agent output file not found"
2518

2619
print("Agent output file found")
2720

2821
# Check status and required fields
29-
try:
30-
with open(output_file, 'r', encoding='utf-8') as f:
31-
output_data = json.load(f)
32-
33-
# Check status
34-
status = output_data.get("status")
35-
if status != "successful":
36-
print(f"Agent execution failed with status: {status}")
37-
sys.exit(1)
38-
39-
print("Agent execution status: successful")
40-
41-
# Check required fields for ticket classification agent
42-
if "output" not in output_data:
43-
print("Missing 'output' field in agent response")
44-
sys.exit(1)
45-
46-
output_content = output_data["output"]
47-
if "label" not in output_content:
48-
print("Missing 'label' field in output")
49-
sys.exit(1)
50-
51-
label = output_content["label"]
52-
if not label or label.strip() == "":
53-
print("Label field is empty")
54-
sys.exit(1)
22+
with open(output_file, 'r', encoding='utf-8') as f:
23+
output_data = json.load(f)
24+
25+
# Check status
26+
status = output_data.get("status")
27+
assert status == "successful", f"Agent execution failed with status: {status}"
28+
29+
print("Agent execution status: successful")
30+
31+
# Check required fields for ticket classification agent
32+
assert "output" in output_data, "Missing 'output' field in agent response"
33+
34+
output_content = output_data["output"]
35+
assert "label" in output_content, "Missing 'label' field in output"
36+
37+
label = output_content["label"]
38+
assert label and label.strip() != "", "Label field is empty"
39+
40+
assert "confidence" in output_content, "Missing 'confidence' field in output"
41+
42+
confidence = output_content["confidence"]
43+
assert confidence is not None and confidence != "", "Confidence field is empty"
44+
45+
with open("local_run_output.log", 'r', encoding='utf-8') as f:
46+
local_run_output = f.read()
47+
48+
# Check if response contains 'Successful execution.'
49+
assert "Successful execution." in local_run_output, f"Response does not contain 'Successful execution.'. Actual response: {local_run_output}"
5550

56-
if "confidence" not in output_content:
57-
print("Missing 'confidence' field in output")
58-
sys.exit(1)
59-
60-
confidence = output_content["confidence"]
61-
if confidence is None or confidence == "":
62-
print("Confidence field is empty")
63-
sys.exit(1)
64-
65-
66-
print("Required fields validation passed")
67-
print("Ticket classification agent working correctly.")
68-
69-
except Exception as e:
70-
print(f"Error checking output: {e}")
71-
sys.exit(1)
51+
print("Required fields validation passed")

0 commit comments

Comments
 (0)