summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Moreau Simard <dmsimard@redhat.com>2018-06-29 12:40:19 -0400
committerDavid Moreau Simard <dmsimard@redhat.com>2018-06-29 13:36:27 -0400
commitc4c6645795291401eaf8c2e96bd16808bafaf2f9 (patch)
treef4d0620ee2320a119f64990c696fe73d5d15963a
parent369df5943582b970d0cfabc17419d345463a7cc8 (diff)
Fix trailing slashes in validation script, add hosts and resultsHEADmaster
Hosts and results were not validated, add them here so they have basic coverage. Change-Id: I3e4623668f5549246f0c3b944d7604a3f9ebe7a3
Notes
Notes (review): Code-Review+2: David Moreau Simard <dmsimard@redhat.com> Workflow+1: David Moreau Simard <dmsimard@redhat.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Fri, 29 Jun 2018 20:38:52 +0000 Reviewed-on: https://review.openstack.org/579219 Project: openstack/ara-server Branch: refs/heads/master
-rw-r--r--hacking/validate.py42
1 files changed, 36 insertions, 6 deletions
diff --git a/hacking/validate.py b/hacking/validate.py
index 615bf19..2743e77 100644
--- a/hacking/validate.py
+++ b/hacking/validate.py
@@ -37,39 +37,69 @@ def validate_task(task):
37 assert task['completed'] 37 assert task['completed']
38 38
39 39
40def validate_host(host):
41 assert 'facts' in host
42 assert 'ansible_user_id' in host['facts']
43
44
45def validate_result(result):
46 assert 'content' in result
47 assert 'ansible_facts' in result['content']
48 assert 'status' in result
49 assert result['status'] == 'ok'
50
51
40def main(): 52def main():
41 client = AraOfflineClient() 53 client = AraOfflineClient()
42 54
43 playbooks = client.get('/api/v1/playbooks/') 55 playbooks = client.get('/api/v1/playbooks')
44 assert len(playbooks['results']) == 1 56 assert len(playbooks['results']) == 1
45 assert playbooks['count'] == 1 57 assert playbooks['count'] == 1
46 validate_playbook(playbooks['results'][0]) 58 validate_playbook(playbooks['results'][0])
47 59
48 playbook = client.get( 60 playbook = client.get(
49 '/api/v1/playbooks/%s/' % playbooks['results'][0]['id'] 61 '/api/v1/playbooks/%s' % playbooks['results'][0]['id']
50 ) 62 )
51 validate_playbook(playbook) 63 validate_playbook(playbook)
52 64
53 plays = client.get('/api/v1/plays/') 65 plays = client.get('/api/v1/plays')
54 assert len(plays['results']) == 2 66 assert len(plays['results']) == 2
55 assert plays['count'] == 2 67 assert plays['count'] == 2
56 validate_play(plays['results'][0]) 68 validate_play(plays['results'][0])
57 69
58 play = client.get( 70 play = client.get(
59 '/api/v1/plays/%s/' % plays['results'][0]['id'] 71 '/api/v1/plays/%s' % plays['results'][0]['id']
60 ) 72 )
61 validate_play(play) 73 validate_play(play)
62 74
63 tasks = client.get('/api/v1/tasks/') 75 tasks = client.get('/api/v1/tasks')
64 assert len(tasks['results']) == 8 76 assert len(tasks['results']) == 8
65 assert tasks['count'] == 8 77 assert tasks['count'] == 8
66 validate_task(tasks['results'][0]) 78 validate_task(tasks['results'][0])
67 79
68 task = client.get( 80 task = client.get(
69 '/api/v1/tasks/%s/' % tasks['results'][0]['id'] 81 '/api/v1/tasks/%s' % tasks['results'][0]['id']
70 ) 82 )
71 validate_task(task) 83 validate_task(task)
72 84
85 hosts = client.get('/api/v1/hosts')
86 assert len(hosts['results']) == 2
87 assert hosts['count'] == 2
88 validate_host(hosts['results'][0])
89
90 host = client.get(
91 '/api/v1/hosts/%s' % plays['results'][0]['hosts'][0]['id']
92 )
93 validate_host(host)
94
95 results = client.get('/api/v1/results')
96 assert len(results['results']) == 8
97 assert results['count'] == 8
98 validate_result(results['results'][0])
99
100 result = client.get('/api/v1/results/1')
101 validate_result(result)
102
73 client.log.info('All assertions passed.') 103 client.log.info('All assertions passed.')
74 104
75 105