Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
ffa70949
Commit
ffa70949
authored
Dec 22, 2021
by
Andrejs Cunskis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
E2E: Move custom resource comparison logic to resource base
parent
80efecbd
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
44 additions
and
137 deletions
+44
-137
qa/qa/ee/resource/epic.rb
qa/qa/ee/resource/epic.rb
+1
-16
qa/qa/ee/resource/group_iteration.rb
qa/qa/ee/resource/group_iteration.rb
+1
-16
qa/qa/resource/base.rb
qa/qa/resource/base.rb
+24
-0
qa/qa/resource/group_badge.rb
qa/qa/resource/group_badge.rb
+1
-16
qa/qa/resource/group_base.rb
qa/qa/resource/group_base.rb
+3
-9
qa/qa/resource/group_milestone.rb
qa/qa/resource/group_milestone.rb
+1
-16
qa/qa/resource/issue.rb
qa/qa/resource/issue.rb
+1
-16
qa/qa/resource/label_base.rb
qa/qa/resource/label_base.rb
+1
-16
qa/qa/resource/merge_request.rb
qa/qa/resource/merge_request.rb
+1
-16
qa/qa/resource/project.rb
qa/qa/resource/project.rb
+1
-16
qa/qa/resource/user.rb
qa/qa/resource/user.rb
+9
-0
No files found.
qa/qa/ee/resource/epic.rb
View file @
ffa70949
...
@@ -80,27 +80,12 @@ module QA
...
@@ -80,27 +80,12 @@ module QA
parse_body
(
response
)
parse_body
(
response
)
end
end
# Object comparison
#
# @param [QA::EE::Resource::Epic] other
# @return [Boolean]
def
==
(
other
)
other
.
is_a?
(
Epic
)
&&
comparable_epic
==
other
.
comparable_epic
end
# Override inspect for a better rspec failure diff output
#
# @return [String]
def
inspect
JSON
.
pretty_generate
(
comparable_epic
)
end
protected
protected
# Return subset of fields for comparing epics
# Return subset of fields for comparing epics
#
#
# @return [Hash]
# @return [Hash]
def
comparable
_epic
def
comparable
reload!
if
api_response
.
nil?
reload!
if
api_response
.
nil?
api_resource
.
slice
(
api_resource
.
slice
(
...
...
qa/qa/ee/resource/group_iteration.rb
View file @
ffa70949
...
@@ -124,27 +124,12 @@ module QA
...
@@ -124,27 +124,12 @@ module QA
GQL
GQL
end
end
# Object comparison
#
# @param [QA::EE::Resource::GroupIteration] other
# @return [Boolean]
def
==
(
other
)
other
.
is_a?
(
GroupIteration
)
&&
comparable_iteration
==
other
.
comparable_iteration
end
# Override inspect for a better rspec failure diff output
#
# @return [String]
def
inspect
JSON
.
pretty_generate
(
comparable_iteration
)
end
protected
protected
# Return subset of fields for comparing iterations
# Return subset of fields for comparing iterations
#
#
# @return [Hash]
# @return [Hash]
def
comparable
_iteration
def
comparable
reload!
unless
api_response
reload!
unless
api_response
api_response
.
slice
(
api_response
.
slice
(
...
...
qa/qa/resource/base.rb
View file @
ffa70949
...
@@ -179,6 +179,30 @@ module QA
...
@@ -179,6 +179,30 @@ module QA
QA
::
Support
::
Waiter
.
wait_until
(
max_duration:
max_duration
,
sleep_interval:
sleep_interval
,
&
block
)
QA
::
Support
::
Waiter
.
wait_until
(
max_duration:
max_duration
,
sleep_interval:
sleep_interval
,
&
block
)
end
end
# Object comparison
#
# @param [QA::Resource::Base] other
# @return [Boolean]
def
==
(
other
)
other
.
is_a?
(
self
.
class
)
&&
comparable
==
other
.
comparable
end
# Override inspect for a better rspec failure diff output
#
# @return [String]
def
inspect
JSON
.
pretty_generate
(
comparable
)
end
protected
# Custom resource comparison logic using resource attributes from api_resource
#
# @return [Hash]
def
comparable
raise
(
"comparable method needs to be implemented in order to compare resources via '=='"
)
end
private
private
def
attribute_value
(
name
,
block
)
def
attribute_value
(
name
,
block
)
...
...
qa/qa/resource/group_badge.rb
View file @
ffa70949
...
@@ -39,27 +39,12 @@ module QA
...
@@ -39,27 +39,12 @@ module QA
# @return [String]
# @return [String]
def
resource_web_url
(
_resource
);
end
def
resource_web_url
(
_resource
);
end
# Object comparison
#
# @param [QA::Resource::GroupBadge] other
# @return [Boolean]
def
==
(
other
)
other
.
is_a?
(
GroupBadge
)
&&
comparable_badge
==
other
.
comparable_badge
end
# Override inspect for a better rspec failure diff output
#
# @return [String]
def
inspect
JSON
.
pretty_generate
(
comparable_badge
)
end
protected
protected
# Return subset of fields for comparing badges
# Return subset of fields for comparing badges
#
#
# @return [Hash]
# @return [Hash]
def
comparable
_badge
def
comparable
reload!
unless
api_response
reload!
unless
api_response
api_response
.
slice
(
api_response
.
slice
(
...
...
qa/qa/resource/group_base.rb
View file @
ffa70949
...
@@ -123,18 +123,12 @@ module QA
...
@@ -123,18 +123,12 @@ module QA
end
end
# Object comparison
# Object comparison
# Override to make sure we are comparing descendands of GroupBase
#
#
# @param [QA::Resource::GroupBase] other
# @param [QA::Resource::GroupBase] other
# @return [Boolean]
# @return [Boolean]
def
==
(
other
)
def
==
(
other
)
other
.
is_a?
(
GroupBase
)
&&
comparable_group
==
other
.
comparable_group
other
.
is_a?
(
GroupBase
)
&&
comparable
==
other
.
comparable
end
# Override inspect for a better rspec failure diff output
#
# @return [String]
def
inspect
JSON
.
pretty_generate
(
comparable_group
)
end
end
protected
protected
...
@@ -142,7 +136,7 @@ module QA
...
@@ -142,7 +136,7 @@ module QA
# Return subset of fields for comparing groups
# Return subset of fields for comparing groups
#
#
# @return [Hash]
# @return [Hash]
def
comparable
_group
def
comparable
reload!
if
api_response
.
nil?
reload!
if
api_response
.
nil?
api_resource
.
slice
(
api_resource
.
slice
(
...
...
qa/qa/resource/group_milestone.rb
View file @
ffa70949
...
@@ -56,27 +56,12 @@ module QA
...
@@ -56,27 +56,12 @@ module QA
end
end
end
end
# Object comparison
#
# @param [QA::Resource::GroupMilestone] other
# @return [Boolean]
def
==
(
other
)
other
.
is_a?
(
GroupMilestone
)
&&
comparable_milestone
==
other
.
comparable_milestone
end
# Override inspect for a better rspec failure diff output
#
# @return [String]
def
inspect
JSON
.
pretty_generate
(
comparable_milestone
)
end
protected
protected
# Return subset of fields for comparing milestones
# Return subset of fields for comparing milestones
#
#
# @return [Hash]
# @return [Hash]
def
comparable
_milestone
def
comparable
reload!
unless
api_response
reload!
unless
api_response
api_response
.
slice
(
api_response
.
slice
(
...
...
qa/qa/resource/issue.rb
View file @
ffa70949
...
@@ -95,27 +95,12 @@ module QA
...
@@ -95,27 +95,12 @@ module QA
)
)
end
end
# Object comparison
#
# @param [QA::Resource::Issue] other
# @return [Boolean]
def
==
(
other
)
other
.
is_a?
(
Issue
)
&&
comparable_issue
==
other
.
comparable_issue
end
# Override inspect for a better rspec failure diff output
#
# @return [String]
def
inspect
JSON
.
pretty_generate
(
comparable_issue
)
end
protected
protected
# Return subset of fields for comparing issues
# Return subset of fields for comparing issues
#
#
# @return [Hash]
# @return [Hash]
def
comparable
_issue
def
comparable
reload!
if
api_response
.
nil?
reload!
if
api_response
.
nil?
api_resource
.
slice
(
api_resource
.
slice
(
...
...
qa/qa/resource/label_base.rb
View file @
ffa70949
...
@@ -49,27 +49,12 @@ module QA
...
@@ -49,27 +49,12 @@ module QA
}
}
end
end
# Object comparison
#
# @param [QA::Resource::GroupBase] other
# @return [Boolean]
def
==
(
other
)
other
.
is_a?
(
LabelBase
)
&&
comparable_label
==
other
.
comparable_label
end
# Override inspect for a better rspec failure diff output
#
# @return [String]
def
inspect
JSON
.
pretty_generate
(
comparable_label
)
end
protected
protected
# Return subset of fields for comparing labels
# Return subset of fields for comparing labels
#
#
# @return [Hash]
# @return [Hash]
def
comparable
_label
def
comparable
reload!
unless
api_response
reload!
unless
api_response
api_response
.
slice
(
api_response
.
slice
(
...
...
qa/qa/resource/merge_request.rb
View file @
ffa70949
...
@@ -168,27 +168,12 @@ module QA
...
@@ -168,27 +168,12 @@ module QA
)
)
end
end
# Object comparison
#
# @param [QA::Resource::MergeRequest] other
# @return [Boolean]
def
==
(
other
)
other
.
is_a?
(
MergeRequest
)
&&
comparable_mr
==
other
.
comparable_mr
end
# Override inspect for a better rspec failure diff output
#
# @return [String]
def
inspect
JSON
.
pretty_generate
(
comparable_mr
)
end
protected
protected
# Return subset of fields for comparing merge requests
# Return subset of fields for comparing merge requests
#
#
# @return [Hash]
# @return [Hash]
def
comparable
_mr
def
comparable
reload!
if
api_response
.
nil?
reload!
if
api_response
.
nil?
api_resource
.
except
(
api_resource
.
except
(
...
...
qa/qa/resource/project.rb
View file @
ffa70949
...
@@ -372,27 +372,12 @@ module QA
...
@@ -372,27 +372,12 @@ module QA
api_post_to
(
api_wikis_path
,
title:
title
,
content:
content
)
api_post_to
(
api_wikis_path
,
title:
title
,
content:
content
)
end
end
# Object comparison
#
# @param [QA::Resource::Project] other
# @return [Boolean]
def
==
(
other
)
other
.
is_a?
(
Project
)
&&
comparable_project
==
other
.
comparable_project
end
# Override inspect for a better rspec failure diff output
#
# @return [String]
def
inspect
JSON
.
pretty_generate
(
comparable_project
)
end
protected
protected
# Return subset of fields for comparing projects
# Return subset of fields for comparing projects
#
#
# @return [Hash]
# @return [Hash]
def
comparable
_project
def
comparable
reload!
if
api_response
.
nil?
reload!
if
api_response
.
nil?
api_resource
.
slice
(
api_resource
.
slice
(
...
...
qa/qa/resource/user.rb
View file @
ffa70949
...
@@ -181,6 +181,15 @@ module QA
...
@@ -181,6 +181,15 @@ module QA
)
)
end
end
protected
# Compare users by username and password
#
# @return [Array]
def
comparable
[
username
,
password
]
end
private
private
def
ldap_post_body
def
ldap_post_body
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment