From 98e9b68b30642323b2341c177796a4feecea5d06 Mon Sep 17 00:00:00 2001
From: skrzepto <shims506@gmail.com>
Date: Aug 05 2016 13:22:49 +0000
Subject: [PATCH 1/7] creating a automated setup test env script


---

diff --git a/setup_test_env.sh b/setup_test_env.sh
new file mode 100644
index 0000000..d0c83fa
--- /dev/null
+++ b/setup_test_env.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+######
+# Warning this file uses sudo to install dependencies use at your own risk
+#####
+
+# Install dependencies
+sudo yum install gcc gcc-c++ sqlite-devel libffi-devel openssl-devel redhat-rpm-config
+
+# setup python virtualenv
+sudo yum install python-virtualenvwrapper postgresql postgresql-devel
+
+# have bash find mkvirutalenv
+source ~/.bashrc
+
+# Create hubs env
+mkvirtualenv hubs
+
+# activate hubs
+workon hubs
+
+# install python deps
+pip install -r requirements.txt
+pip install -r test-requirements.txt
+
+

From 5bbe2b9314d5a895a4382c7089a65f47fc561d9d Mon Sep 17 00:00:00 2001
From: skrzepto <shims506@gmail.com>
Date: Aug 05 2016 13:22:49 +0000
Subject: [PATCH 2/7] minimize user interaction, upgrade python packages if they are already installed, also temp fix for html5lib fiasco


---

diff --git a/setup_test_env.sh b/setup_test_env.sh
index d0c83fa..312c017 100644
--- a/setup_test_env.sh
+++ b/setup_test_env.sh
@@ -5,10 +5,10 @@
 #####
 
 # Install dependencies
-sudo yum install gcc gcc-c++ sqlite-devel libffi-devel openssl-devel redhat-rpm-config
+sudo yum install -y gcc gcc-c++ sqlite-devel libffi-devel openssl-devel redhat-rpm-config
 
 # setup python virtualenv
-sudo yum install python-virtualenvwrapper postgresql postgresql-devel
+sudo yum install -y python-virtualenvwrapper postgresql postgresql-devel
 
 # have bash find mkvirutalenv
 source ~/.bashrc
@@ -20,7 +20,8 @@ mkvirtualenv hubs
 workon hubs
 
 # install python deps
-pip install -r requirements.txt
-pip install -r test-requirements.txt
-
+pip install --upgrade -r requirements.txt
+pip install --upgrade -r test-requirements.txt
 
+# TEMPORARY: html5lib update is causing other apps to crash
+pip install html5lib==0.9999999

From ed036ee85cd48b074ee76ff7d15c694f9254e984 Mon Sep 17 00:00:00 2001
From: skrzepto <shims506@gmail.com>
Date: Aug 05 2016 13:22:49 +0000
Subject: [PATCH 3/7] removing the hubs env to make sure we have a clean env


---

diff --git a/setup_test_env.sh b/setup_test_env.sh
index 312c017..fed2ad4 100644
--- a/setup_test_env.sh
+++ b/setup_test_env.sh
@@ -13,6 +13,9 @@ sudo yum install -y python-virtualenvwrapper postgresql postgresql-devel
 # have bash find mkvirutalenv
 source ~/.bashrc
 
+# remove the hubs env
+rmvirtualenv hubs
+
 # Create hubs env
 mkvirtualenv hubs
 

From 398316873e796f4a281bbfd8fe8afb9689c0b474 Mon Sep 17 00:00:00 2001
From: skrzepto <shims506@gmail.com>
Date: Aug 05 2016 13:22:49 +0000
Subject: [PATCH 4/7] seperating fedora and python dependency install


---

diff --git a/setup_python_test_env.sh b/setup_python_test_env.sh
new file mode 100644
index 0000000..4681c75
--- /dev/null
+++ b/setup_python_test_env.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+
+# have bash find mkvirutalenv
+source ~/.bashrc
+
+# remove the hubs env
+rmvirtualenv hubs
+
+# Create hubs env
+mkvirtualenv hubs
+
+# activate hubs
+workon hubs
+
+# install python deps
+pip install --upgrade -r requirements.txt
+pip install --upgrade -r test-requirements.txt
+
+# TEMPORARY: html5lib update is causing other apps to crash
+pip install html5lib==0.9999999
diff --git a/setup_test_env.sh b/setup_test_env.sh
index fed2ad4..bee1732 100644
--- a/setup_test_env.sh
+++ b/setup_test_env.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 ######
 # Warning this file uses sudo to install dependencies use at your own risk
@@ -10,21 +10,4 @@ sudo yum install -y gcc gcc-c++ sqlite-devel libffi-devel openssl-devel redhat-r
 # setup python virtualenv
 sudo yum install -y python-virtualenvwrapper postgresql postgresql-devel
 
-# have bash find mkvirutalenv
-source ~/.bashrc
-
-# remove the hubs env
-rmvirtualenv hubs
-
-# Create hubs env
-mkvirtualenv hubs
-
-# activate hubs
-workon hubs
-
-# install python deps
-pip install --upgrade -r requirements.txt
-pip install --upgrade -r test-requirements.txt
-
-# TEMPORARY: html5lib update is causing other apps to crash
-pip install html5lib==0.9999999
+sh ./setup_python_test_env.sh

From 8cd3b19e3bcb3f0df2675de2079ed2501c7fc02a Mon Sep 17 00:00:00 2001
From: Eric Barbour <ebarbour@redhat.com>
Date: Aug 05 2016 13:22:49 +0000
Subject: [PATCH 5/7] Make test scripts executable and source hubs


---

diff --git a/runtest.sh b/runtest.sh
index ad0de9c..87fd265 100755
--- a/runtest.sh
+++ b/runtest.sh
@@ -1,3 +1,6 @@
 #!/bin/bash
+
+. ~/.virtualenvs/hubs/bin/activate || /bin/bash ./setup_python_test_env.sh
+
 HUBS_CONFIG=`pwd`/hubs/tests/hubs_test.cfg PYTHONPATH=. ./nosetests \
     --with-coverage --cover-erase --cover-package=hubs $*
diff --git a/setup_python_test_env.sh b/setup_python_test_env.sh
old mode 100644
new mode 100755
diff --git a/setup_test_env.sh b/setup_test_env.sh
old mode 100644
new mode 100755

From 8d6da466a1d89623a8efebfb3dcdbc7b4881d65a Mon Sep 17 00:00:00 2001
From: skrzepto <shims506@gmail.com>
Date: Aug 05 2016 13:22:49 +0000
Subject: [PATCH 6/7] Fixing up jenkins scripts


adding centos 7 specific dependency, adding jenkins python venv script

Adding fedora check to install specific packages for centos

adding jenkins runtest

adding jenkins specific venv setup

update setuptools on epel7

manually running test

working on getting jenkins to pass build in centos

adding coverage dep for unittest

removing unused file, forgot to cp the pygments lib

cleaning up and removing hardlink to use relative links

removing the python setup in the fedora dep setup

---

diff --git a/runtest_jenkins.sh b/runtest_jenkins.sh
new file mode 100644
index 0000000..0092438
--- /dev/null
+++ b/runtest_jenkins.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+PATH=$WORKSPACE/venv/bin:/usr/local/bin:$PATH
+
+if [ ! -d "venv" ]; then
+    virtualenv venv
+fi
+. venv/bin/activate
+
+# epel 7 specific python setup
+if ! grep -q "Fedora" /etc/os-release ; then
+    pip install --upgrade setuptools==18.5
+    cp -r /usr/lib/python2.7/site-packages/pygments_markdown_lexer $WORKSPACE/venv/lib/python2.7/site-packages/
+    cp -r /usr/lib/python2.7/site-packages/pygments_markdown_lexer-*-py2.7.egg-info $WORKSPACE/venv/lib/python2.7/site-packages/
+fi
+
+pip install -r requirements.txt
+pip install -r test-requirements.txt
+
+# Temporary: html5lib is breaking stability in some libraries
+pip install html5lib==0.9999999
+
+HUBS_CONFIG=$WORKSPACE/hubs/tests/hubs_test.cfg PYTHONPATH=. ./nosetests \
+    --cover-package=hubs $*
\ No newline at end of file
diff --git a/setup_test_env.sh b/setup_test_env.sh
index bee1732..d1d5305 100755
--- a/setup_test_env.sh
+++ b/setup_test_env.sh
@@ -7,7 +7,12 @@
 # Install dependencies
 sudo yum install -y gcc gcc-c++ sqlite-devel libffi-devel openssl-devel redhat-rpm-config
 
-# setup python virtualenv
-sudo yum install -y python-virtualenvwrapper postgresql postgresql-devel
+if ! grep -q "Fedora" /etc/os-release ; then
+    # Epel 7 specific
+    sudo yum install -y epel-release
+    sudo yum update -y
+    sudo yum install -y python-pip python-pygments-markdown-lexer
+fi
 
-sh ./setup_python_test_env.sh
+# setup python virtualenv
+sudo yum install -y python-virtualenvwrapper postgresql postgresql-devel
\ No newline at end of file
diff --git a/test-requirements.txt b/test-requirements.txt
index c1358b7..cb1dca7 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -2,3 +2,4 @@ nose
 vcrpy
 mock
 yanc
+coverage
\ No newline at end of file

From cd3b626908a4c230ef23b9897505d9c63a670b55 Mon Sep 17 00:00:00 2001
From: skrzepto <shims506@gmail.com>
Date: Aug 05 2016 13:37:10 +0000
Subject: [PATCH 7/7] updating so that when you copy and paste the script into jenkins build itll still run and added workspace specific route


---

diff --git a/runtest_jenkins.sh b/runtest_jenkins.sh
index 0092438..21ccee0 100644
--- a/runtest_jenkins.sh
+++ b/runtest_jenkins.sh
@@ -20,5 +20,5 @@ pip install -r test-requirements.txt
 # Temporary: html5lib is breaking stability in some libraries
 pip install html5lib==0.9999999
 
-HUBS_CONFIG=$WORKSPACE/hubs/tests/hubs_test.cfg PYTHONPATH=. ./nosetests \
-    --cover-package=hubs $*
\ No newline at end of file
+HUBS_CONFIG=$WORKSPACE/hubs/tests/hubs_test.cfg PYTHONPATH=. ./nosetests --cover-package=$WORKSPACE/hubs $*
+

