Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(52)

Delta Between Two Patch Sets: tests/200_deploy.test

Issue 56640044: added amulet testing scaffold
Left Patch Set: Created 10 years, 2 months ago
Right Patch Set: added amulet testing scaffold Created 10 years, 1 month ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « tests/00_setup.sh ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 #!/usr/bin/env python3 1 #!/usr/bin/env python3
2 2
3 import amulet 3 import amulet
4 import requests 4 import requests
5 from pymongo import MongoClient
5 6
6 ######################################################### 7 #########################################################
7 # Test Quick Config 8 # Test Quick Config
8 ######################################################### 9 #########################################################
9 scale = 1 10 scale = 1
10 seconds = 1400 11 seconds = 1400
11 12
12 ######################################################### 13 #########################################################
13 # 3shard cluster configuration 14 # 3shard cluster configuration
14 ######################################################### 15 #########################################################
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 def validate_running_services(): 72 def validate_running_services():
72 for service in sentry_dict: 73 for service in sentry_dict:
73 output = sentry_dict[service].run('service mongodb status') 74 output = sentry_dict[service].run('service mongodb status')
74 service_active = str(output).find('mongodb start/running') 75 service_active = str(output).find('mongodb start/running')
75 if service_active == -1: 76 if service_active == -1:
76 message = "Failed to find running MongoDB on host {}".format(service ) 77 message = "Failed to find running MongoDB on host {}".format(service )
77 amulet.raise_status(amulet.SKIP, msg=message) 78 amulet.raise_status(amulet.SKIP, msg=message)
78 79
79 80
80 ############################################################# 81 #############################################################
82 # Validate connectivity from $WORLD
83 #############################################################
84 def validate_world_connectivity():
85 client = MongoClient(d.sentry.unit['mongos/0'].info['public-address'])
86
87 db = client['test']
88 #Can we successfully insert?
89 insert_id = db.amulet.insert({'assert': True})
90 if insert_id is None:
91 amulet.raise_status(amulet.FAIL, msg="Failed to insert test data")
92 #Can we delete from a shard using the Mongos hub?
93 result = db.amulet.remove(insert_id)
94 if result['err'] is not None:
95 amulet.raise_status(amulet.FAIL, msg="Failed to remove test data")
96
97
98 #############################################################
81 # Validate relationships 99 # Validate relationships
82 ############################################################# 100 #############################################################
83 #broken pending 1273312 101 #broken pending 1273312
84 def validate_relationships(): 102 def validate_relationships():
85 d.sentry.unit['configsvr/0'].relation('configsvr', 'mongos:mongos-cfg') 103 d.sentry.unit['configsvr/0'].relation('configsvr', 'mongos:mongos-cfg')
86 d.sentry.unit['shard1/0'].relation('database', 'mongos:mongos') 104 d.sentry.unit['shard1/0'].relation('database', 'mongos:mongos')
87 d.sentry.unit['shard2/0'].relation('database', 'mongos:mongos') 105 d.sentry.unit['shard2/0'].relation('database', 'mongos:mongos')
106 print(d.sentry.unit['shard1/0'].relation('database', 'mongos:mongos'))
88 107
89 108
90 def validate_manual_connection(): 109 def validate_manual_connection():
91 output, code = d.sentry.unit['shard1/0'].run("mongo {}".format( 110 output, code = d.sentry.unit['shard1/0'].run("mongo {}".format(
92 d.sentry.unit['mongos/0'].info['public-address'])) 111 d.sentry.unit['mongos/0'].info['public-address']))
93 if code != 0: 112 if code != 0:
94 message = "Manual Connection failed for unit shard1" 113 message = "Manual Connection failed for unit shard1"
95 amulet.raise_status(amulet.SKIP, msg=message) 114 amulet.raise_status(amulet.SKIP, msg=message)
96 115
97 output, code = d.sentry.unit['shard2/0'].run("mongo {}".format( 116 output, code = d.sentry.unit['shard2/0'].run("mongo {}".format(
98 d.sentry.unit['mongos/0'].info['public-address'])) 117 d.sentry.unit['mongos/0'].info['public-address']))
99 if code != 0: 118 if code != 0:
100 message = "Manual Connection failed for unit shard2" 119 message = "Manual Connection failed for unit shard2"
101 amulet.raise_status(amulet.SKIP, msg=message) 120 amulet.raise_status(amulet.SKIP, msg=message)
102 121
103 122
104 validate_status_interface() 123 validate_status_interface()
105 validate_running_services() 124 validate_running_services()
106 #validate_relationships() 125 #validate_relationships()
107 validate_manual_connection() 126 validate_manual_connection()
127 validate_world_connectivity()
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b