-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(controller): Add ingress processing
- Loading branch information
Showing
15 changed files
with
534 additions
and
151 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,22 @@ | ||
repos: | ||
- repo: local | ||
hooks: | ||
- id: poetry-check | ||
name: poetry-check | ||
description: run poetry check to validate config | ||
entry: poetry check | ||
language: python | ||
pass_filenames: false | ||
files: ^(.*/)?(poetry\.lock|pyproject\.toml)$ | ||
- id: poetry-flake8 | ||
name: poetry-flake8 | ||
description: run linter | ||
entry: poetry run flake8 | ||
pass_filenames: false | ||
language: python | ||
- id: poetry-pytest | ||
name: poetry-pytest | ||
description: run pytest | ||
entry: poetry run pytest | ||
language: python | ||
pass_filenames: false |
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
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,18 @@ | ||
import unittest | ||
from kuma_ingress_watcher.controller import extract_hosts_from_ingress_rule | ||
|
||
|
||
class TestExtractHostsFromIngressRule(unittest.TestCase): | ||
def test_extract_hosts_single(self): | ||
rule = {'host': 'example.com'} | ||
hosts = extract_hosts_from_ingress_rule(rule) | ||
self.assertEqual(hosts, ['example.com']) | ||
|
||
def test_extract_hosts_none(self): | ||
rule = {'path': '/test'} | ||
hosts = extract_hosts_from_ingress_rule(rule) | ||
self.assertEqual(hosts, []) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
Oops, something went wrong.