Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Chenhao Ma
core
Commits
4f55cf04
Commit
4f55cf04
authored
7 years ago
by
Megan Henning
Browse files
Options
Downloads
Patches
Plain Diff
Add tests
parent
72bd5e40
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/jobs/rules.py
+1
-1
1 addition, 1 deletion
api/jobs/rules.py
test/integration_tests/python/test_rules.py
+5
-0
5 additions, 0 deletions
test/integration_tests/python/test_rules.py
with
6 additions
and
1 deletion
api/jobs/rules.py
+
1
−
1
View file @
4f55cf04
...
...
@@ -93,7 +93,7 @@ def eval_match(match_type, match_param, file_, container):
elif
match_type
==
'
container.has-type
'
:
for
c_file
in
container
[
'
files
'
]:
c_file_type
=
c_file
.
get
(
'
type
'
)
if
c_file_type
and
match_param
.
lower
()
==
c_file_type
.
lower
()
if
c_file_type
and
match_param
.
lower
()
==
c_file_type
.
lower
()
:
return
True
return
False
...
...
This diff is collapsed.
Click to expand it.
test/integration_tests/python/test_rules.py
+
5
−
0
View file @
4f55cf04
...
...
@@ -376,6 +376,11 @@ def test_rules(randstr, data_builder, file_form, as_root, as_admin, with_user, a
)
assert
r
.
ok
# Ensure file without type or measurements does not cause issues with rule evalution
# upload file that matches only part of rule
r
=
as_admin
.
post
(
'
/projects/
'
+
project
+
'
/files
'
,
files
=
file_form
(
'
test3.notreal
'
))
assert
r
.
ok
# test that only one job was created via rule
gear_jobs
=
[
job
for
job
in
api_db
.
jobs
.
find
({
'
gear_id
'
:
gear_2
})]
assert
len
(
gear_jobs
)
==
2
...
...
This diff is collapsed.
Click to expand it.
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