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

Master #15

Merged
merged 2 commits into from
Mar 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#!groovy

@Library('SovrinHelpers') _

def name = 'plenum'

def testUbuntu = {
try {
echo 'Ubuntu Test: Checkout csm'
checkout scm

echo 'Ubuntu Test: Build docker image'
orientdb.start()

def testEnv = dockerHelpers.build(name)

testEnv.inside('--network host') {
echo 'Ubuntu Test: Install dependencies'
testHelpers.installDeps()

echo 'Ubuntu Test: Test'
sh 'python runner.py --pytest \"python -m pytest\" --output "test-result.txt"'
}
}
finally {
echo 'Ubuntu Test: Cleanup'
orientdb.stop()
step([$class: 'WsCleanup'])
}
}

def testWindows = {
echo 'TODO: Implement me'

/* win2016 for now (03-23-2017) is not supported by Docker for Windows
* (Hyper-V version), so we can't use linux containers
* https://github.com/docker/for-win/issues/448#issuecomment-276328342
*
* possible solutions:
* - use host-installed OrientDB (trying this one)
* - wait until Docker support will be provided for win2016
*/

//try {
// echo 'Windows Test: Checkout csm'
// checkout scm

// echo 'Windows Test: Build docker image'
// dockerHelpers.buildAndRunWindows(name, testHelpers.installDepsWindowsCommands() + ["cd C:\\test && python -m pytest -k orientdb --junit-xml=C:\\testOrig\\$testFile"] /*testHelpers.testJunitWindowsCommands()*/)
// junit 'test-result.xml'
//}
//finally {
// echo 'Windows Test: Cleanup'
// step([$class: 'WsCleanup'])
//}
}

def testWindowsNoDocker = {
try {
echo 'Windows No Docker Test: Checkout csm'
checkout scm

echo 'Windows No Docker Test: drop orientdb databases'
orientdb.cleanupWindows()

testHelpers.createVirtualEnvAndExecute({ python, pip ->
echo 'Windows No Docker Test: Install dependencies'
testHelpers.installDepsBat(python, pip)

echo 'Windows No Docker Test: Test'
bat "${python} runner.py --pytest \"${python} -m pytest\" --output \"test-result.txt\""
})
}
finally {
echo 'Windows No Docker Test: Cleanup'
step([$class: 'WsCleanup'])
}
}



testAndPublish(name, [ubuntu: testUbuntu, windows: testWindowsNoDocker, windowsNoDocker: testWindowsNoDocker])
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Plenum Byzantine Fault Tolerant Protocol
# Plenum Byzantine Fault Tolerant Protocol

[![Build Status](https://jenkins.evernym.com/buildStatus/icon?job=Plenum/master)](https://jenkins.evernym.com/job/Plenum/job/master/)

Plenum makes extensive use of coroutines and the async/await keywords in
Python, and as such, requires Python version 3.5.0 or later. Plenum also
Expand Down
26 changes: 26 additions & 0 deletions ci/ubuntu.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Development
FROM ubuntu:16.04

ARG uid=1000

# Install environment
RUN apt-get update -y
RUN apt-get install -y \
git \
wget \
python3.5 \
python3-pip \
python-setuptools \
python3-nacl
RUN pip3 install -U \
pip \
setuptools \
virtualenv
RUN useradd -ms /bin/bash -u $uid sovrin
USER sovrin
RUN virtualenv -p python3.5 /home/sovrin/test
USER root
RUN ln -sf /home/sovrin/test/bin/python /usr/local/bin/python
RUN ln -sf /home/sovrin/test/bin/pip /usr/local/bin/pip
USER sovrin
WORKDIR /home/sovrin
50 changes: 50 additions & 0 deletions ci/windows.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
FROM microsoft/windowsservercore

LABEL Description="plenum" Vendor="Evernym"

# Install environment

# Python
RUN powershell.exe -Command \
$ErrorActionPreference = 'Stop'; \
wget https://www.python.org/ftp/python/3.5.1/python-3.5.1.exe -OutFile c:\python-3.5.1.exe; \
Start-Process c:\python-3.5.1.exe -ArgumentList '/quiet InstallAllUsers=1 PrependPath=1' -Wait; \
Remove-Item c:\python-3.5.1.exe -Force

# Chocolate
RUN powershell.exe -Command \
$ErrorActionPreference = 'Stop'; \
"iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex"

# Git (using Chocolate)
RUN powershell.exe -Command \
$ErrorActionPreference = 'Stop'; \
choco install git -ArgumentList '-params /GitAndUnixTllsOnPath' -y -Wait

# PIP deps
RUN powershell.exe -Command \
$ErrorActionPreference = 'Stop'; \
pip install -U pip pytest


# MS Visual C++ Build Tools (using Chocolate)
RUN powershell.exe -Command \
$ErrorActionPreference = 'Stop'; \
choco install microsoft-build-tools -y -Wait


# unzip using chocolate
RUN powershell.exe -Command \
$ErrorActionPreference = 'Stop'; \
choco install unzip -y -Wait


# orientdb
#RUN powershell.exe -Command \
# $ErrorActionPreference = 'Stop'; \
# wget http://mkt.orientdb.com/CE-2217-windows -OutFile c:\orientdb-community.zip; \
# unzip c:\orientdb-community.zip
# Start-Process c:\python-3.5.1.exe -ArgumentList '/quiet InstallAllUsers=1 PrependPath=1' -Wait; \
# Remove-Item c:\orientdb-community.zip -Force; \
# Remove-Item orientdb-community* -Force; \

4 changes: 0 additions & 4 deletions plenum/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,11 @@
from __future__ import absolute_import, division, print_function

import sys

import plenum
from plenum.common.pkg_util import check_deps

if sys.version_info < (3, 5, 0):
raise ImportError("Python 3.5.0 or later required.")


import importlib
from .__metadata__ import *

check_deps(plenum)
6 changes: 1 addition & 5 deletions plenum/__metadata__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
"""
plenum package metadata
"""
__version_info__ = (0, 2)
__version_info__ = (0, 3)
__version__ = '.'.join(map(str, __version_info__))
__author__ = "Evernym, Inc."
__license__ = "Apache 2.0"

__all__ = ['__version_info__', '__version__', '__author__', '__license__']

__dependencies__ = {
"ledger": ">=0.0.34"
}
20 changes: 13 additions & 7 deletions runner.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import os
import re
import sys
import argparse


def run():
log("Preparing test suite")
def run(pytest, output_file):
log("Preparing test suite with {}".format(pytest))
testListFile = "test_list.txt"
os.system('pytest --collect-only > {}'.format(testListFile))
os.system('{} --collect-only > {}'.format(pytest, testListFile))
log("Reading collected modules file")
collectedData = open(testListFile).read()
os.remove(testListFile)
Expand Down Expand Up @@ -37,7 +38,7 @@ def run():
for test in testList:
# testRep = '{}.rep'.format(test.split("/")[-1])
log("Going to run {}".format(test))
r = os.system('pytest -k "{}" > {}'.format(test, testRep))
r = os.system('{} -k "{}" > {}'.format(pytest, test, testRep))
reportLines = open(testRep).readlines()
output = ''.join(reportLines)
pas = passPat.search(output)
Expand Down Expand Up @@ -110,9 +111,9 @@ def run():
for fm, fn in allErrorTests:
log('{}:{}'.format(fm, fn))

if failureData:
if failureData and output_file:
log("Writing failure data in Test-Report.txt")
with open('../Test-Report.txt', 'w') as f:
with open(output_file, 'w') as f:
f.write(summaryMsg)
f.write(''.join(failureData))

Expand All @@ -128,5 +129,10 @@ def log(msg):


if __name__ == "__main__":
r = run()
parser = argparse.ArgumentParser()
parser.add_argument('--pytest', type=str, help='pytest instance', default='python -m pytest')
parser.add_argument('--output', type=str, help='result file', default='../Test-Report.txt')
parser.add_argument('--nooutput', help='no result file', action="store_true")
args = parser.parse_args()
r = run(pytest=args.pytest, output_file=args.output if not args.nooutput else None)
sys.exit(0 if r == 0 else 1)
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
os.makedirs(BASE_DIR)

setup(
name='plenum',
name='plenum-dev',
version=__version__,
description='Plenum Byzantine Fault Tolerant Protocol',
long_description='Plenum Byzantine Fault Tolerant Protocol',
Expand All @@ -61,8 +61,9 @@
data_files=[(
(BASE_DIR, ['data/pool_transactions_sandbox', ])
)],
install_requires=['raet', 'jsonpickle', 'portalocker==0.5.7',
'prompt_toolkit==0.57', 'pyorient', 'pygments', 'ledger',
install_requires=['ledger-dev',
'raet', 'jsonpickle', 'portalocker==0.5.7',
'prompt_toolkit==0.57', 'pyorient', 'pygments',
'ioflo==1.5.4', 'semver', 'base58', 'orderedset',
'sortedcontainers==1.5.7', 'psutil'],
extras_require={
Expand Down