Skip to content

Commit e3dd618

Browse files
Add initial pytest testing.
1 parent 231e5f4 commit e3dd618

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
name: "Run Unit Tests"
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
jobs:
8+
unit-tests:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
infrahub-version: [1.0, stable, latest]
13+
steps:
14+
- name: "Check out repository code"
15+
uses: "actions/checkout@v4"
16+
- name: "Set up Python"
17+
uses: "actions/setup-python@v5"
18+
with:
19+
python-version: "3.12"
20+
- name: "Setup environment"
21+
run: |
22+
pipx install poetry
23+
- name: "Install dependencies"
24+
run: |
25+
poetry install
26+
- name: "Launch Infrahub"
27+
run: |
28+
curl https://infrahub.opsmill.io/${ matrix.infrahub-version } | sudo docker compose -f up -d
29+
- name: "Wait for Infrahub to become accessible"
30+
uses: iFaxity/wait-on-action
31+
with:
32+
resource: http://localhost:8000
33+
- name: "Run Pytest"
34+
run: |
35+
pytest

templates/device_startup_config.tpl.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ interface {{ intf.node.name.value }}
3737
{% else %}
3838
description role: {{ intf.node.role.value }}
3939
{% endif %}
40-
{% if intf.node["mtu"]["value"] %}
40+
{% if "mtu" in intf.node and intf.node["mtu"]["value"] %}
4141
mtu {{ intf.node["mtu"]["value"] }}
4242
{% endif %}
4343
{% if not intf.node["enabled"]["value"] %}

0 commit comments

Comments
 (0)