Created
May 15, 2019 05:31
-
-
Save Anakin-Hao/c36f02f93d454b397d976521439d71ad to your computer and use it in GitHub Desktop.
test infinispan failover
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from requests.auth import HTTPBasicAuth | |
import time | |
headers = {'Content-Type': 'application/json', 'performAsync': 'True', 'timeToLiveSeconds': '99999999999'} | |
body = {'test':123} | |
auth=HTTPBasicAuth('test', 'changeme') | |
baseurl = "http://infinispan-server-http/rest" | |
# baseurl = "http://infinispan-server-http.anakin-dev.svc.cluster.local/rest" | |
# 100.99.0.1 | |
# baseurl = "http://100.99.0.1:8080/rest" | |
# baseurl = "http://100.96.0.19:8080/rest" | |
def run(): | |
global headers | |
global body | |
global auth | |
while True: | |
print("") | |
start = time.time() | |
r = requests.get(f"{baseurl}/default/test", auth=auth, headers=headers, json=body, verify=False) | |
end = time.time() | |
print(r) | |
print(r.json()) | |
print(f"Time passed: {round(end - start, 3)}") | |
time.sleep(1) | |
def put(): | |
return requests.put(f"{baseurl}/default/test", auth=auth, headers=headers, json=body, verify=False) | |
put() | |
def delete(): | |
return requests.delete(f"{baseurl}/default/test", auth=auth, headers=headers, json=body, verify=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment