Skip to content

Commit

Permalink
Merge branch 'main' into release_3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwini-mhatre authored Jan 30, 2024
2 parents 7e98d52 + 786fa98 commit 8c5231a
Show file tree
Hide file tree
Showing 10 changed files with 79 additions and 70 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/ack.yml → .github/workflows/check_label.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
---
# See https://github.com/ansible-community/devtools/blob/main/.github/workflows/ack.yml
name: ack

name: "Check label"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

on: # yamllint disable-line rule:truthy
pull_request_target:
types: [opened, labeled, unlabeled, synchronize]

jobs:
ack:
uses: ansible/devtools/.github/workflows/ack.yml@main
check_label:
uses: ansible/ansible-content-actions/.github/workflows/check_label.yaml@main
2 changes: 1 addition & 1 deletion .github/workflows/codecoverage.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: code_coverage
name: "Code converage"

on: # yamllint disable-line rule:truthy
push:
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/draft_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: "Draft release"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
on: # yamllint disable-line rule:truthy
workflow_dispatch:
env:
NAMESPACE: ${{ github.repository_owner }}
COLLECTION_NAME: utils
ANSIBLE_COLLECTIONS_PATHS: ./
jobs:
update_release_draft:
uses: ansible/ansible-content-actions/.github/workflows/draft_release.yaml@main
with:
repo: ${{ github.event.pull_request.head.repo.full_name }}
secrets:
BOT_PAT: ${{ secrets.BOT_PAT }}
13 changes: 0 additions & 13 deletions .github/workflows/lint.yml

This file was deleted.

28 changes: 0 additions & 28 deletions .github/workflows/push.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
name: release
name: "Release collection"
on: # yamllint disable-line rule:truthy
release:
types: [published]

jobs:
release:
uses: ansible/devtools/.github/workflows/release_collection.yml@main
uses: ansible/ansible-content-actions/.github/workflows/release.yaml@main
with:
environment: release
secrets:
Expand Down
21 changes: 12 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: CI
name: "CI"

concurrency:
group: ${{ github.head_ref || github.run_id }}
Expand All @@ -14,22 +14,24 @@ on: # yamllint disable-line rule:truthy

jobs:
changelog:
uses: ansible-network/github_actions/.github/workflows/changelog.yml@main
uses: ansible/ansible-content-actions/.github/workflows/changelog.yaml@main
if: github.event_name == 'pull_request'
integration:
uses: ansible-network/github_actions/.github/workflows/integration_simple.yml@main
ansible-lint:
uses: ansible/ansible-content-actions/.github/workflows/ansible_lint.yaml@main
sanity:
uses: ansible-network/github_actions/.github/workflows/sanity.yml@main
uses: ansible/ansible-content-actions/.github/workflows/sanity.yaml@main
unit-galaxy:
uses: ansible-network/github_actions/.github/workflows/unit_galaxy.yml@main

uses: ansible/ansible-content-actions/.github/workflows/unit.yaml@main
integration:
uses: ansible/ansible-content-actions/.github/workflows/integration.yaml@main
all_green:
if: ${{ always() }}
needs:
- changelog
- integration
- sanity
- unit-galaxy
- ansible-lint
- integration
runs-on: ubuntu-latest
steps:
- run: >-
Expand All @@ -38,5 +40,6 @@ jobs:
'${{ needs.changelog.result }}',
'${{ needs.integration.result }}',
'${{ needs.sanity.result }}',
'${{ needs.unit-galaxy.result }}'
'${{ needs.unit-galaxy.result }}',
'${{ needs.ansible-lint.result }}'
])"
4 changes: 2 additions & 2 deletions .github/workflows/token_refresh.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
name: refresh_automation_hub_token
name: "Refresh Automation Hub Token"
on: # yamllint disable-line rule:truthy
schedule:
- cron: '0 0 * * *'
workflow_dispatch:

jobs:
refresh:
uses: ansible/devtools/.github/workflows/ah_token_refresh.yml@main
uses: ansible/ansible-content-actions/.github/workflows/refresh_ah_token.yaml@main
with:
environment: release
secrets:
Expand Down
40 changes: 32 additions & 8 deletions tests/unit/plugins/filter/test_ipaddr.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,16 @@

class TestIpFilter(unittest.TestCase):
def test_cidr_merge(self):
with pytest.raises(AnsibleFilterError, match="cidr_merge: expected iterable, got None"):
with pytest.raises(
AnsibleFilterError,
match="cidr_merge: expected iterable, got None",
):
cidr_merge(None)

with pytest.raises(AnsibleFilterError, match="cidr_merge: invalid action 'floop'"):
with pytest.raises(
AnsibleFilterError,
match="cidr_merge: invalid action 'floop'",
):
cidr_merge([], "floop")

self.assertEqual(cidr_merge([]), [])
Expand Down Expand Up @@ -389,15 +395,30 @@ def test_network_netmask(self):
address = "1.12.1.0/25"
self.assertEqual(ipaddr(address, "network_netmask"), "1.12.1.0 255.255.255.128")
address = "1.12.1.36/28"
self.assertEqual(ipaddr(address, "network_netmask"), "1.12.1.32 255.255.255.240")
self.assertEqual(
ipaddr(address, "network_netmask"),
"1.12.1.32 255.255.255.240",
)
address = "1.12.1.36/255.255.255.240"
self.assertEqual(ipaddr(address, "network_netmask"), "1.12.1.32 255.255.255.240")
self.assertEqual(
ipaddr(address, "network_netmask"),
"1.12.1.32 255.255.255.240",
)
address = "1.12.1.36/31"
self.assertEqual(ipaddr(address, "network_netmask"), "1.12.1.36 255.255.255.254")
self.assertEqual(
ipaddr(address, "network_netmask"),
"1.12.1.36 255.255.255.254",
)
address = "1.12.1.37/31"
self.assertEqual(ipaddr(address, "network_netmask"), "1.12.1.36 255.255.255.254")
self.assertEqual(
ipaddr(address, "network_netmask"),
"1.12.1.36 255.255.255.254",
)
address = "1.12.1.36/32"
self.assertEqual(ipaddr(address, "network_netmask"), "1.12.1.36 255.255.255.255")
self.assertEqual(
ipaddr(address, "network_netmask"),
"1.12.1.36 255.255.255.255",
)
address = "1.12.1.254/24"
self.assertEqual(ipaddr(address, "network_netmask"), "1.12.1.0 255.255.255.0")

Expand Down Expand Up @@ -493,7 +514,10 @@ def test_ipmath(self):
self.assertEqual(ipmath("2001::1", 9), "2001::a")
self.assertEqual(ipmath("2001::1", 10), "2001::b")
self.assertEqual(ipmath("2001::5", -3), "2001::2")
self.assertEqual(ipmath("2001::5", -10), "2000:ffff:ffff:ffff:ffff:ffff:ffff:fffb")
self.assertEqual(
ipmath("2001::5", -10),
"2000:ffff:ffff:ffff:ffff:ffff:ffff:fffb",
)

expected = "You must pass a valid IP address; invalid_ip is invalid"
with self.assertRaises(AnsibleFilterError) as exc:
Expand Down
9 changes: 9 additions & 0 deletions tox-ansible.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[ansible]
skip =
py3.7
py3.8
2.9
2.10
2.11
2.12
2.13

0 comments on commit 8c5231a

Please sign in to comment.