@@ -117,59 +117,6 @@ def test_get_job_order(self):
117117 data = response .json ()
118118 self .assertEqual (data ['job_id' ], expected_jobs [i ].pk )
119119
120- def test_ready_jobs_with_current_event (self ):
121- """
122- If a branch is specified with "auto_cancel_push_events_except_current" then
123- jobs on the "current" event get priority over subsequent events. Basically
124- the normal sort of (-priority, created) gets changed to (created, -priority)
125- for those jobs.
126- """
127- url = reverse ('ci:client:get_job' )
128- user = utils .get_test_user ()
129-
130- recipes = []
131- for i in range (3 ):
132- recipe = utils .create_recipe (name = f'recipe{ i } ' , user = user )
133- recipe .priority = int (30 - 10 * i )
134- recipe .save ()
135- recipes .append (recipe )
136-
137- e0 = utils .create_event (user = user , cause = models .Event .PUSH )
138- e1 = utils .create_event (user = user , cause = models .Event .PUSH , commit1 = 12345 )
139-
140- jobs = []
141- for i in range (3 ):
142- jobs .append (utils .create_job (recipe = recipes [i ], event = e0 , user = user ))
143- for i in range (3 ):
144- jobs .append (utils .create_job (recipe = recipes [i ], event = e1 , user = user ))
145-
146- for job in jobs :
147- job .active = True
148- job .ready = True
149- job .save ()
150-
151- clients = []
152- for i in range (len (jobs )):
153- client = utils .create_client (name = f'client{ i } ' )
154- clients .append (client )
155-
156- url = reverse ('ci:client:get_job' )
157- post_data = {'build_keys' : [user .build_key ],
158- 'build_configs' : [jobs [0 ].config .name ]}
159-
160- repo_name = "%s/%s" % (e0 .base .branch .repository .user .name , e0 .base .branch .repository .name )
161- branch_name = e0 .base .branch .name
162- repo_settings = {repo_name : {"branch_settings" : {branch_name : {"auto_cancel_push_events_except_current" : True }}}}
163- with self .settings (INSTALLED_GITSERVERS = [utils .github_config (repo_settings = repo_settings )]):
164- self .set_counts ()
165- for i in range (len (jobs )):
166- post_data ['client_name' ] = clients [i ].name
167- response = self .client_post_json (url , post_data )
168- self .compare_counts (active_branches = 1 )
169- self .assertEqual (response .status_code , 200 )
170- data = response .json ()
171- self .assertEqual (data ['job_id' ], jobs [i ].pk )
172-
173120 def json_post_request (self , data ):
174121 jdata = json .dumps (data )
175122 return self .factory .post ('/' , jdata , content_type = 'application/json' )
0 commit comments