Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/actions/setup-test/action.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
name: Setup code checks
description: "Setup toolchain and run smoke test"

inputs:
python-version:
description: 'Python version to use'
required: false

runs:
using: composite
steps:
- name: ⬇️ Install uv
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
- name: ⬇️ Setup Python
run: uv python install
shell: bash
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: ${{ inputs.python-version || '3.14' }}
- name: ⬇️ Build python package
run: make package
shell: bash
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ permissions:
jobs:
auto-build:
environment: auto-build
runs-on: ubuntu-24.04
runs-on: ubuntu-26.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: chainguard-dev/actions/setup-gitsign@805da2efdffdc42b8afd8880e575a48b471ef544 # main
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
- name: Set up Python
Expand All @@ -34,15 +35,11 @@ jobs:
- name: Create Pull Request
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
with:
committer: "Outscale Bot <opensource+bot@outscale.com>"
author: "Outscale Bot <opensource+bot@outscale.com>"
commit-message: "πŸ”– release: osc-sdk-python v${{ env.sdk_version }}"
body: |
Automatic build of SDK v${{ env.sdk_version }} version based on Outscale API ${{ env.api_version }}.
title: "SDK v${{ env.sdk_version }}"
token: "${{ env.token }}"
labels: "kind/feature"
env:
sdk_version: ${{ steps.get-sdk-version.outputs.sdk_version }}
api_version: ${{ github.event.inputs.api_version }}
token: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .github/workflows/code-check-identified.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:

- name: ⬇️ Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Setup toolchain
uses: ./.github/actions/setup-test
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/code-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,21 @@ permissions:

jobs:
code-check:
runs-on: ubuntu-24.04
runs-on: ubuntu-26.04
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- name: ⬇️ Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup toolchain
uses: ./.github/actions/setup-test
with:
python-version: ${{ matrix.python-version }}
- name: Run integration tests
run: ./local-tests.sh
env:
TOX_GH_MAJOR_MINOR: ${{ matrix.python-version }}
2 changes: 2 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Initialize CodeQL
uses: github/codeql-action/init@b96794f015dfd88f77b49b1c93e0fa7110f94c63 # v4.38.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/compliance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
with:
persist-credentials: false
- name: Plumber
uses: outscale/.github/pipeline-compliance@dfa747ea77f97fdc5a0bf745e4933a8d68631f89 # v1.1.2
uses: outscale/.github/pipeline-compliance@6fa9f772a0d9f4fea95422fb4388aca9cc59bec2 # v1.5.2
with:
plumber-threshold: 100
github-token: ${{ secrets.PLUMBER_TOKEN }}
4 changes: 3 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ permissions:

jobs:
build:
runs-on: ubuntu-24.04
runs-on: ubuntu-26.04
environment: publish
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup toolchain
uses: ./.github/actions/setup-test
- name: Build & Push packages
Expand Down
4 changes: 4 additions & 0 deletions tests/test_eim_user.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import sys
import unittest

Expand All @@ -6,6 +7,9 @@
from tests.integration_utils import get_tagged_name, log_test_step


@unittest.skipIf(
os.environ.get("OSC_IS_RICOCHET") == "true", "not supported by ricochet mock"
)
class TestEimUser(unittest.TestCase):
def test_eim_user_lifecycle(self):
gw = Gateway()
Expand Down
26 changes: 21 additions & 5 deletions tests/test_load_balancer_backend.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import sys
import time
import unittest
Expand All @@ -15,12 +16,17 @@
)


@unittest.skipIf(
os.environ.get("OSC_IS_RICOCHET") == "true", "not supported by ricochet mock"
)
class TestLoadBalancerBackend(unittest.TestCase):
def test_load_balancer_backend_lifecycle(self):
gw = Gateway()
subregion_name = get_first_subregion_name(gw)
image_id = get_latest_public_ubuntu_image_id(gw)
log_test_step("Using subregion {} and image {}".format(subregion_name, image_id))
log_test_step(
"Using subregion {} and image {}".format(subregion_name, image_id)
)
vm_id = None
load_balancer_name = get_tagged_name("osc-sdk-python-lb")
load_balancer_created = False
Expand Down Expand Up @@ -50,7 +56,11 @@ def test_load_balancer_backend_lifecycle(self):
if vm.get("State") == "running":
break
if vm.get("State") in ("stopped", "terminated", "shutting-down"):
self.fail("VM {} entered unexpected state {}".format(vm_id, vm.get("State")))
self.fail(
"VM {} entered unexpected state {}".format(
vm_id, vm.get("State")
)
)
time.sleep(10)

log_test_step("Creating load balancer {}".format(load_balancer_name))
Expand All @@ -65,12 +75,16 @@ def test_load_balancer_backend_lifecycle(self):
}
],
SubregionNames=[subregion_name],
Tags=[{"Key": "Name", "Value": get_tagged_name("osc-sdk-python-lb-tag")}],
Tags=[
{"Key": "Name", "Value": get_tagged_name("osc-sdk-python-lb-tag")}
],
)
self.assertIsInstance(load_balancer_response.get("LoadBalancer"), dict)
load_balancer_created = True

log_test_step("Linking backend VM {} to {}".format(vm_id, load_balancer_name))
log_test_step(
"Linking backend VM {} to {}".format(vm_id, load_balancer_name)
)
gw.LinkLoadBalancerBackendMachines(
LoadBalancerName=load_balancer_name, BackendVmIds=[vm_id]
)
Expand Down Expand Up @@ -109,7 +123,9 @@ def test_load_balancer_backend_lifecycle(self):
for entry in health.get("BackendVmHealth", []) or []
)
)
log_test_step("Backend VM {} is registered in {}".format(vm_id, load_balancer_name))
log_test_step(
"Backend VM {} is registered in {}".format(vm_id, load_balancer_name)
)
finally:
if load_balancer_created:
log_test_step("Deleting load balancer {}".format(load_balancer_name))
Expand Down
8 changes: 7 additions & 1 deletion tests/test_net_subnet.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import sys
import time
import unittest
Expand All @@ -11,6 +12,9 @@
)


@unittest.skipIf(
os.environ.get("OSC_IS_RICOCHET") == "true", "not supported by ricochet mock"
)
class TestNetAndSubnet(unittest.TestCase):
def test_net_and_subnet_lifecycle(self):
gw = Gateway()
Expand Down Expand Up @@ -40,7 +44,9 @@ def test_net_and_subnet_lifecycle(self):
time.sleep(2)

log_test_step("Reading subnet {}".format(subnet_id))
subnet = read_single_resource(gw, "ReadSubnets", "Subnets", "SubnetIds", subnet_id)
subnet = read_single_resource(
gw, "ReadSubnets", "Subnets", "SubnetIds", subnet_id
)
self.assertEqual(subnet.get("SubnetId"), subnet_id)
self.assertTrue(
any(tag.get("Key") == "Name" for tag in subnet.get("Tags", [])),
Expand Down
4 changes: 4 additions & 0 deletions tests/test_security_group.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import sys
import unittest

Expand All @@ -6,6 +7,9 @@
from tests.integration_utils import get_tagged_name, log_test_step


@unittest.skipIf(
os.environ.get("OSC_IS_RICOCHET") == "true", "not supported by ricochet mock"
)
class TestSecurityGroup(unittest.TestCase):
def test_security_group_lifecycle(self):
gw = Gateway()
Expand Down
20 changes: 16 additions & 4 deletions tests/test_snapshot.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import sys
import time
import unittest
Expand All @@ -13,6 +14,9 @@
)


@unittest.skipIf(
os.environ.get("OSC_IS_RICOCHET") == "true", "not supported by ricochet mock"
)
class TestSnapshot(unittest.TestCase):
def test_snapshot_lifecycle(self):
gw = Gateway()
Expand All @@ -34,8 +38,12 @@ def test_snapshot_lifecycle(self):
log_test_step("Tagged volume {}".format(volume_id))

for _ in range(30):
volume = read_single_resource(gw, "ReadVolumes", "Volumes", "VolumeIds", volume_id)
log_test_step("Volume {} state={}".format(volume_id, volume.get("State")))
volume = read_single_resource(
gw, "ReadVolumes", "Volumes", "VolumeIds", volume_id
)
log_test_step(
"Volume {} state={}".format(volume_id, volume.get("State"))
)
if volume.get("State") == "available":
break
if volume.get("State") == "error":
Expand All @@ -47,7 +55,9 @@ def test_snapshot_lifecycle(self):
time.sleep(10)

log_test_step("Creating snapshot from volume {}".format(volume_id))
snapshot_response = gw.CreateSnapshot(Description=description, VolumeId=volume_id)
snapshot_response = gw.CreateSnapshot(
Description=description, VolumeId=volume_id
)
snapshot = snapshot_response.get("Snapshot")
self.assertIsInstance(snapshot, dict)
snapshot_id = snapshot.get("SnapshotId")
Expand All @@ -62,7 +72,9 @@ def test_snapshot_lifecycle(self):
snapshot = read_single_resource(
gw, "ReadSnapshots", "Snapshots", "SnapshotIds", snapshot_id
)
log_test_step("Snapshot {} state={}".format(snapshot_id, snapshot.get("State")))
log_test_step(
"Snapshot {} state={}".format(snapshot_id, snapshot.get("State"))
)
if snapshot.get("State") == "completed":
break
if snapshot.get("State") == "error":
Expand Down
12 changes: 7 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
[tox]
requires = tox-uv, tox-gh
skipsdist = true
envlist = py310, py311, py312, py313, py314

[gh-actions]
[gh]
python =
3.10: py310
3.11: py311
3.12: py312
3.14: py314
3.10 = py310
3.11 = py311
3.12 = py312
3.13 = py313
3.14 = py314

[testenv]
passenv = PYTHON_VERSION, OSC_ACCESS_KEY, OSC_SECRET_KEY, OSC_REGION, OSC_TEST_LOGIN, OSC_TEST_PASSWORD, OSC_ENDPOINT_API, OSC_IS_RICOCHET
Expand Down
Loading