Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for add new client #888

Merged
merged 12 commits into from May 15, 2019

Conversation

2 participants
@beckmani
Copy link
Collaborator

commented May 12, 2019

Added new fixture: add_client
Added new test: Test that new client finishes bootstrap

@beckmani beckmani requested a review from antonlerner May 12, 2019

beckmani added some commits May 12, 2019

def add_client(request, setup_oracle, setup_poet, setup_bootstrap):

def _add_single_client():
bs_info = setup_bootstrap.pods[0]

This comment has been minimized.

Copy link
@antonlerner

antonlerner May 13, 2019

Member

if no bootstrap this will fail, add a message for that

This comment has been minimized.

Copy link
@beckmani

beckmani May 14, 2019

Author Collaborator

Done. Added check before.

cimage=testconfig['client']['image'],
centry=[testconfig['client']['command']])

cspec.append_args(bootnodes="{0}:{1}/{2}".format(bs_info['pod_ip'], '7513', bs_info['key']),

This comment has been minimized.

Copy link
@antonlerner

antonlerner May 13, 2019

Member

move port to constant variable


cspec.append_args(bootnodes="{0}:{1}/{2}".format(bs_info['pod_ip'], '7513', bs_info['key']),
oracle_server='http://{0}:3030'.format(setup_oracle),
poet_server='{0}:50002'.format(setup_poet),

This comment has been minimized.

Copy link
@antonlerner

antonlerner May 13, 2019

Member

same here


k8s_api = client.CoreV1Api()
resp = k8s_api.create_namespaced_pod(namespace=name_space, body=dep)
wait_for_pod_to_be_ready(resp.metadata._name, name_space, time_out=testconfig['deployment_ready_time_out'])

This comment has been minimized.

Copy link
@antonlerner

antonlerner May 13, 2019

Member

maybe we should have a different timeout for a single node than of a larger deployment

- name: client
image: spacemeshos/go-spacemesh:develop
imagePullPolicy: Always
args: ['--randcon', '3', '--bootstrap', '--test-mode', '--oracle_server', 'http://10.12.3.14:3030', '--grpc-server', '--json-server', '--bootnodes', '10.36.1.12:7513/26hRBJqMJPUnKgJ9VR6g3kH6aCQhZ9shBvhn3bEHDvRyv']

This comment has been minimized.

Copy link
@antonlerner

antonlerner May 13, 2019

Member

shouldn't this be parameterised?

This comment has been minimized.

Copy link
@beckmani

beckmani May 14, 2019

Author Collaborator

It is. we override it later

body=client.V1DeleteOptions(propagation_policy='Foreground',
grace_period_seconds=5))
except ApiException as e:
if e.status == 404:

This comment has been minimized.

Copy link
@antonlerner

antonlerner May 15, 2019

Member

what about other errors?

This comment has been minimized.

Copy link
@beckmani

beckmani May 15, 2019

Author Collaborator

This error may result from timing. (The pod may be delete before we get here)
Other error should not be ignored

try:
resp = client.CoreV1Api().read_namespaced_pod(name=pod_name, namespace=name_space)
except ApiException as e:
if e.status == 404:

This comment has been minimized.

Copy link
@antonlerner

antonlerner May 15, 2019

Member

what about other errors



@pytest.fixture()
def add_client(request, setup_oracle, setup_poet, setup_bootstrap, setup_clients):

This comment has been minimized.

Copy link
@antonlerner

antonlerner May 15, 2019

Member

add comment about this not being a functional fixture and shouldn't be used in our tests

This comment has been minimized.

Copy link
@beckmani

beckmani May 15, 2019

Author Collaborator

ok

dep = container_specs.update_deployment(dep)

k8s_api = client.CoreV1Api()
resp = k8s_api.create_namespaced_pod(namespace=name_space, body=dep)

This comment has been minimized.

Copy link
@antonlerner

antonlerner May 15, 2019

Member

if resp is error should we wait for pod to be ready?

def wait_for_pod_to_be_ready(pod_name, name_space, time_out=None):
total_sleep_time = 0
while True:
resp = client.CoreV1Api().read_namespaced_pod(name=pod_name, namespace=name_space)

This comment has been minimized.

Copy link
@antonlerner

antonlerner May 15, 2019

Member

can this return error? what should happen if so?

This comment has been minimized.

Copy link
@beckmani

beckmani May 15, 2019

Author Collaborator

I don't know. I havn't met an error here.
If we see that there are errors here we will handle them in the future

total_sleep_time = 0
while True:
try:
resp = client.CoreV1Api().read_namespaced_pod(name=pod_name, namespace=name_space)

This comment has been minimized.

Copy link
@antonlerner

antonlerner May 15, 2019

Member

can this return error? what should happen if so?

@beckmani beckmani merged commit c34887e into develop May 15, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.