@@ -13,10 +13,10 @@ ${BASE_URL} ${BASE}:${PORT}
13
13
14
14
*** Keywords ***
15
15
Clean Up Test
16
- [Arguments] @{partition }
16
+ [Arguments] @{part }
17
17
${allowed_status } = Create List 204 404
18
- FOR ${part } IN @{partition }
19
- ${response } = DELETE ${BASE_URL } /partition/${part } expected_status=any
18
+ FOR ${partition } IN @{part }
19
+ ${response } = DELETE ${BASE_URL } /partition/${partition } expected_status=any
20
20
${status_code } = Convert To String ${response.status_code }
21
21
List Should Contain Value ${allowed_status } ${status_code }
22
22
END
@@ -28,15 +28,15 @@ Get Task Status
28
28
RETURN ${response.json() }
29
29
30
30
Get Extract
31
- [Arguments] ${extract_id } ${partition } ${ expected_status } =200
31
+ [Arguments] ${extract_id } ${expected_status } =200
32
32
${response } = GET ${BASE_URL } /extract/${extract_id } expected_status=${expected_status }
33
33
RETURN ${response.json() }
34
34
35
35
Index File
36
- [Arguments] ${file_path } ${file_id } ${partition } ${expected_status } =201
36
+ [Arguments] ${file_path } ${id } ${part } ${expected_status } =201
37
37
${file } = Get File For Streaming Upload ${file_path }
38
38
${files } = Create Dictionary file ${file }
39
- ${response } = POST ${BASE_URL } /indexer/partition/${partition } /file/${file_id } files=${files } expected_status=${expected_status }
39
+ ${response } = POST ${BASE_URL } /indexer/partition/${part } /file/${id } files=${files } expected_status=${expected_status }
40
40
${response } = Set Variable ${response.json() }
41
41
Should Match Regexp ${response } [task_status_url] ${BASE_URL } /indexer/task/[a-fA-F0-9]{48}
42
42
${task_id } = Fetch From Right ${response } [task_status_url] /
@@ -47,53 +47,64 @@ Index File
47
47
Sleep 1
48
48
END
49
49
50
- Get File Metadata
51
- [Arguments] ${file_id } ${partition } ${expected_status } =200
52
- ${response } = GET ${BASE_URL } /partition/${partition } /file/${file_id } expected_status=${expected_status }
53
- RETURN ${response.json() } [metadata]
54
-
55
-
56
50
Check File Exists
57
- [Arguments] ${file_id } ${partition } ${expected_status } =200
58
- ${response } = GET ${BASE_URL } /partition/check-file/${partition } /file/${file_id } expected_status=${expected_status }
59
- Run Keyword If '${expected_status } ' == '200 ' Should Be Equal As Strings ${response.json() } File '${file_id } ' exists in partition '${partition } '.
60
- Run Keyword If '${expected_status } ' == '404 ' Should Be Equal As Strings ${response.json() } [detail] File '${file_id } ' not found in partition '${partition } '.
51
+ [Arguments] ${id } ${part } ${expected_status } =200
52
+ ${response } = GET ${BASE_URL } /partition/check-file/${part } /file/${id } expected_status=${expected_status }
53
+ Run Keyword If '${expected_status } ' == '200 ' Should Be Equal As Strings ${response.json() } File '${id } ' exists in partition '${part } '.
54
+ Run Keyword If '${expected_status } ' == '404 ' Should Be Equal As Strings ${response.json() } [detail] File '${id } ' not found in partition '${part } '.
61
55
62
56
Patch File
63
- [Arguments] ${file_id } ${partition } ${metadata } ${expected_status } =200
57
+ [Arguments] ${id } ${part } ${metadata } ${expected_status } =200
64
58
${form_data } = Create Dictionary metadata=${metadata }
65
- ${response } = PATCH ${BASE_URL } /indexer/partition/${partition } /file/${file_id } data=${form_data } expected_status=${expected_status }
66
- Run Keyword If '${expected_status } ' == '200 ' Should Be Equal As Strings ${response.json() } [message] Metadata for file '${file_id } ' successfully updated.
59
+ ${response } = PATCH ${BASE_URL } /indexer/partition/${part } /file/${id } data=${form_data } expected_status=${expected_status }
60
+ Run Keyword If '${expected_status } ' == '200 ' Should Be Equal As Strings ${response.json() } [message] Metadata for file '${id } ' successfully updated.
67
61
68
62
69
63
Delete File
70
- [Arguments] ${file_id } ${partition } =test ${expected_status } =204
71
- ${response } = DELETE ${BASE_URL } /indexer/partition/${partition } /file/${file_id } expected_status=${expected_status }
64
+ [Arguments] ${id } ${part } =test ${expected_status } =204
65
+ ${response } = DELETE ${BASE_URL } /indexer/partition/${part } /file/${id } expected_status=${expected_status }
72
66
RETURN None
73
67
74
68
75
69
Delete Partition
76
- [Arguments] ${partition } ${expected_status } =204
77
- ${response } = DELETE ${BASE_URL } /partition/${partition } expected_status=${expected_status }
70
+ [Arguments] ${part } ${expected_status } =204
71
+ ${response } = DELETE ${BASE_URL } /partition/${part } expected_status=${expected_status }
78
72
RETURN None
79
73
74
+ Get File Metadata
75
+ [Arguments] ${id } ${part } ${expected_status } =200 &{expected_metadata }
76
+ ${is_empty } = Evaluate not bool(${expected_metadata } )
77
+ Run Keyword If ${is_empty } Set Variable &{expected_metadata } Create Dictionary
78
+ ${response } = GET ${BASE_URL } /partition/${part } /file/${id } expected_status=${expected_status }
79
+ ${json_response } = Set Variable ${response.json() }
80
+ Log to Console ${json_response }
81
+ Log to Console ${json_response['metadata'] }
82
+ Run Keyword If '${expected_status } ' == '404 ' Should Be Equal As Strings ${json_response } [detail] File '${id } ' not found in partition '${part } '.
83
+ FOR ${key } IN @{expected_metadata.keys() }
84
+ Should Be Equal ${json_response['metadata']['${key }'] } ${expected_metadata['${key }'] }
85
+ END
86
+
80
87
*** Test Cases ***
81
88
Health Check
82
89
${response } = GET ${BASE_URL } /health_check expected_status=200
83
90
Should Be Equal As Strings ${response.json() } RAG API is up.
84
91
[Teardown]
85
92
93
+ Add File and Check Metadata
94
+ &{file_metadata } = Create Dictionary filename=eng.pdf partition=test file_id=0
95
+ Index File ${test_file_1 } 0 test
96
+ ${response } = Get File Metadata 0 test &{file_metadata }
97
+ [Teardown] Clean Up Test test
98
+
86
99
Add File and Patch it with new metadata
87
100
Index File ${test_file_2 } 0 test
88
101
${metadata } = Create Dictionary title=Test Title author=Test Author
89
102
${metadata } = Evaluate json.dumps(${metadata } ) json
90
103
Patch File 0 test ${metadata }
91
- ${response } = Get File Metadata 0 test
92
- Should Be Equal As Strings ${response } [title] Test Title
93
- Should Be Equal As Strings ${response } [author] Test Author
104
+ &{file_metadata } = Create Dictionary title=Test Title author=Test Author
105
+ ${response } = Get File Metadata 0 test &{file_metadata }
94
106
[Teardown] Clean Up Test test
95
107
96
-
97
108
Add File and Delete it
98
109
Index File ${test_file_1 } 0 test
99
110
Delete File 0 test
@@ -109,23 +120,30 @@ Add files to two partitions and search each partition
109
120
[Teardown] Clean Up Test test test2
110
121
111
122
112
-
113
- # Get Non Existent Task Status
114
- # ${response}= Get Task Status 82891771158d68c1eacb9d1f151391007f68c96901000000 404
115
- # Should Be Equal As Strings ${response}[detail] Task '82891771158d68c1eacb9d1f151391007f68c96901000000' not found.
116
- # Get Invalid Task Id Status (-1)
117
- # ${response}= Get Task Status -1 404
118
- # Should Be Equal As Strings ${response.json()}[detail] '-1' is not a valid task id.
119
- # Get Invalid Task Id Status (123)
120
- # ${response}= Get Task Status 123 400
121
- # Should Be Equal As Strings ${response.json()}[detail] '123' is not a valid task id.
122
-
123
- # Get Non Existent Extract
124
- # ${response}= Get Task Status 82891771158d68c1eacb9d1f151391007f68c96901000000 404
125
- # Should Be Equal As Strings ${response}[detail] Task '82891771158d68c1eacb9d1f151391007f68c96901000000' not found.
126
- # Get Invalid Extract Id (-1)
127
- # ${response}= Get Task Status -1 400
128
- # Should Be Equal As Strings ${response.json()}[detail] '-1' is not a valid task id.
129
- # Get Invalid Extract Id (123)
130
- # ${response}= Get Task Status 123 400
131
- # Should Be Equal As Strings ${response.json()}[detail] '123' is not a valid task id.
123
+ # Shoud Fail tests
124
+ Get Non Existent Task Status
125
+ ${response } = Get Task Status 82891771158d68c1eacb9d1f151391007f68c96901000000 404
126
+ Should Be Equal As Strings ${response } [detail] Task '82891771158d68c1eacb9d1f151391007f68c96901000000' not found.
127
+ Get Invalid Task Id Status (-1)
128
+ ${response } = Get Task Status -1 404
129
+ Should Be Equal As Strings ${response } [detail] Task '-1' not found.
130
+ Get Invalid Task Id Status (123)
131
+ ${response } = Get Task Status 123 404
132
+ Should Be Equal As Strings ${response } [detail] Task '123' not found.
133
+
134
+ Get Non Existent Extract
135
+ ${response } = Get Task Status 82891771158d68c1eacb9d1f151391007f68c96901000000 404
136
+ Should Be Equal As Strings ${response } [detail] Task '82891771158d68c1eacb9d1f151391007f68c96901000000' not found.
137
+ Get Invalid Extract Id (-1)
138
+ ${response } = Get Task Status -1 404
139
+ Should Be Equal As Strings ${response } [detail] Task '-1' not found.
140
+ Get Invalid Extract Id (123)
141
+ ${response } = Get Task Status 123 404
142
+ Should Be Equal As Strings ${response } [detail] Task '123' not found.
143
+
144
+ Get Non Existent File
145
+ Get File Metadata 0 test 404
146
+ Get Invalid File Id (-1)
147
+ Get File Metadata -1 test 404
148
+ Get Invalid File Id (`"&é\'-!/")
149
+ Get File Metadata "&é\'-!/ test 404
0 commit comments