Commit 0494a2f9 authored by Marco Buttu's avatar Marco Buttu
Browse files

Fix #156: the SRTMinorServo tests have to setup the ACS environment

parent ba09f6fc
Loading
Loading
Loading
Loading
+17 −14
Original line number Diff line number Diff line
@@ -3,10 +3,13 @@
import os
import time
import unittest
from subprocess import Popen, PIPE
from Acspy.Clients.SimpleClient import PySimpleClient
from testing.containers import Container

from acswrapper.system import acs
from acswrapper.containers import (
    Container, ContainerError, start_containers_and_wait,
    stop_containers_and_wait
)

__author__ = "Marco Buttu <mbuttu@oa-cagliari.inaf.it>"

@@ -17,27 +20,27 @@ class TestContainerCrash(unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        cls.containers = [
            Container('MinorServoContainer', 'cpp'),
        ]
        if not acs.is_running():
            acs.start()
        cls.containers = [Container('MinorServoContainer', 'cpp')]
        try:
            start_containers_and_wait(cls.containers)
        except ContainerError, ex:
            cls.fail(ex.message)

    @classmethod
    def tearDownClass(cls):
        stop_containers_and_wait(cls.containers)

    def setUp(self):
        self.client = PySimpleClient()
        for container in self.containers:
            container.start()
            container.wait_until_running()
            if not container.is_running():
                self.fail('cannot run %s' % container.name)

    def tearDown(self):
        self.client.disconnect()
        for container in self.containers:
            container.stop()

    def test_get_and_release_component(self):
        """The container must be alive after releasing the component"""
        srp = self.client.getComponent('MINORSERVO/SRP')
        self.client.getComponent('MINORSERVO/SRP')
        self.client.releaseComponent('MINORSERVO/SRP')
        time.sleep(3)
        for container in self.containers:
+18 −0
Original line number Diff line number Diff line
@@ -11,9 +11,15 @@ import Management
import MinorServo

from Acspy.Clients.SimpleClient import PySimpleClient
from acswrapper.system import acs
from acswrapper.containers import (
    Container, ContainerError, start_containers_and_wait,
    stop_containers_and_wait
)

__author__ = "Marco Buttu <mbuttu@oa-cagliari.inaf.it>"


FNULL = open(os.devnull, 'w')


@@ -23,6 +29,17 @@ class TestFailure(unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        if not acs.is_running():
            acs.start()
        cls.containers = [
            Container('MinorServoContainer', 'cpp'),
            Container('MinorServoBossContainer', 'cpp'),
        ]
        try:
            start_containers_and_wait(cls.containers)
        except ContainerError, ex:
            cls.fail(ex.message)

        cls.client = PySimpleClient()
        cls.boss = cls.client.getComponent('MINORSERVO/Boss')
        cls.srp = cls.client.getComponent('MINORSERVO/SRP')
@@ -31,6 +48,7 @@ class TestFailure(unittest.TestCase):
    def tearDownClass(cls):
        cls.client.releaseComponent('MINORSERVO/Boss')
        cls.client.releaseComponent('MINORSERVO/SRP')
        stop_containers_and_wait(cls.containers)

    def setUp(self):
        self.setup_code = "CCB" if self.telescope == "SRT" else "CCC"
+25 −7
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ import math
import time
import os
from datetime import datetime
from subprocess import Popen, PIPE

import unittest
import Management
@@ -13,7 +14,12 @@ import Antenna
from MinorServoErrors import MinorServoErrorsEx
from Acspy.Common.TimeHelper import getTimeStamp
from Acspy.Clients.SimpleClient import PySimpleClient
from Acspy.Util import ACSCorba

from acswrapper.system import acs
from acswrapper.containers import (
    Container, ContainerError, start_containers_and_wait,
    stop_containers_and_wait
)


__author__ = "Marco Buttu <mbuttu@oa-cagliari.inaf.it>"
@@ -24,17 +30,29 @@ class SetupTest(unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        cls.client = PySimpleClient()
        cls.boss = cls.client.getComponent('MINORSERVO/Boss')
        if not acs.is_running():
            acs.start()
        cls.containers = [
            Container('MinorServoContainer', 'cpp'),
            Container('MinorServoBossContainer', 'cpp'),
        ]
        try:
            start_containers_and_wait(cls.containers)
        except ContainerError, ex:
            cls.fail(ex.message)

    @classmethod
    def tearDownClass(cls):
        cls.client.releaseComponent('MINORSERVO/Boss')
        cls.client.disconnect()
        stop_containers_and_wait(cls.containers)

    def setUp(self):
        self.client = PySimpleClient()
        self.boss = self.client.getComponent('MINORSERVO/Boss')

    def tearDown(self):
        self.boss.park()
        self.wait_until_not_ready()
        self.client.releaseComponent('MINORSERVO/Boss')

    def test_elevation_tracking_ON(self):
        """The setup turns the elevation tracking on"""
+19 −0
Original line number Diff line number Diff line
@@ -15,15 +15,33 @@ from Acspy.Common.TimeHelper import getTimeStamp
from Acspy.Clients.SimpleClient import PySimpleClient
from Acspy.Util import ACSCorba

from acswrapper.system import acs
from acswrapper.containers import (
    Container, ContainerError, start_containers_and_wait,
    stop_containers_and_wait
)


__author__ = "Marco Buttu <mbuttu@oa-cagliari.inaf.it>"


class CannotSetupTest(unittest.TestCase):

    telescope = os.getenv('STATION')
    
    @classmethod
    def setUpClass(cls):
        if not acs.is_running():
            acs.start()
        cls.containers = [
            Container('MinorServoContainer', 'cpp'),
            Container('MinorServoBossContainer', 'cpp'),
        ]
        try:
            start_containers_and_wait(cls.containers)
        except ContainerError, ex:
            cls.fail(ex.message)

        cls.client = PySimpleClient()
        cls.boss = cls.client.getComponent('MINORSERVO/Boss')
        cls.pfp = cls.client.getComponent('MINORSERVO/PFP')
@@ -33,6 +51,7 @@ class CannotSetupTest(unittest.TestCase):
        cls.client.releaseComponent('MINORSERVO/Boss')
        cls.client.releaseComponent('MINORSERVO/PFP')
        cls.client.disconnect()
        stop_containers_and_wait(cls.containers)

    def test_setup_after_manual_movement(self):
        """Verify the setup completes after a manual movement"""