This is an automated email from the ASF dual-hosted git repository.

sbp pushed a commit to branch sbp
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git


The following commit(s) were added to refs/heads/sbp by this push:
     new 3a25f95  Add tests for check result ignores
3a25f95 is described below

commit 3a25f95495150d4ac4446bf58682a32790d769c1
Author: Sean B. Palmer <[email protected]>
AuthorDate: Fri Jan 30 15:32:53 2026 +0000

    Add tests for check result ignores
---
 tests/e2e/ignores/__init__.py         | 16 +++++++++
 tests/e2e/ignores/conftest.py         | 45 ++++++++++++++++++++++++++
 tests/e2e/ignores/helpers.py          | 47 +++++++++++++++++++++++++++
 tests/e2e/ignores/test_get.py         | 39 ++++++++++++++++++++++
 tests/e2e/ignores/test_post.py        | 54 +++++++++++++++++++++++++++++++
 tests/unit/test_ignores_api_models.py | 61 +++++++++++++++++++++++++++++++++++
 6 files changed, 262 insertions(+)

diff --git a/tests/e2e/ignores/__init__.py b/tests/e2e/ignores/__init__.py
new file mode 100644
index 0000000..13a8339
--- /dev/null
+++ b/tests/e2e/ignores/__init__.py
@@ -0,0 +1,16 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
diff --git a/tests/e2e/ignores/conftest.py b/tests/e2e/ignores/conftest.py
new file mode 100644
index 0000000..bd713fd
--- /dev/null
+++ b/tests/e2e/ignores/conftest.py
@@ -0,0 +1,45 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from __future__ import annotations
+
+from typing import TYPE_CHECKING
+
+import e2e.helpers as helpers
+import e2e.ignores.helpers as ignores_helpers
+import pytest
+
+if TYPE_CHECKING:
+    from collections.abc import Generator
+
+    from playwright.sync_api import Page
+
+
[email protected]
+def page_ignores(page: Page) -> Generator[Page]:
+    helpers.log_in(page)
+    _clear_ignores(page)
+    helpers.visit(page, ignores_helpers.IGNORES_URL)
+    yield page
+    _clear_ignores(page)
+
+
+def _clear_ignores(page: Page) -> None:
+    helpers.visit(page, ignores_helpers.IGNORES_URL)
+    while ignores_helpers.ignore_cards(page).count() > 0:
+        ignores_helpers.button_delete_first_ignore(page).click()
+        page.wait_for_load_state()
diff --git a/tests/e2e/ignores/helpers.py b/tests/e2e/ignores/helpers.py
new file mode 100644
index 0000000..e6edd84
--- /dev/null
+++ b/tests/e2e/ignores/helpers.py
@@ -0,0 +1,47 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from typing import Final
+
+from playwright.sync_api import Locator, Page
+
+PROJECT_NAME: Final[str] = "test"
+IGNORES_URL: Final[str] = f"/ignores/{PROJECT_NAME}"
+
+
+def button_add_ignore(page: Page) -> Locator:
+    return page.get_by_role("button", name="Add ignore")
+
+
+def button_delete_first_ignore(page: Page) -> Locator:
+    return page.locator(".card").first.get_by_role("button", name="Delete")
+
+
+def ignore_cards(page: Page) -> Locator:
+    return page.locator(".card")
+
+
+def input_checker_glob(page: Page) -> Locator:
+    return page.locator('input[name="checker_glob"]')
+
+
+def input_release_glob(page: Page) -> Locator:
+    return page.locator('input[name="release_glob"]')
+
+
+def select_status(page: Page) -> Locator:
+    return page.locator('select[name="status"]')
diff --git a/tests/e2e/ignores/test_get.py b/tests/e2e/ignores/test_get.py
new file mode 100644
index 0000000..f81b045
--- /dev/null
+++ b/tests/e2e/ignores/test_get.py
@@ -0,0 +1,39 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import e2e.ignores.helpers as helpers
+from playwright.sync_api import Page, expect
+
+
+def test_add_ignore_form_visible(page_ignores: Page) -> None:
+    expect(helpers.input_release_glob(page_ignores)).to_be_visible()
+    expect(helpers.input_checker_glob(page_ignores)).to_be_visible()
+    expect(helpers.select_status(page_ignores)).to_be_visible()
+    expect(helpers.button_add_ignore(page_ignores)).to_be_visible()
+
+
+def test_ignores_page_has_heading(page_ignores: Page) -> None:
+    heading = page_ignores.locator("h1")
+    expect(heading).to_contain_text("Ignored checks")
+
+
+def test_ignores_page_shows_project_name(page_ignores: Page) -> None:
+    expect(page_ignores.locator("body")).to_contain_text(f"project 
{helpers.PROJECT_NAME}")
+
+
+def test_no_ignores_initially(page_ignores: Page) -> None:
+    expect(page_ignores.locator("body")).to_contain_text("No ignores found")
diff --git a/tests/e2e/ignores/test_post.py b/tests/e2e/ignores/test_post.py
new file mode 100644
index 0000000..f94ab52
--- /dev/null
+++ b/tests/e2e/ignores/test_post.py
@@ -0,0 +1,54 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import e2e.ignores.helpers as helpers
+from playwright.sync_api import Page, expect
+
+
+def test_add_ignore_creates_card(page_ignores: Page) -> None:
+    helpers.input_checker_glob(page_ignores).fill("atr.tasks.checks.rat.*")
+    helpers.select_status(page_ignores).select_option("Warning")
+    helpers.button_add_ignore(page_ignores).click()
+    page_ignores.wait_for_load_state()
+
+    expect(helpers.ignore_cards(page_ignores)).to_have_count(1)
+
+
+def test_add_ignore_persists_values(page_ignores: Page) -> None:
+    helpers.input_release_glob(page_ignores).fill("test-1.0.*")
+    
helpers.input_checker_glob(page_ignores).fill("atr.tasks.checks.signature.*")
+    helpers.select_status(page_ignores).select_option("Exception")
+    helpers.button_add_ignore(page_ignores).click()
+    page_ignores.wait_for_load_state()
+
+    card = helpers.ignore_cards(page_ignores).first
+    
expect(card.locator('input[name="release_glob"]')).to_have_value("test-1.0.*")
+    
expect(card.locator('input[name="checker_glob"]')).to_have_value("atr.tasks.checks.signature.*")
+
+
+def test_delete_ignore_removes_card(page_ignores: Page) -> None:
+    helpers.input_checker_glob(page_ignores).fill("atr.tasks.checks.license.*")
+    helpers.select_status(page_ignores).select_option("Failure")
+    helpers.button_add_ignore(page_ignores).click()
+    page_ignores.wait_for_load_state()
+
+    expect(helpers.ignore_cards(page_ignores)).to_have_count(1)
+
+    helpers.button_delete_first_ignore(page_ignores).click()
+    page_ignores.wait_for_load_state()
+
+    expect(helpers.ignore_cards(page_ignores)).to_have_count(0)
diff --git a/tests/unit/test_ignores_api_models.py 
b/tests/unit/test_ignores_api_models.py
new file mode 100644
index 0000000..c90c1b5
--- /dev/null
+++ b/tests/unit/test_ignores_api_models.py
@@ -0,0 +1,61 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import pytest
+
+import atr.models.api as api
+import atr.models.sql as sql
+
+
+def test_check_result_ignore_has_project_name_field() -> None:
+    cri = sql.CheckResultIgnore(
+        project_name="test",
+        release_glob="test-1.0.*",
+    )  # pyright: ignore[reportCallIssue]
+    assert cri.project_name == "test"
+
+
+def test_ignore_add_args_accepts_all_fields() -> None:
+    args = api.IgnoreAddArgs(
+        project_name="example",
+        release_glob="example-1.0.*",
+        revision_number="00001",
+        checker_glob="atr.tasks.checks.rat.*",
+        primary_rel_path_glob="*.tar.gz",
+        member_rel_path_glob="*.java",
+        status=sql.CheckResultStatusIgnore.WARNING,
+        message_glob="*warning*",
+    )
+    assert args.project_name == "example"
+    assert args.release_glob == "example-1.0.*"
+    assert args.status == sql.CheckResultStatusIgnore.WARNING
+
+
+def test_ignore_add_args_rejects_invalid_pattern() -> None:
+    with pytest.raises(ValueError):
+        api.IgnoreAddArgs(project_name="test", checker_glob="^(?=lookahead)$")
+
+
+def test_ignore_add_args_requires_project_name() -> None:
+    args = api.IgnoreAddArgs(project_name="test", checker_glob="atr.tasks.*")
+    assert args.project_name == "test"
+
+
+def test_ignore_delete_args_requires_project_name() -> None:
+    args = api.IgnoreDeleteArgs(project_name="test", id=1)
+    assert args.project_name == "test"
+    assert args.id == 1


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to