Skip to content

Commit

Permalink
Merge branch 'dev' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
iaj2 committed Nov 29, 2023
2 parents 542cd55 + 7622012 commit 1e1fabb
Show file tree
Hide file tree
Showing 24 changed files with 71 additions and 68 deletions.
29 changes: 15 additions & 14 deletions .github/workflows/python-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,46 +3,47 @@ name: Python Integration Test
on:
push:
branches:
- dev
- staging
- main
paths-ignore:
- version
pull_request:
branches:
- dev
- staging
- main
paths-ignore:
- version

jobs:
test:
name: Integration Tests
runs-on: ubuntu-latest
runs-on: [self-hosted, linux, ARM64]
strategy:
fail-fast: false
matrix:
python-version: ["3.9"]

steps:
- name: Checkout
- name: Checkout (PR)
if: ${{ github.event_name == 'pull_request'}}
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Checkout

- name: Checkout (Push)
if: ${{ github.event_name == 'push'}}
uses: actions/checkout@v3
with:
ref: ${{ github.ref_name }}

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
python -m venv venv_test
source venv_test/bin/activate
python -m pip install -r requirements_test.txt
- name: Check edgepi-rpc-server installation
run: |
if ! dpkg -s edgepi-rpc-server >/dev/null 2>&1
then
echo "edgepi-rpc-server is not installed. Exiting..."
exit 1
fi
- name: Test with pytest
run: |
source venv_test/bin/activate
pytest ./tests/integration/test_module.py -vvs # change this back to all integration tests once server issue is fixed
pytest ./tests/integration -vvs
2 changes: 1 addition & 1 deletion edgepi_rpc_client/client_rpc_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import logging
from google.protobuf import service
import zmq
from edgepirpc.protos import rpc_pb2 as rpc_pb
from rpc_generated_protobufs import rpc_pb2 as rpc_pb

_logger = logging.getLogger(__name__)
logging.basicConfig(
Expand Down
2 changes: 1 addition & 1 deletion edgepi_rpc_client/services/adc/adc_pb_enums.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Client enums to protobuf adc enums"""
from enum import Enum
from edgepirpc.protos import adc_pb2 as adc_pb
from rpc_generated_protobufs import adc_pb2 as adc_pb

# pylint: disable=no-member
class AnalogIn(Enum):
Expand Down
2 changes: 1 addition & 1 deletion edgepi_rpc_client/services/adc/client_adc_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Client for adc service
"""
import logging
from edgepirpc.protos import adc_pb2 as adc_pb
from rpc_generated_protobufs import adc_pb2 as adc_pb
from edgepi_rpc_client.client_rpc_channel import ClientRpcChannel
from edgepi_rpc_client.util.helpers import (
filter_arg_values, create_config_request_from_args, get_server_response
Expand Down
2 changes: 1 addition & 1 deletion edgepi_rpc_client/services/dac/client_dac_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Client for Dac service. Utilizes ClientRpcChannel to send/receive and
serialize/deserialize messages
"""
from edgepirpc.protos import dac_pb2 as dac_pb
from rpc_generated_protobufs import dac_pb2 as dac_pb
from edgepi_rpc_client.client_rpc_channel import ClientRpcChannel
from edgepi_rpc_client.services.dac.dac_pb_enums import DACChannel
from edgepi_rpc_client.util.helpers import get_server_response
Expand Down
2 changes: 1 addition & 1 deletion edgepi_rpc_client/services/dac/dac_pb_enums.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Client Enum to Protobuf Enum mapping"""
from enum import Enum, unique
from edgepirpc.protos import dac_pb2 as dac_pb
from rpc_generated_protobufs import dac_pb2 as dac_pb

# pylint: disable=no-member
@unique
Expand Down
2 changes: 1 addition & 1 deletion edgepi_rpc_client/services/din/client_din_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Client for Din service. Utilizes ClientRpcChannel to send/receive and
serialize/deserialize messages
"""
from edgepirpc.protos import din_pb2 as din_pb
from rpc_generated_protobufs import din_pb2 as din_pb
from edgepi_rpc_client.client_rpc_channel import ClientRpcChannel
from edgepi_rpc_client.services.din.din_pb_enums import DinPins
from edgepi_rpc_client.util.helpers import get_server_response
Expand Down
2 changes: 1 addition & 1 deletion edgepi_rpc_client/services/din/din_pb_enums.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Client Enum to Protobuf Enum mapping"""
from enum import Enum, unique
from edgepirpc.protos import din_pb2 as din_pb
from rpc_generated_protobufs import din_pb2 as din_pb

# pylint: disable=no-member
@unique
Expand Down
2 changes: 1 addition & 1 deletion edgepi_rpc_client/services/dout/client_dout_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Client for Dout service. Utilizes ClientRpcChannel to send/receive and
serialize/deserialize messages
"""
from edgepirpc.protos import dout_pb2 as dout_pb
from rpc_generated_protobufs import dout_pb2 as dout_pb
from edgepi_rpc_client.client_rpc_channel import ClientRpcChannel
from edgepi_rpc_client.services.dout.dout_pb_enums import DoutPins, DoutTriState
from edgepi_rpc_client.util.helpers import get_server_response
Expand Down
2 changes: 1 addition & 1 deletion edgepi_rpc_client/services/dout/dout_pb_enums.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Client enums to protobuf led enums"""
# pylint: disable=no-member
from enum import Enum, unique
from edgepirpc.protos import dout_pb2 as dout_pb
from rpc_generated_protobufs import dout_pb2 as dout_pb

@unique
class DoutPins(Enum):
Expand Down
2 changes: 1 addition & 1 deletion edgepi_rpc_client/services/led/client_led_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Client for led service. Utilizes ClientRpcChannel to send/receive and
serialize/deserialize messages
"""
from edgepirpc.protos import led_pb2 as led_pb
from rpc_generated_protobufs import led_pb2 as led_pb
from edgepi_rpc_client.client_rpc_channel import ClientRpcChannel
from edgepi_rpc_client.services.led.led_pb_enums import LEDPins
from edgepi_rpc_client.util.helpers import get_server_response
Expand Down
2 changes: 1 addition & 1 deletion edgepi_rpc_client/services/led/led_pb_enums.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Client enums to protobuf led enums"""
# pylint: disable=no-member
from enum import Enum, unique
from edgepirpc.protos import led_pb2 as led_pb
from rpc_generated_protobufs import led_pb2 as led_pb

@unique
class LEDPins(Enum):
Expand Down
2 changes: 1 addition & 1 deletion edgepi_rpc_client/services/pwm/client_pwm_service.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Client for PWM service"""
import logging
from edgepirpc.protos import pwm_pb2 as pwm_pb
from rpc_generated_protobufs import pwm_pb2 as pwm_pb
from edgepi_rpc_client.client_rpc_channel import ClientRpcChannel
from edgepi_rpc_client.util.helpers import (
filter_arg_values,
Expand Down
3 changes: 2 additions & 1 deletion edgepi_rpc_client/services/pwm/pwm_pb_enums.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""Client enums to protobuf PWM enums"""
from enum import Enum
from edgepirpc.protos import pwm_pb2 as pwm_pb
from rpc_generated_protobufs import pwm_pb2 as pwm_pb

# pylint: disable=no-member
class PWMPins(Enum):
"""PWMPins Enum"""
PWM1 = pwm_pb.PWMPins.PWM1
Expand Down
2 changes: 1 addition & 1 deletion edgepi_rpc_client/services/relay/client_relay_service.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Client for Relay Service
"""
from edgepirpc.protos import relay_pb2 as relay_pb
from rpc_generated_protobufs import relay_pb2 as relay_pb
from edgepi_rpc_client.client_rpc_channel import ClientRpcChannel
from edgepi_rpc_client.util.helpers import get_server_response

Expand Down
2 changes: 1 addition & 1 deletion edgepi_rpc_client/services/tc/client_tc_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
and serialize/deserialize messages.
"""
import logging
from edgepirpc.protos import tc_pb2 as tc_pb
from rpc_generated_protobufs import tc_pb2 as tc_pb
from edgepi_rpc_client.util.helpers import (
create_config_request_from_args, filter_arg_values, get_server_response
)
Expand Down
2 changes: 1 addition & 1 deletion edgepi_rpc_client/services/tc/tc_pb_enums.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Client enums to protobuf tc enums"""
#pylint: disable=no-member
from enum import Enum, unique
from edgepirpc.protos import tc_pb2 as tc_pb
from rpc_generated_protobufs import tc_pb2 as tc_pb

@unique
class ConvMode(Enum):
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
protobuf==3.20.3
pyzmq==25.1.0
edgepi-python-sdk==1.2.13
edgepi-rpc-protobuf==1.0.15
edgepi-python-sdk==1.2.15
edgepi-rpc-protobuf==1.0.24
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ packages =

install_requires =
protobuf>=3.20.3
edgepi-rpc-protobuf>=1.0.15
edgepi-rpc-protobuf>=1.0.24
pyzmq>=25.1.0
edgepi-python-sdk>=1.2.13
15 changes: 0 additions & 15 deletions start_server.sh

This file was deleted.

27 changes: 27 additions & 0 deletions tests/integration/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## Necessary environment for running the integration tests:

The EdgePi RPC server must be installed on the EdgePi for the integration tests to run.

Check if the server is installed:

```
sudo systemctl status edgepi-rpc-server
```

If not already installed, install the server through the following commands:

```
wget -qO - https://deb.edgepi.com/edgepi-release.gpg | sudo gpg --dearmor -o /usr/share/keyrings/edgepi-release.gpg
sudo tee /etc/apt/sources.list.d/edgepi.list >/dev/null <<'EOF'
deb [arch=arm64, signed-by=/usr/share/keyrings/edgepi-release.gpg] https://deb.edgepi.com/main bullseye main
#deb [arch=arm64, signed-by=/usr/share/keyrings/edgepi-release.gpg] https://deb.edgepi.com/test bullseye test
#deb [arch=arm64, signed-by=/usr/share/keyrings/edgepi-release.gpg] https://deb.edgepi.com/nightly bullseye nightly
EOF
sudo apt update
sudo apt install edgepi-rpc-server
sudo reboot
```
11 changes: 0 additions & 11 deletions tests/integration/conftest.py

This file was deleted.

2 changes: 1 addition & 1 deletion tests/integration/test_error_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import logging
import zmq
from pytest import fixture
from edgepirpc.protos import rpc_pb2 as rpc_pb, tc_pb2 as tc_pb
from rpc_generated_protobufs import rpc_pb2 as rpc_pb, tc_pb2 as tc_pb

_logger = logging.getLogger(__name__)

Expand Down
16 changes: 8 additions & 8 deletions tests/integration/test_pwm_service.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
"""PWMService integration test"""
import pytest
import time
import pytest
from edgepi_rpc_client.services.pwm.client_pwm_service import ClientPWMService
from edgepi_rpc_client.services.pwm.pwm_pb_enums import PWMPins, Polarity


@pytest.fixture(name="pwm_service")
def fixture_test_pwm_service():
"""Inits new PWM service client for testing"""
return ClientPWMService('tcp://localhost:4444')
return ClientPWMService('tcp://localhost:5555')

@pytest.mark.parametrize(
"args",
Expand Down Expand Up @@ -119,12 +119,12 @@ def test_get_enabled(pwm_service, pwm_num):
assert isinstance(enabled, bool)

def test_with_edgepi(pwm_service):
"""Manual testing of PWM functionality."""
pwm_service.init_pwm(pwm_num=PWMPins.PWM1)
pwm_service.set_config(pwm_num=PWMPins.PWM1, duty_cycle=0)
pwm_service.enable(PWMPins.PWM1)
"""Used for manual testing of PWM functionality."""
pwm_service.init_pwm(pwm_num=PWMPins.PWM2)
pwm_service.set_config(pwm_num=PWMPins.PWM2, polarity=Polarity.NORMAL)
pwm_service.enable(PWMPins.PWM2)
time.sleep(3)
pwm_service.set_config(pwm_num=PWMPins.PWM1, duty_cycle=0.5)
pwm_service.set_config(pwm_num=PWMPins.PWM2, polarity=Polarity.INVERSED)
time.sleep(3)
pwm_service.set_config(pwm_num=PWMPins.PWM1, duty_cycle=1)
pwm_service.set_config(pwm_num=PWMPins.PWM2, polarity=Polarity.NORMAL)

0 comments on commit 1e1fabb

Please sign in to comment.