aboutsummaryrefslogtreecommitdiff
path: root/lava_scheduler_app
diff options
context:
space:
mode:
Diffstat (limited to 'lava_scheduler_app')
-rw-r--r--lava_scheduler_app/tests/devices/juno-r2-01.jinja213
-rw-r--r--lava_scheduler_app/tests/health-checks/juno-r2-uboot.yaml72
-rw-r--r--lava_scheduler_app/tests/health-checks/juno.yaml72
-rw-r--r--lava_scheduler_app/tests/test_pipeline.py49
4 files changed, 206 insertions, 0 deletions
diff --git a/lava_scheduler_app/tests/devices/juno-r2-01.jinja2 b/lava_scheduler_app/tests/devices/juno-r2-01.jinja2
new file mode 100644
index 000000000..76b51ddb9
--- /dev/null
+++ b/lava_scheduler_app/tests/devices/juno-r2-01.jinja2
@@ -0,0 +1,13 @@
+{% extends 'juno.jinja2' %}
+{% set exclusive = 'True' %}
+{% set hard_reset_command = '/usr/local/lab-scripts/snmp_pdu_control --hostname pdu01 --command reboot --port 21 --delay 10' %}
+{% set usb_device_id = 0 %}
+{% set usb_label = 'SanDiskCruzerBlade' %}
+{% set usb_uuid = 'usb-SanDisk_Cruzer_Blade_20043514231B72033C42-0:0' %}
+{% set power_off_command = '/usr/local/lab-scripts/snmp_pdu_control --hostname pdu01 --command off --port 21' %}
+{% set power_on_command = '/usr/local/lab-scripts/snmp_pdu_control --hostname pdu01 --command on --port 21' %}
+{% set connection_command = 'telnet localhost 7160' %}
+{% set usb_filesystem_label = 'JUNOR201' %}
+{% set device_ip = '10.66.16.33' %}
+{% set device_mac = '00:02:f7:00:68:3f' %}
+{% set vexpress_sky2_mac = '0x00,0x02,0xF7,0x00,0x68,0x3F' %}
diff --git a/lava_scheduler_app/tests/health-checks/juno-r2-uboot.yaml b/lava_scheduler_app/tests/health-checks/juno-r2-uboot.yaml
new file mode 100644
index 000000000..de7f69ddc
--- /dev/null
+++ b/lava_scheduler_app/tests/health-checks/juno-r2-uboot.yaml
@@ -0,0 +1,72 @@
+device_type: juno-r2
+
+job_name: juno-debian-nfs
+
+timeouts:
+ job:
+ minutes: 30
+ action:
+ minutes: 5
+ actions:
+ u-boot-interrupt:
+ seconds: 120
+ u-boot-commands:
+ seconds: 120
+ uboot-retry:
+ seconds: 180
+ connections:
+ u-boot-interrupt:
+ seconds: 120
+ u-boot-commands:
+ seconds: 120
+ uboot-retry:
+ seconds: 180
+
+priority: medium
+visibility: public
+
+context:
+ bootloader_prompt: juno#
+
+actions:
+
+- deploy:
+ namespace: recovery
+ timeout:
+ minutes: 10
+ to: vemsd
+ recovery_image:
+ url: http://releases.linaro.org/members/arm/platforms/17.04/juno-latest-oe-uboot.zip
+ compression: zip
+
+- deploy:
+ namespace: debian
+ timeout:
+ minutes: 2
+ to: nfs
+ os: debian
+ nfsrootfs:
+ url: http://images.validation.linaro.org/juno/debian-jessie-arm64-rootfs.tar.gz
+ compression: gz
+
+- boot:
+ namespace: debian
+ connection-namespace: recovery
+ method: u-boot
+ commands: norflash
+ auto_login:
+ login_prompt: 'login:'
+ username: root
+ prompts:
+ - root@(.*):~#
+
+- test:
+ namespace: debian
+ connection-namespace: recovery
+ timeout:
+ minutes: 5
+ definitions:
+ - repository: http://git.linaro.org/lava-team/lava-functional-tests.git
+ from: git
+ path: lava-test-shell/smoke-tests-basic.yaml
+ name: smoke-tests
diff --git a/lava_scheduler_app/tests/health-checks/juno.yaml b/lava_scheduler_app/tests/health-checks/juno.yaml
new file mode 100644
index 000000000..4f4c8820c
--- /dev/null
+++ b/lava_scheduler_app/tests/health-checks/juno.yaml
@@ -0,0 +1,72 @@
+device_type: juno
+
+job_name: juno-debian-nfs
+
+timeouts:
+ job:
+ minutes: 30
+ action:
+ minutes: 5
+ actions:
+ u-boot-interrupt:
+ seconds: 120
+ u-boot-commands:
+ seconds: 120
+ uboot-retry:
+ seconds: 180
+ connections:
+ u-boot-interrupt:
+ seconds: 120
+ u-boot-commands:
+ seconds: 120
+ uboot-retry:
+ seconds: 180
+
+priority: medium
+visibility: public
+
+context:
+ bootloader_prompt: juno#
+
+actions:
+
+- deploy:
+ namespace: recovery
+ timeout:
+ minutes: 10
+ to: vemsd
+ recovery_image:
+ url: http://releases.linaro.org/members/arm/platforms/17.04/juno-latest-oe-uboot.zip
+ compression: zip
+
+- deploy:
+ namespace: debian
+ timeout:
+ minutes: 2
+ to: nfs
+ os: debian
+ nfsrootfs:
+ url: http://images.validation.linaro.org/juno/debian-jessie-arm64-rootfs.tar.gz
+ compression: gz
+
+- boot:
+ namespace: debian
+ connection-namespace: recovery
+ method: u-boot
+ commands: norflash
+ auto_login:
+ login_prompt: 'login:'
+ username: root
+ prompts:
+ - root@(.*):~#
+
+- test:
+ namespace: debian
+ connection-namespace: recovery
+ timeout:
+ minutes: 5
+ definitions:
+ - repository: http://git.linaro.org/lava-team/lava-functional-tests.git
+ from: git
+ path: lava-test-shell/smoke-tests-basic.yaml
+ name: smoke-tests
diff --git a/lava_scheduler_app/tests/test_pipeline.py b/lava_scheduler_app/tests/test_pipeline.py
index 95c6a9948..fc3d33a4e 100644
--- a/lava_scheduler_app/tests/test_pipeline.py
+++ b/lava_scheduler_app/tests/test_pipeline.py
@@ -22,6 +22,7 @@ from lava_scheduler_app.tests.test_submission import ModelFactory, TestCaseWithF
from lava_scheduler_app.dbutils import (
testjob_submission,
find_device_for_job,
+ initiate_health_check_job,
end_job,
)
from lava_scheduler_app.schema import (
@@ -759,6 +760,54 @@ class TestPipelineSubmit(TestCaseWithFactory):
self.assertEqual(job_data['key'], 'value')
+class TestExtendsSubmit(TestCaseWithFactory):
+
+ def setUp(self):
+ super(TestExtendsSubmit, self).setUp()
+ Device.CONFIG_PATH = os.path.join(os.getcwd(), 'lava_scheduler_app', 'tests', 'devices')
+ Device.HEALTH_CHECK_PATH = os.path.join(os.getcwd(), 'lava_scheduler_app', 'tests', 'health-checks')
+ self.factory = YamlFactory()
+ self.device_type = self.factory.make_device_type(name='juno-r2')
+ self.factory.make_device(device_type=self.device_type, hostname="juno-r2-uboot-01")
+ self.factory.make_device(device_type=self.device_type, hostname="juno-r2-01")
+ logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
+ logger = logging.getLogger('lava_scheduler_app')
+ logger.disabled = True
+ logger.propagate = False
+ logger = logging.getLogger('lava-master')
+ logging.disable(logging.DEBUG)
+ logger.disabled = True
+ logger.propagate = False
+
+ def test_health_checks_extends(self):
+ device1 = Device.objects.get(hostname='juno-r2-uboot-01')
+ self.assertIsNotNone(Device.CONFIG_PATH)
+ self.assertIsNotNone(device1.load_configuration(output_format='raw'))
+ self.assertEqual('juno-r2-uboot', device1.get_extends())
+ self.assertIsNotNone(device1.HEALTH_CHECK_PATH)
+ self.assertTrue(
+ os.path.exists(
+ os.path.join(
+ Device.HEALTH_CHECK_PATH, "%s.yaml" % device1.get_extends())))
+ self.assertIsNotNone(initiate_health_check_job(device1))
+
+ def test_health_checks_dbname(self):
+ device2 = Device.objects.get(hostname='juno-r2-01')
+ self.assertIsNotNone(device2.load_configuration(output_format='raw'))
+ self.assertEqual('juno', device2.get_extends())
+ self.assertIsNotNone(device2.HEALTH_CHECK_PATH)
+ self.assertTrue(
+ os.path.exists(
+ os.path.join(
+ Device.HEALTH_CHECK_PATH, "%s.yaml" % device2.get_extends())))
+ # device_type specified in the job does not exist in the database
+ self.assertIsNone(initiate_health_check_job(device2))
+
+ device_type = self.factory.make_device_type(name='juno')
+ self.factory.make_device(device_type=device_type, hostname="juno-01")
+ self.assertIsNotNone(initiate_health_check_job(device2))
+
+
class TestYamlMultinode(TestCaseWithFactory):
def setUp(self):