Skip to content

Commit

Permalink
Merge pull request #37 from PelionIoT/izuma-branding
Browse files Browse the repository at this point in the history
Izuma branding
  • Loading branch information
JanneKiiskila authored Jan 16, 2023
2 parents 96c8cde + 2748be5 commit c23d5a5
Show file tree
Hide file tree
Showing 22 changed files with 1,377 additions and 580 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/MCCE-Test-Linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Mbed Cloud Client Example Test Linux
# Note - primary/master version of this test is in the mcce-repo.

on:
workflow_call:
inputs:
tested_branch:
description: 'MCCE branch to pull'
default: 'master'
required: false
type: string

# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: mcce-test-linux-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
MCCE-Test-Linux:
runs-on: ubuntu-22.04
env:
MCCE_ROOT_DIR: mbed-cloud-client-example-internal
SCRIPTS_INTERNAL_DIR: scripts-internal
DEV_CREDENTIALS_FILE: scripts-internal/client/credential_files/prod_sda_client_demo_account_cred_file.c
CLIENT_DEPLOY_FILE: scripts-internal/client/deploy_client.sh
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Set access token
run: |
git config --global url."https://${{ secrets.ACCESS_TOKEN }}@github.com/".insteadOf "[email protected]:"
git config --global url."https://${{ secrets.ACCESS_TOKEN }}@github".insteadOf "https://github"
- name: Install mbed-cli
run: |
pip install mbed-cli
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out scripts-internal repository code
uses: actions/checkout@v3
with:
repository: PelionIoT/scripts-internal
token: ${{ secrets.ACCESS_TOKEN }}
path: ${{ env.SCRIPTS_INTERNAL_DIR }}
ref: 'master'
- name: Check out MCCE repository code
uses: actions/checkout@v3
with:
repository: PelionIoT/mbed-cloud-client-example-internal
token: ${{ secrets.ACCESS_TOKEN }}
path: ${{ env.MCCE_ROOT_DIR }}
- name: Deploy the libraries
run: |
cp $CLIENT_DEPLOY_FILE $MCCE_ROOT_DIR
cd $MCCE_ROOT_DIR
mbed config root .
./deploy_client.sh ${{ inputs.tested_branch }}
- name: Linux compilation
run: |
pip install manifest-tool
cp $DEV_CREDENTIALS_FILE $MCCE_ROOT_DIR/mbed_cloud_dev_credentials.c
cd $MCCE_ROOT_DIR
manifest-dev-tool init -a ${{ secrets.CLOUD_API_KEY }}
python pal-platform/pal-platform.py deploy --target=x86_x64_NativeLinux_mbedtls generate
cd __x86_x64_NativeLinux_mbedtls
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=./../pal-platform/Toolchain/GCC/GCC.cmake -DEXTERNAL_DEFINE_FILE=./../define.txt
make mbedCloudClientExample.elf
- name: Linux testing
run: |
cd $MCCE_ROOT_DIR
cd TESTS/pelion-e2e-python-test-library/
git checkout master
cd ../../
pip install -r TESTS/pelion-e2e-python-test-library/requirements.txt
pip install git+https://${{ secrets.ACCESS_TOKEN }}@github.com/PelionIoT/raas-pyclient.git#egg=raas-client
export PELION_CLOUD_API_KEY=${{ secrets.CLOUD_API_KEY }}
pytest TESTS/pelion-e2e-python-test-library/tests/dev-client-tests.py --update_bin=__x86_x64_NativeLinux_mbedtls/Debug/mbedCloudClientExample.elf --local_binary=__x86_x64_NativeLinux_mbedtls/Debug/mbedCloudClientExample.elf --log-cli-level=DEBUG
- run: echo "🍏 This job's status is ${{ job.status }}."
59 changes: 59 additions & 0 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: PR-check
run-name: ${{ github.actor }} Pull Request pysh-check
on: [push]

# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true

jobs:
run-pysh-check:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- run: sudo apt-get install black pycodestyle pydocstyle shellcheck python3
- run: black --version
- name: Set access token
run: |
git config --global url."https://${{ secrets.ACCESS_TOKEN }}@github.com/".insteadOf "[email protected]:"
git config --global url."https://${{ secrets.ACCESS_TOKEN }}@github".insteadOf "https://github"
- run: git clone https://github.com/PelionIoT/scripts-internal
# Lets not run pysh-check on itself (it already has PR job for it)
- run: echo . >scripts-internal/.nopyshcheck
- run: scripts-internal/pysh-check/pysh-check.sh --workdir .

install-on-ubuntu-22-04:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Set access token
run: |
git config --global url."https://${{ secrets.ACCESS_TOKEN }}@github.com/".insteadOf "[email protected]:"
git config --global url."https://${{ secrets.ACCESS_TOKEN }}@github".insteadOf "https://github"
- name: Install e2e-python-test-library
run: |
pip install wheel
python3 setup.py bdist_wheel
cd dist/
pip install -I pelion_test_lib*.whl
install-on-ubuntu-20-04:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Set access token
run: |
git config --global url."https://${{ secrets.ACCESS_TOKEN }}@github.com/".insteadOf "[email protected]:"
git config --global url."https://${{ secrets.ACCESS_TOKEN }}@github".insteadOf "https://github"
- name: Install e2e-python-test-library
run: |
pip install wheel
python3 setup.py bdist_wheel
cd dist/
pip install -I pelion_test_lib*.whl
call-mcce-linux:
# Note - primary/master version of this test is in the mcce-repo.
uses: ./.github/workflows/MCCE-Test-Linux.yml
with:
tested_branch: ${{ github.GITHUB_REF }}
secrets: inherit
18 changes: 8 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Pelion E2E Python test library
# Izuma E2E Python test library

Pelion E2E tests verify that a target platform can perform essential Device Management Client operations.
Izuma E2E tests verify that a target platform can perform essential Device Management Client operations.
The library is designed to be used with the [pytest test framework](https://docs.pytest.org/en/latest/).

## Prerequisites
Expand All @@ -10,7 +10,7 @@ Python 3.5 or later.
## Installation

```bash
$ git clone https://github.com/ArmMbed/pelion-e2e-python-test-library.git
$ git clone https://github.com/PelionIoT/pelion-e2e-python-test-library.git
$ pip install wheel
$ python3 setup.py bdist_wheel
$ cd dist/
Expand All @@ -19,8 +19,8 @@ $ pip install -I pelion_test_lib*.whl

## Basic usage

- Build the [Device Management Client example application](https://developer.pelion.com/docs/device-management/current/connecting/mbed-os.html) for your board and flash it.
- Set the `PELION_CLOUD_API_KEY` environment variable with your [access key](https://developer.pelion.com/docs/device-management/current/user-account/application-access-keys.html).
- Build the [Device Management Client example application](https://developer.izumanetworks.com/docs/device-management/current/connecting/mbed-os.html) for your board and flash it.
- Set the `PELION_CLOUD_API_KEY` environment variable with your [access key](https://developer.izumanetworks.com/docs/device-management/current/user-account/application-access-keys.html).
- Linux: `export PELION_CLOUD_API_KEY=<access_key_here>`
- Windows: `set PELION_CLOUD_API_KEY=<access_key_here>`
- Default API address is `https://api.us-east-1.mbedcloud.com`. You can change this by defining `PELION_CLOUD_API_GW` environment variable in similar way as `PELION_CLOUD_API_KEY` is done above.
Expand All @@ -39,9 +39,7 @@ $ pip install -I pelion_test_lib*.whl

```

- You can also run tests with the [Linux build of the Device Management Client](https://www.pelion.com/docs/device-management/current/connecting/linux-on-pc.html) by passing the compiled binary in the `--local_binary=./mbedCloudClientExample.elf` argument.

**Note:** Testing of the update functionality is not supported with the Linux build.
- You can also run tests with the [Linux build of the Device Management Client](https://developer.izumanetworks.com/docs/device-management/current/connecting/linux-on-pc.html) by passing the compiled binary in the `--local_binary=./mbedCloudClientExample.elf` argument.

### Running a test set

Expand All @@ -62,7 +60,7 @@ pytest tests/dev-client-tests.py -k get_resource

### Running the update test

Before running the update test, make sure you create update-related configuration and initialize the developer environment properly, as describe [the Device Management Client example tutorial](https://developer.pelion.com/docs/device-management/current/connecting/mbed-os.html).
Before running the update test, make sure you create update-related configuration and initialize the developer environment properly, as describe [the Device Management Client example tutorial](https://developer.izumanetworks.com/docs/device-management/current/connecting/mbed-os.html).

The update test uses the `manifest-dev-tool` utility to create the actual manifest for update campaigns.

Expand Down Expand Up @@ -102,4 +100,4 @@ There are many ways to configure the test runs. Refer to the [full pytest docume

## License

See the [license](https://github.com/ARMmbed/pelion-e2e-python-test-library/blob/master/LICENSE) agreement.
See the [license](https://github.com/PelionIoT/pelion-e2e-python-test-library/blob/master/LICENSE) agreement.
18 changes: 12 additions & 6 deletions pelion_test_lib/cloud/libraries/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,35 @@ class AccountManagementAPI:
"""

def __init__(self, rest_api):
self.api_version = 'v3'
self.api_version = "v3"
self.cloud_api = rest_api

def create_api_key(self, request_data, headers=None, expected_status_code=None):
def create_api_key(
self, request_data, headers=None, expected_status_code=None
):
"""
Generate API key
:param request_data: API key payload
:param headers: Override default header fields
:param expected_status_code: Asserts the result's status code
:return: POST /api-key response
"""
api_url = '/{}/api-keys'.format(self.api_version)
r = self.cloud_api.post(api_url, request_data, headers, expected_status_code)
api_url = "/{}/api-keys".format(self.api_version)
r = self.cloud_api.post(
api_url, request_data, headers, expected_status_code
)
return r

def delete_api_key(self, api_key_id, headers=None, expected_status_code=None):
def delete_api_key(
self, api_key_id, headers=None, expected_status_code=None
):
"""
Delete API key
:param api_key_id: API key id
:param headers: Override default header fields
:param expected_status_code: Asserts the result's status code
:return: DELETE /api-keys/{api key_id} response
"""
api_url = '/{}/api-keys/{}'.format(self.api_version, api_key_id)
api_url = "/{}/api-keys/{}".format(self.api_version, api_key_id)
r = self.cloud_api.delete(api_url, headers, expected_status_code)
return r
Loading

0 comments on commit c23d5a5

Please sign in to comment.