Remove update on launch, we'll test this another way

This commit is contained in:
Matthew Jones
2014-03-17 12:52:23 -04:00
parent e0b72ff452
commit 1243e044a0

View File

@@ -1539,41 +1539,43 @@ class ProjectUpdatesTest(BaseTransactionTest):
self.job = Job.objects.create(**opts) self.job = Job.objects.create(**opts)
return self.job return self.job
def test_update_on_launch(self): # TODO: We need to test this another way due to concurrency conflicts
scm_url = getattr(settings, 'TEST_GIT_PUBLIC_HTTPS', # Will add some tests for the task runner system
'https://github.com/ansible/ansible.github.com.git') # def test_update_on_launch(self):
if not all([scm_url]): # scm_url = getattr(settings, 'TEST_GIT_PUBLIC_HTTPS',
self.skipTest('no public git repo defined for https!') # 'https://github.com/ansible/ansible.github.com.git')
self.organization = self.make_organizations(self.super_django_user, 1)[0] # if not all([scm_url]):
self.inventory = Inventory.objects.create(name='test-inventory', # self.skipTest('no public git repo defined for https!')
description='description for test-inventory', # self.organization = self.make_organizations(self.super_django_user, 1)[0]
organization=self.organization) # self.inventory = Inventory.objects.create(name='test-inventory',
self.host = self.inventory.hosts.create(name='host.example.com', # description='description for test-inventory',
inventory=self.inventory) # organization=self.organization)
self.group = self.inventory.groups.create(name='test-group', # self.host = self.inventory.hosts.create(name='host.example.com',
inventory=self.inventory) # inventory=self.inventory)
self.group.hosts.add(self.host) # self.group = self.inventory.groups.create(name='test-group',
self.credential = Credential.objects.create(name='test-creds', # inventory=self.inventory)
user=self.super_django_user) # self.group.hosts.add(self.host)
self.project = self.create_project( # self.credential = Credential.objects.create(name='test-creds',
name='my public git project over https', # user=self.super_django_user)
scm_type='git', # self.project = self.create_project(
scm_url=scm_url, # name='my public git project over https',
scm_update_on_launch=True, # scm_type='git',
) # scm_url=scm_url,
# First update triggered by saving a new project with SCM. # scm_update_on_launch=True,
self.assertEqual(self.project.project_updates.count(), 1) # )
self.check_project_update(self.project) # # First update triggered by saving a new project with SCM.
self.assertEqual(self.project.project_updates.count(), 2) # self.assertEqual(self.project.project_updates.count(), 1)
job_template = self.create_test_job_template() # self.check_project_update(self.project)
job = self.create_test_job(job_template=job_template) # self.assertEqual(self.project.project_updates.count(), 2)
self.assertEqual(job.status, 'new') # job_template = self.create_test_job_template()
self.assertFalse(job.passwords_needed_to_start) # job = self.create_test_job(job_template=job_template)
self.assertTrue(job.signal_start()) # self.assertEqual(job.status, 'new')
time.sleep(10) # Need some time to wait for the dependency to run # self.assertFalse(job.passwords_needed_to_start)
job = Job.objects.get(pk=job.pk) # self.assertTrue(job.signal_start())
self.assertTrue(job.status in ('successful', 'failed')) # time.sleep(10) # Need some time to wait for the dependency to run
self.assertEqual(self.project.project_updates.count(), 3) # job = Job.objects.get(pk=job.pk)
# self.assertTrue(job.status in ('successful', 'failed'))
# self.assertEqual(self.project.project_updates.count(), 3)
def test_update_on_launch_with_project_passwords(self): def test_update_on_launch_with_project_passwords(self):
scm_url = getattr(settings, 'TEST_GIT_PRIVATE_HTTPS', '') scm_url = getattr(settings, 'TEST_GIT_PRIVATE_HTTPS', '')