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

Full build on branch #832

Merged
merged 12 commits into from Apr 28, 2019
@@ -144,7 +144,16 @@ dockerrun-test: dockerbuild-test
ifndef ES_PASSWD
$(error ES_PASSWD is not set)
endif
docker run -e ES_PASSWD="$(ES_PASSWD)" -e GOOGLE_APPLICATION_CREDENTIALS=./spacemesh.json -it go-spacemesh-python pytest -s test_bs.py --tc-file=config.yaml --tc-format=yaml
docker run -e ES_PASSWD="$(ES_PASSWD)" -e GOOGLE_APPLICATION_CREDENTIALS=./spacemesh.json -it go-spacemesh-python pytest -s hare/test_hare.py --tc-file=hare/config.yaml --tc-format=yaml
docker run -e ES_PASSWD="$(ES_PASSWD)" \
-e GOOGLE_APPLICATION_CREDENTIALS=./spacemesh.json \
-e CLIENT_DOCKER_IMAGE="spacemeshos/$(DOCKER_IMAGE_REPO):$(BRANCH)" \
-it go-spacemesh-python pytest -s test_bs.py --tc-file=config.yaml --tc-format=yaml
docker run -e ES_PASSWD="$(ES_PASSWD)" \
-e GOOGLE_APPLICATION_CREDENTIALS=./spacemesh.json \
-e CLIENT_DOCKER_IMAGE="spacemeshos/$(DOCKER_IMAGE_REPO):$(BRANCH)" \
-it go-spacemesh-python pytest -s hare/test_hare.py --tc-file=hare/config.yaml --tc-format=yaml
.PHONY: dockerrun-test

dockerrun-all: dockerpush dockerrun-test
.PHONY: dockerrun-all

@@ -30,6 +30,15 @@ def load_config():
raise Exception("KUBECONFIG file not found: {0}".format(kube_config_path))


@pytest.fixture(scope='session')
def set_docker_images():
docker_image = os.getenv('CLIENT_DOCKER_IMAGE', '')
if docker_image:
print("Set docker images to: {0}".format(docker_image))

This comment has been minimized.

Copy link
@antonlerner

antonlerner Apr 28, 2019

Member

where is this printed? maybe we should store it in a log file in case we cant see the print?

This comment has been minimized.

Copy link
@beckmani

beckmani Apr 28, 2019

Author Collaborator

Currently we don't have log for tests other than stdout

testconfig['bootstrap']['image'] = docker_image
testconfig['client']['image'] = docker_image


@pytest.fixture(scope='session')
def session_id():
return random_id(length=5)
@@ -60,3 +69,7 @@ def fin():
request.addfinalizer(fin)
return _setup_namespace()


@pytest.fixture(scope='session')
def init_session(request, load_config, set_namespace, set_docker_images, session_id):
return session_id
@@ -4,7 +4,7 @@ config_map_name: conf

script_on_exit: '' #'./k8s/log-client-pods.sh'

genesis_delta: 90
genesis_delta: 120
deployment_ready_time_out: 120

bootstrap:
@@ -2,7 +2,7 @@
from elasticsearch_dsl import Search, Q
from pytest_testconfig import config as testconfig

from tests.fixtures import set_namespace, load_config, session_id
from tests.fixtures import set_namespace, load_config, init_session, set_docker_images, session_id
from tests.test_bs import setup_clients, save_log_on_exit, setup_oracle, setup_bootstrap, create_configmap
from tests.test_bs import get_elastic_search_api
from tests.test_bs import current_index, wait_genesis
@@ -75,7 +75,7 @@ def query_hare_output_set(indx, namespace, client_po_name):
EFK_LOG_PROPAGATION_DELAY = 10


def test_hare_sanity(set_namespace, setup_clients, save_log_on_exit):
def test_hare_sanity(setup_clients, save_log_on_exit):
wait_genesis()
# Need to wait for 1 full iteration + the time it takes the logs to propagate to ES
delay = int(testconfig['client']['args']['hare-round-duration-sec']) * NUM_OF_EXPECTED_ROUNDS + \
@@ -1,6 +1,6 @@
from datetime import datetime, timedelta

from tests.fixtures import DeploymentInfo, load_config, set_namespace, session_id
from tests.fixtures import load_config, DeploymentInfo
from tests.fixtures import init_session, set_namespace, set_docker_images, session_id
import os
from os import path
import pytest
@@ -190,9 +190,9 @@ def fin():


@pytest.fixture(scope='module')
def setup_bootstrap(request, load_config, setup_oracle, create_configmap, session_id):
def setup_bootstrap(request, init_session, setup_oracle, create_configmap):

bootstrap_deployment_info = DeploymentInfo(dep_id=session_id)
bootstrap_deployment_info = DeploymentInfo(dep_id=init_session)

def _setup_bootstrap_in_namespace(name_space):
bootstrap_args = {} if 'args' not in testconfig['bootstrap'] else testconfig['bootstrap']['args']
@@ -363,15 +363,15 @@ def save_log_on_exit(request):
current_index = 'kubernetes_cluster-' + todaydate


def test_bootstrap(set_namespace, setup_bootstrap):
def test_bootstrap(setup_bootstrap):
# wait for the bootstrap logs to be available in ElasticSearch
time.sleep(5)
assert setup_bootstrap.pods[0]['key'] == query_bootstrap_es(current_index,
testconfig['namespace'],
setup_bootstrap.pods[0]['name'])


def test_client(set_namespace, setup_clients, save_log_on_exit):
def test_client(setup_clients, save_log_on_exit):
fields = {'M':'discovery_bootstrap'}
timetowait = len(setup_clients.pods)/2
print("Sleeping " + str(timetowait) + " before checking out bootstrap results")
@@ -380,7 +380,7 @@ def test_client(set_namespace, setup_clients, save_log_on_exit):
assert peers == len(setup_clients.pods)


def test_gossip(set_namespace, setup_clients):
def test_gossip(setup_clients):
fields = {'M':'new_gossip_message', 'protocol': 'api_test_gossip'}
# *note*: this already waits for bootstrap so we can send the msg right away.
# send message to client via rpc
@@ -404,7 +404,7 @@ def test_gossip(set_namespace, setup_clients):
assert len(setup_clients.pods) == peers_for_gossip


def test_transaction(set_namespace, setup_clients):
def test_transaction(setup_clients):

# Make sure the genesis time is over
wait_genesis()
@@ -426,10 +426,9 @@ def test_transaction(set_namespace, setup_clients):
assert '{"value":"ok"}' in out.decode("utf-8")
print("submit transaction ok")
print("wait for confirmation ")

api = 'v1/balance'
data = '{"address":"222"}'
start = time.time()
end = start = time.time()

for x in range(10):
time.sleep(60)
@@ -439,6 +438,6 @@ def test_transaction(set_namespace, setup_clients):
end = time.time()
break

print("test took ", end - start, "seconds ")
print("test took {:.3f} seconds ".format(end-start))
assert '{"value":"100"}' in out.decode("utf-8")
print("balance ok")
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.