-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.py
35 lines (27 loc) · 829 Bytes
/
tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import pyeureka
app = 'pyeureka-test'
eureka_url = 'http://localhost:8761'
heartbeat = 5.0
instance = {
'ipAddr': '127.0.0.1',
'app': app,
'instanceId': 'pozdrawiam'
}
print("[II] Eureka address: {}".format(eureka_url))
print("[II] Service definition")
print(instance)
service_wrapper = pyeureka.SimpleEurekaServiceWrapper(
eureka_url, instance, heartbeat)
print("[II] Registering service")
service_wrapper.run()
print("[II] Creating client")
client_wrapper = pyeureka.SimpleEurekaClientWrapper(eureka_url)
print("[II] Fetching app data")
app_data = client_wrapper.app(app)
print(app_data)
print("[II] Interpreting app data")
print("[II] Client should connect to: {}".format(
app_data['application']['instance'][0]['ipAddr']))
print("[II] Stopping service")
service_wrapper.stop()
print("[II] Done.")