Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
sbroad
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
sbroad
Commits
d228151e
Commit
d228151e
authored
1 year ago
by
Arseniy Volynets
Browse files
Options
Downloads
Patches
Plain Diff
fix: rewrite tests to pass, when exists sq returns > 1 row
parent
523ba256
No related branches found
No related tags found
1 merge request
!392
fix: rewrite tests to pass, when exists sq returns > 1 row
Pipeline
#33837
failed
1 year ago
Stage: build
Stage: test
Stage: stress-test
Stage: stress-test-processing
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sbroad-cartridge/test_app/test/integration/operators_test.lua
+20
-10
20 additions, 10 deletions
...ad-cartridge/test_app/test/integration/operators_test.lua
with
20 additions
and
10 deletions
sbroad-cartridge/test_app/test/integration/operators_test.lua
+
20
−
10
View file @
d228151e
...
...
@@ -452,14 +452,19 @@ g.test_exists_subquery_with_several_rows = function ()
-- Exists condition should return true on each row from testing_space
-- as soon as it's subquery always returns two rows.
local
_
,
err
=
api
:
call
(
"sbroad.execute"
,
{
[[
local
r
,
err
=
api
:
call
(
"sbroad.execute"
,
{
[[
SELECT * FROM "testing_space" WHERE EXISTS (SELECT 0 FROM "t" WHERE "t"."id" = 1 or "t"."a" = (?))
]]
,
{
require
(
'decimal'
).
new
(
6
.
66
)}
})
t
.
assert_str_contains
(
tostring
(
err
),
"Failed to execute SQL statement: Expression subquery returned more than 1 row"
)
t
.
assert_equals
(
err
,
nil
)
t
.
assert_equals
(
r
,
{
metadata
=
{
{
name
=
"id"
,
type
=
"integer"
},
{
name
=
"name"
,
type
=
"string"
},
{
name
=
"product_units"
,
type
=
"integer"
},
},
rows
=
{
{
1
,
"123"
,
1
}
},
})
end
g
.
test_not_exists_subquery_with_several_rows
=
function
()
...
...
@@ -467,15 +472,20 @@ g.test_not_exists_subquery_with_several_rows = function()
-- NotExists condition should return false on each row from testing_space
-- as soon as it's subquery always returns two rows.
local
_
,
err
=
api
:
call
(
"sbroad.execute"
,
{
[[
local
r
,
err
=
api
:
call
(
"sbroad.execute"
,
{
[[
SELECT * FROM "testing_space"
WHERE NOT EXISTS (SELECT 0 FROM "t" WHERE "t"."id" = 1 or "t"."a" = (?))
]]
,
{
require
(
'decimal'
).
new
(
6
.
66
)}
})
t
.
assert_str_contains
(
tostring
(
err
),
"Failed to execute SQL statement: Expression subquery returned more than 1 row"
)
t
.
assert_equals
(
err
,
nil
)
t
.
assert_equals
(
r
,
{
metadata
=
{
{
name
=
"id"
,
type
=
"integer"
},
{
name
=
"name"
,
type
=
"string"
},
{
name
=
"product_units"
,
type
=
"integer"
},
},
rows
=
{},
})
end
g
.
test_exists_nested
=
function
()
...
...
This diff is collapsed.
Click to expand it.
Andrey Strochuk
@andrewio
mentioned in issue
#584 (closed)
·
1 year ago
mentioned in issue
#584 (closed)
mentioned in issue #584
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment