Skip to content

Commit

Permalink
spinnman_integration_tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed May 22, 2024
1 parent ab352f6 commit b3932c1
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/python_actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
call:
uses: SpiNNakerManchester/SupportScripts/.github/workflows/python_checks.yml@main
with:
base-package: spinnman spinnman_integration_tests
base-package: spinnman
dependencies: SpiNNUtils SpiNNMachine
test_directories: unittests
flake8-packages: spinnman unittests
test_directories: unittests spinnman_integration_tests
flake8-packages: spinnman unittests spinnman_integration_tests
secrets: inherit
13 changes: 13 additions & 0 deletions spinnman_integration_tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright (c) 2024 The University of Manchester
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
72 changes: 72 additions & 0 deletions spinnman_integration_tests/test_job.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Copyright (c) 2024 The University of Manchester
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import os
import unittest

from spinn_utilities.config_holder import set_config

from spinn_machine.version import FIVE
from spinnman.config_setup import unittest_setup
from spinnman.spalloc import SpallocClient, SpallocState


class TestTransceiver(unittest.TestCase):

def setUp(self):
unittest_setup()
set_config("Machine", "version", FIVE)
self.spalloc_url = "https://spinnaker.cs.man.ac.uk/spalloc"
self.spalloc_machine = "SpiNNaker1M"
self.spalloc_user = os.environ["SPALLOC_USER"]
self.spalloc_password = os.environ["SPALLOC_PASSWORD"]

def test_create_job(self):
client = SpallocClient(
self.spalloc_url, self.spalloc_user, self.spalloc_password)
# job = client.create_job_rect_at_board(
# WIDTH, HEIGHT, triad=(x, y, b), machine_name=SPALLOC_MACHINE,
# max_dead_boards=1)
job = client.create_job(
num_boards=2, machine_name=self.spalloc_machine)
with job:
job.wait_until_ready()

connections = job.get_connections()
self.assertGreaterEqual(len(connections), 2)
self.assertIn((0,0), connections)

txrx = job.create_transceiver()

dims = txrx._get_machine_dimensions()
# May be 12 as we only asked for 2 boards
self.assertGreaterEqual(dims.height, 12)
self.assertGreaterEqual(dims.width, 12)

machine = txrx.get_machine_details()
self.assertGreaterEqual(len(machine.ethernet_connected_chips), 2)

state = job.get_state()
self.assertEqual(state, SpallocState.READY)

credentials = job.get_session_credentials_for_db()
self.assertIn(('SPALLOC', 'service uri'), credentials)
self.assertIn(('SPALLOC', 'job uri'), credentials)
self.assertIn(('COOKIE', 'JSESSIONID'), credentials)
self.assertIn(('HEADER', 'X-CSRF-TOKEN'), credentials)

client.close() # print(2^(1/(2^1)

if __name__ == '__main__':
unittest.main()

0 comments on commit b3932c1

Please sign in to comment.