def test_positive_run_concurrent_jobs(self, fixture_vmsetup, module_org): """Tests Ansible REX concurent jobs without batch trigger :id: ad0f108c-03f2-49c7-8732-b1056570567b :Steps: 0. Create 2 hosts, disable foreman_tasks_proxy_batch_trigger 1. Run Ansible Command job with concurrency-setting :expectedresults: multiple asserts along the code :CaseAutomation: Automated :customerscenario: true :CaseLevel: System :BZ: 1817320 :parametrized: yes """ param_name = 'foreman_tasks_proxy_batch_trigger' GlobalParameter().set({'name': param_name, 'value': 'false'}) clients = fixture_vmsetup output_msgs = [] invocation_command = make_job_invocation({ 'job-template': 'Run Command - Ansible Default', 'inputs': 'command="ls"', 'search-query': f'name ~ {clients[0].hostname} or name ~ {clients[1].hostname}', 'concurrency-level': 2, }) for vm in clients: output_msgs.append('host output from {}: {}'.format( vm.hostname, ' '.join( JobInvocation.get_output({ 'id': invocation_command['id'], 'host': vm.hostname })), )) result = JobInvocation.info({'id': invocation_command['id']}) assert result['success'] == '2', output_msgs GlobalParameter().delete({'name': param_name}) assert len(GlobalParameter().list({'search': param_name})) == 0
def test_positive_delete_by_name(self): """Check if Global Param can be deleted :id: 2c44d9c9-2a21-4415-8e89-cfd3d963891b :expectedresults: Global Param is deleted :CaseImportance: Critical """ name = 'opt-%s' % gen_string('alpha', 10) value = 'val-%s %s' % (gen_string('alpha', 10), gen_string( 'alpha', 10)) GlobalParameter().set({'name': name, 'value': value}) GlobalParameter().delete({'name': name}) result = GlobalParameter().list({'search': name}) self.assertEqual(len(result), 0)
def test_positive_list_by_name(self): """Test Global Param List :id: 8dd6c4e8-4ec9-4bee-8a04-f5788960973a :expectedresults: Global Param List is displayed :CaseImportance: Critical """ name = 'opt-%s' % gen_string('alpha', 10) value = 'val-%s %s' % (gen_string('alpha', 10), gen_string( 'alpha', 10)) GlobalParameter().set({'name': name, 'value': value}) result = GlobalParameter().list({'search': name}) self.assertEqual(len(result), 1) self.assertEqual(result[0]['value'], value)
def test_positive_delete_by_name(self): """Check if Global Param can be deleted @Feature: Global Param - Delete @Assert: Global Param is deleted """ name = 'opt-%s' % gen_string('alpha', 10) value = 'val-%s %s' % (gen_string('alpha', 10), gen_string( 'alpha', 10)) GlobalParameter().set({ 'name': name, 'value': value, }) GlobalParameter().delete({'name': name}) result = GlobalParameter().list({'search': name}) self.assertEqual(len(result), 0)
def test_positive_list_by_name(self): """Test Global Param List @Feature: Global Param - List @Assert: Global Param List is displayed """ name = 'opt-%s' % gen_string('alpha', 10) value = 'val-%s %s' % (gen_string('alpha', 10), gen_string( 'alpha', 10)) GlobalParameter().set({ 'name': name, 'value': value, }) result = GlobalParameter().list({'search': name}) self.assertEqual(len(result), 1) self.assertEqual(result[0]['value'], value)
def test_positive_set(self): """Check if Global Param can be set :id: af0d3338-d7a1-41e5-959a-289ebc326c5b :expectedresults: Global Param is set :CaseImportance: Critical """ name = 'opt-%s' % gen_string('alpha', 10) value = 'val-%s %s' % (gen_string('alpha', 10), gen_string( 'alpha', 10)) GlobalParameter().set({'name': name, 'value': value})
def test_delete(self): """ @Feature: Global Param - Delete @Test: Check if Global Param can be deleted @Assert: Global Param is deleted """ name = "opt-%s" % generate_string("alpha", 10) val_part1 = generate_string("alpha", 10) val_part2 = generate_string("alpha", 10) value = "val-%s %s" % (val_part1, val_part2) result = GlobalParameter().set({ 'name': name, 'value': value}) self.assertEquals(result.return_code, 0, "GlobalParameter set - exit code %d" % result.return_code) result = GlobalParameter().delete({'name': name}) self.assertEquals(result.return_code, 0, "GlobalParameter delete - exit code %d" % result.return_code) result = GlobalParameter().list({'search': name}) self.assertTrue(len(result.stdout) == 0, "GlobalParameter list - deleted item is not listed")
def test_positive_list_delete_by_name(): """Test Global Param List :id: 8dd6c4e8-4ec9-4bee-8a04-f5788960973a :expectedresults: Global Param is set, listed, and deleted by name """ alphastring = partial(gen_string, 'alpha', 10) name = f'opt-{alphastring()}' value = f'val-{alphastring()} {alphastring()}' # Create GlobalParameter().set({'name': name, 'value': value}) # List by name result = GlobalParameter().list({'search': name}) assert len(result) == 1 assert result[0]['value'] == value # Delete GlobalParameter().delete({'name': name}) assert len(GlobalParameter().list({'search': name})) == 0
def test_positive_set(self): """Check if Global Param can be set @Feature: Global Param - Set @Assert: Global Param is set """ name = 'opt-%s' % gen_string('alpha', 10) value = 'val-%s %s' % (gen_string('alpha', 10), gen_string( 'alpha', 10)) GlobalParameter().set({ 'name': name, 'value': value, })
def test_list(self): """@Test: Test Global Param List @Feature: Global Param - List @Assert: Global Param List is displayed """ name = "opt-%s" % gen_string("alpha", 10) val_part1 = gen_string("alpha", 10) val_part2 = gen_string("alpha", 10) value = "val-%s %s" % (val_part1, val_part2) result = GlobalParameter().set({'name': name, 'value': value}) self.assertEquals( result.return_code, 0, "GlobalParameter set - exit code %d" % result.return_code) result = GlobalParameter().list({'search': name}) self.assertEquals( result.return_code, 0, "GlobalParameter list - exit code %d" % result.return_code) self.assertEquals(len(result.stdout), 1, "GlobalParameter list - stdout has one record") self.assertEquals(result.stdout[0]['value'], value, "GlobalParameter list - value matches")
def test_positive_set(self): """Check if Global Param can be set @id: af0d3338-d7a1-41e5-959a-289ebc326c5b @Assert: Global Param is set """ name = 'opt-%s' % gen_string('alpha', 10) value = 'val-%s %s' % ( gen_string('alpha', 10), gen_string('alpha', 10)) GlobalParameter().set({ 'name': name, 'value': value, })
def test_set(self): """@Test: Check if Global Param can be set @Feature: Global Param - Set @Assert: Global Param is set """ name = "opt-%s" % gen_string("alpha", 10) val_part1 = gen_string("alpha", 10) val_part2 = gen_string("alpha", 10) value = "val-%s %s" % (val_part1, val_part2) result = GlobalParameter().set({'name': name, 'value': value}) self.assertEquals( result.return_code, 0, "GlobalParameter set - exit code %d" % result.return_code)