-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
127 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: CI | ||
on: [push, pull_request] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
env: | ||
NETBOX_CONFIGURATION: netbox.configuration_testing | ||
strategy: | ||
matrix: | ||
python-version: ['3.8', '3.9', '3.10', '3.11'] | ||
services: | ||
redis: | ||
image: redis | ||
ports: | ||
- 6379:6379 | ||
postgres: | ||
image: postgres | ||
env: | ||
POSTGRES_USER: netbox | ||
POSTGRES_PASSWORD: netbox | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
- 5432:5432 | ||
|
||
steps: | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Check out NetBox | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: netbox-community/netbox | ||
ref: master | ||
path: netbox | ||
|
||
- name: Check out repo | ||
uses: actions/checkout@v4 | ||
with: | ||
path: netbox-config-backup | ||
|
||
- name: Install dependencies & set up configuration | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r netbox\requirements.txt | ||
pip install pycodestyle coverage tblib | ||
pip install -e netbox-config-backup | ||
- name: Run tests | ||
run: coverage run --source="netbox-config-backup/" netbox/manage.py test netbox-config-backup/ --parallel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from django.core.exceptions import ValidationError | ||
from django.test import TestCase | ||
|
||
from dcim.models import Site, Manufacturer, DeviceType, DeviceRole, Device, Interface | ||
from ipam.models import IPAddress | ||
from netbox_config_backup.models import * | ||
|
||
class TestBackup(TestCase): | ||
|
||
@classmethod | ||
def setUpTestData(cls): | ||
|
||
site = Site.objects.create(name='Site 1') | ||
manufacturer = Manufacturer.objects.create(name='Manufacturer 1') | ||
device_type = DeviceType.objects.create(model='Device Type 1', manufacturer=manufacturer) | ||
role = DeviceRole.objects.create(name='Switch') | ||
device = Device.objects.create( | ||
name='Device 1', | ||
site=site, | ||
device_type=device_type, | ||
role=role, | ||
status='active' | ||
) | ||
interface = Interface.objects.create(name='Interface 1', device=device, type='1000baset') | ||
address = IPAddress.objects.create(assigned_object=interface, address='10.0.0.1/32') | ||
device.primary_ip4 = address | ||
device.save() | ||
|
||
def test_create_backup(self): | ||
pass |