Run console tests inside the Docker image.

This commit is contained in:
Ramon Novoa 2016-09-19 15:14:01 +02:00
parent 254a5ef1f8
commit ec352d16e1
17 changed files with 29 additions and 47 deletions

View File

@ -1,26 +1,8 @@
sudo: required sudo: required
language: python
python:
- 2.7
addons:
firefox: "latest"
services: services:
- docker - docker
before_install:
- sudo apt-get install xvfb
install:
- pip install selenium PyVirtualDisplay testtools
before_script:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- sleep 3 # give xvfb some time to start
script: script:
- docker run --name pandorafms -h pandorafms -dt -v "$TRAVIS_BUILD_DIR:/tmp/pandorafms" -p 127.0.0.1:8080:80 pandorafms/pandorafms-base tail -f /var/log/messages - docker run --name pandorafms -h pandorafms -dt -v "$TRAVIS_BUILD_DIR:/tmp/pandorafms" -p 127.0.0.1:8080:80 pandorafms/pandorafms-base tail -f /var/log/messages
- docker exec -t pandorafms /tmp/pandorafms/tests/test.sh - docker exec -t pandorafms /tmp/pandorafms/tests/test.sh

View File

@ -12,7 +12,7 @@ from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException from selenium.common.exceptions import NoAlertPresentException
from selenium.webdriver.remote.webelement import WebElement from selenium.webdriver.remote.webelement import WebElement
import unittest, time, re import unittest2, time, re
class ACLPropagation(PandoraWebDriverTestCase): class ACLPropagation(PandoraWebDriverTestCase):
@ -177,4 +177,4 @@ class ACLTags(PandoraWebDriverTestCase):
self.assertEqual(modules,[]) self.assertEqual(modules,[])
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest2.main()

View File

@ -13,7 +13,7 @@ from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException from selenium.common.exceptions import NoAlertPresentException
from selenium.webdriver.remote.webelement import WebElement from selenium.webdriver.remote.webelement import WebElement
import unittest, time, re import unittest2, time, re
class Bulk_operations(PandoraWebDriverTestCase): class Bulk_operations(PandoraWebDriverTestCase):
@ -268,4 +268,4 @@ class Bulk_operations(PandoraWebDriverTestCase):
self.assertIsInstance(element,WebElement) self.assertIsInstance(element,WebElement)
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest2.main()

View File

@ -12,7 +12,7 @@ from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException from selenium.common.exceptions import NoAlertPresentException
from selenium.webdriver.remote.webelement import WebElement from selenium.webdriver.remote.webelement import WebElement
import unittest, time, re import unittest2, time, re
class Collections(PandoraWebDriverTestCase): class Collections(PandoraWebDriverTestCase):
@ -82,4 +82,4 @@ class Collections(PandoraWebDriverTestCase):
self.assertEqual(element,[]) self.assertEqual(element,[])
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest2.main()

View File

@ -14,7 +14,7 @@ from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import StaleElementReferenceException, NoSuchElementException from selenium.common.exceptions import StaleElementReferenceException, NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException from selenium.common.exceptions import NoAlertPresentException
from selenium.webdriver.remote.webelement import WebElement from selenium.webdriver.remote.webelement import WebElement
import unittest, time, re import unittest2, time, re
class Miscellaneous (PandoraWebDriverTestCase): class Miscellaneous (PandoraWebDriverTestCase):
@ -62,5 +62,5 @@ class Miscellaneous (PandoraWebDriverTestCase):
self.assertIsInstance(element,WebElement) self.assertIsInstance(element,WebElement)
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest2.main()

View File

@ -9,7 +9,7 @@ from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import StaleElementReferenceException from selenium.common.exceptions import StaleElementReferenceException
from include.module_functions import * from include.module_functions import *
import unittest, time, re import unittest2, time, re
class Network_server_module(PandoraWebDriverTestCase): class Network_server_module(PandoraWebDriverTestCase):
@ -54,5 +54,5 @@ class Network_server_module(PandoraWebDriverTestCase):
break break
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest2.main()

View File

@ -13,7 +13,7 @@ from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException from selenium.common.exceptions import NoAlertPresentException
from selenium.webdriver.remote.webelement import WebElement from selenium.webdriver.remote.webelement import WebElement
import unittest, time, re, datetime import unittest2, time, re, datetime
class PAN13(PandoraWebDriverTestCase): class PAN13(PandoraWebDriverTestCase):
@ -162,4 +162,4 @@ class PAN13(PandoraWebDriverTestCase):
self.assertNotEqual(event_who_should_be_present_b,[]) self.assertNotEqual(event_who_should_be_present_b,[])
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest2.main()

View File

@ -11,7 +11,7 @@ from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException from selenium.common.exceptions import NoAlertPresentException
from selenium.webdriver.remote.webelement import WebElement from selenium.webdriver.remote.webelement import WebElement
import unittest, time, re import unittest2, time, re
class Policies(PandoraWebDriverTestCase): class Policies(PandoraWebDriverTestCase):
@ -130,4 +130,4 @@ class Policies(PandoraWebDriverTestCase):
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest2.main()

View File

@ -14,7 +14,7 @@ from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException from selenium.common.exceptions import NoAlertPresentException
from selenium.webdriver.remote.webelement import WebElement from selenium.webdriver.remote.webelement import WebElement
import unittest, time, re import unittest2, time, re
class SimpleService(PandoraWebDriverTestCase): class SimpleService(PandoraWebDriverTestCase):
@ -275,4 +275,4 @@ class ManualService(PandoraWebDriverTestCase):
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest2.main()

View File

@ -9,7 +9,7 @@ from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException from selenium.common.exceptions import NoAlertPresentException
from selenium.webdriver.remote.webelement import WebElement from selenium.webdriver.remote.webelement import WebElement
import unittest, time, re import unittest2, time, re
class Users(PandoraWebDriverTestCase): class Users(PandoraWebDriverTestCase):
@ -41,5 +41,5 @@ class Users(PandoraWebDriverTestCase):
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest2.main()

View File

@ -8,7 +8,7 @@ from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException from selenium.common.exceptions import NoAlertPresentException
import unittest, time, re import unittest2, time, re
def activate_api(driver,api_pwd): def activate_api(driver,api_pwd):

View File

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from unittest import TestResult, TestCase from unittest2 import TestResult, TestCase
from common_functions_60 import * from common_functions_60 import *
from datetime import datetime from datetime import datetime
from pyvirtualdisplay import Display from pyvirtualdisplay import Display
@ -52,7 +52,7 @@ class PandoraWebDriverTestCase(TestCase):
cls.display = Display(visible=0, size=(800, 600)) cls.display = Display(visible=0, size=(800, 600))
cls.display.start() cls.display.start()
cls.driver = webdriver.Firefox() cls.driver = webdriver.Firefox()
cls.base_url = "http://127.0.0.1:8080/" cls.base_url = "http://127.0.0.1/"
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):

View File

@ -6,7 +6,7 @@ from selenium.webdriver.support import expected_conditions as EC
import random, time import random, time
import string import string
import unittest import unittest2
def is_enterprise(func): def is_enterprise(func):
u""" u"""
@ -22,7 +22,7 @@ def is_enterprise(func):
if is_enterprise: if is_enterprise:
return func(*args,**kwargs) return func(*args,**kwargs)
else: else:
raise unittest.SkipTest("Skipping test") raise unittest2.SkipTest("Skipping test")
return inner return inner

View File

@ -8,7 +8,7 @@ from module_functions import create_module
from selenium.webdriver.support.ui import Select from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException from selenium.common.exceptions import NoAlertPresentException
import unittest, time, re import unittest2, time, re
def create_policy(driver,policy_name,group,description=None): def create_policy(driver,policy_name,group,description=None):

View File

@ -1,5 +1,5 @@
#!/usr/bin/env python #!/usr/bin/env python
from unittest import * from unittest2 import *
from console.include.common_functions_60 import * from console.include.common_functions_60 import *
from console.include.common_classes_60 import * from console.include.common_classes_60 import *
#from sauceclient import SauceClient #from sauceclient import SauceClient
@ -15,7 +15,7 @@ is_enterprise = '1' == getenv('ENTERPRISE', False)
a = TestLoader() a = TestLoader()
tests = a.discover(start_dir='console',pattern='*.py') tests = a.discover(start_dir='console',pattern='ACL.py')
c = ArticaTestResult() c = ArticaTestResult()
tests.run(c) tests.run(c)

View File

@ -6,7 +6,7 @@ from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import StaleElementReferenceException from selenium.common.exceptions import StaleElementReferenceException
import unittest, time, re import unittest2, time, re
class PAN3(PandoraWebDriverTestCase): class PAN3(PandoraWebDriverTestCase):
@ -67,5 +67,5 @@ class PAN3(PandoraWebDriverTestCase):
break break
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest2.main()

View File

@ -1,5 +1,5 @@
#!/usr/bin/env python #!/usr/bin/env python
from unittest import * from unittest2 import *
from console import * from console import *
from console.include.common_functions_60 import * from console.include.common_functions_60 import *
from console.include.common_classes_60 import * from console.include.common_classes_60 import *