Skip to content

[AI Generated] packages: add curl and ant tests for Azure Linux - #4698

Open
chalamalasetty wants to merge 3 commits into
microsoft:mainfrom
chalamalasetty:ai-generated/curl-ant-package-tests
Open

chalamalasetty wants to merge 3 commits into
microsoft:mainfrom
chalamalasetty:ai-generated/curl-ant-package-tests

Conversation

@chalamalasetty

Copy link
Copy Markdown

AI Generated: Generated with GitHub Copilot. Cases are maturity="preview".

Description

AI generated curl and ant package tests from corpus (IR), validated on both x86_64 and Arm64 VMs, verified all tests passed on Azure Linux 4.0.

Adds two new test suites under lisa/microsoft/testsuites/packages/:

  • curl_test.py - CurlSuite, 11 cases covering HTTP verbs, redirects, auth, proxy, resumed and multipart transfers.
  • ant_test.py - AntSuite, 11 cases covering build discovery, Java compilation, target orchestration, test execution and artifact production.

Both suites declare supported_os=[CBLMariner] and skip on guests older than 4.0.0.

Related Issue

None.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring
  • Documentation update
  • Linux Feature Package Tests

Checklist

  • Description is filled in above
  • No credentials, secrets, or internal details are included
  • Peer review requested (if not, add required peer reviewers after raising PR)
  • Tests executed and results posted below

Test Validation

Key Test Cases:

verify_authenticate_server_request|verify_follow_http_redirect|verify_compile_java|verify_run_project_tests

Impacted LISA Features:

None (new suites only)

Tested Azure Marketplace Images:

  • microsoftazurelinux azurelinux-4 4 latest

Test Results

Image VM Size Result
microsoftazurelinux azurelinux-4 4 latest (x86_64) Standard_D2s_v5 PASSED 22/22
microsoftazurelinux azurelinux-4 4 latest (aarch64) Standard_D2pds_v5 PASSED 22/22

All 22 cases passed on both architectures (0 failed, 0 skipped).

Add 22 preview test cases in 2 suites under lisa/microsoft/testsuites/packages/.
Both suites are tagged ai-generated and declared maturity="preview", so the cases
are not selected by default.

The material is AI-generated from a corpus of behaviour obligations. It was
verified by running every case on real Azure Linux 4.0 guests: 22 of 22
obligation cells proven on x86_64 and 22 of 22 on aarch64, with none failed and
none skipped.
Copilot AI lite review requested due to automatic review settings August 29, 2026 21:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds two new AI-generated package validation test suites under lisa/microsoft/testsuites/packages/ to act as release-gate checks for Azure Linux, covering functional behaviors of curl and ant via self-contained guest-side fixtures and assertions.

Changes:

  • Add CurlSuite with multiple cases exercising key curl behaviors (auth, redirects, output handling, proxying, retries, JSON, multipart, uploads).
  • Add AntSuite with multiple cases exercising Ant behaviors (platform adaptation, build discovery, Java compilation/execution, file management, artifact creation, and test-like orchestration).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
lisa/microsoft/testsuites/packages/curl_test.py New curl release-gate suite with loopback fixtures and marker-based output parsing.
lisa/microsoft/testsuites/packages/ant_test.py New ant release-gate suite covering build/task behaviors and Java-related flows.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread lisa/microsoft/testsuites/packages/curl_test.py Outdated
Comment thread lisa/microsoft/testsuites/packages/curl_test.py Outdated
Comment thread lisa/microsoft/testsuites/packages/curl_test.py Outdated
Comment thread lisa/microsoft/testsuites/packages/ant_test.py Outdated
Comment thread lisa/microsoft/testsuites/packages/ant_test.py Outdated
Comment thread lisa/microsoft/testsuites/packages/ant_test.py Outdated
Copilot AI review requested due to automatic review settings September 9, 2026 03:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

Comment thread lisa/microsoft/testsuites/packages/ant_test.py Outdated
Comment thread lisa/microsoft/testsuites/packages/ant_test.py
Comment thread lisa/microsoft/testsuites/packages/ant_test.py Outdated
Copilot AI review requested due to automatic review settings September 11, 2026 10:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Authentication validation, fixture/process cleanup, and reported test-count discrepancies remain unresolved.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (9)

lisa/microsoft/testsuites/packages/ant_test.py:1519

  • Minor These assertions manually scan the Find result with any(...) and reduce each collection check to an opaque boolean. Use assertpy collection assertions on filtered path lists instead, so failures expose the missing or unexpected path and follow the repository's collection-assertion convention.
            assert_that(
                any(path.endswith("/default-item.tmp") for path in after_first)
            ).described_as("cleanup removes the selected default resource").is_false()

lisa/microsoft/testsuites/packages/ant_test.py:1470

  • Major The stale-fixture assertion runs before the try/finally. If an interrupted prior run leaves this directory behind, the assertion fails and the cleanup block is never entered, so the stale tree persists and every retry fails the same way. Arrange cleanup in the guaranteed-finally path before checking or handling stale state.
        initial_entries = node.tools[Find].find_files(
            base,
            ignore_not_exist=True,
            force_run=True,
        )

lisa/microsoft/testsuites/packages/ant_test.py:63

  • Minor The new suite leaves the case-level requirement unset on all of its @TestCaseMetadata blocks. Although the current metadata class inherits the suite requirement implicitly, package suites conventionally declare the requirement on each case (for example, fips.py:32-40), and implicit inheritance prevents safe per-case constraints. Add requirement=simple_requirement(supported_os=[CBLMariner]) to each case.
    @TestCaseMetadata(
        description=(
            "Verifies the ant behaviour: JAR creation remains usable when the\n"
            "user does not supply a manifest or selected files.\n"
            "\n"

lisa/microsoft/testsuites/packages/curl_test.py:190

  • Minor: The generated origin script is written to the fixed /tmp/azl-http-origin.py, but after_case only kills the process and never removes this file. Reused VMs retain the fixture after every case; remove it during cleanup or place it under a per-case workspace.
            node.get_pure_path("/tmp/azl-http-origin.py"),
            append=False,
            sudo=False,

lisa/microsoft/testsuites/packages/curl_test.py:196

  • The curl suite invokes the executable directly through node.execute() even though the repository provides lisa.tools.Curl and existing suites use it for curl commands (for example, sanitytest.py:92-99). Please use the tool for these requests, using force_run=True where repeated probes must not reuse a cached result, so the suite follows the shared installation/execution behavior.
            probe = node.execute("curl -sf http://127.0.0.1:18080/")

lisa/microsoft/testsuites/packages/curl_test.py:602

  • The fixture is normalized with node.get_pure_path() above, but this command ignores that value and hard-codes /tmp/lisa-curl-form-file-part.txt. Use fixture here so the command targets the file actually created by the test and preserves the repository's path-handling abstraction.
                    "--form upload=@/tmp/lisa-curl-form-file-part.txt "

lisa/microsoft/testsuites/packages/curl_test.py:206

  • Major Process.kill() only sends SIGTERM and returns; it does not wait for the server to exit. Since every case starts a new server on fixed port 18080, the next case can race the previous process and fail to bind with EADDRINUSE. Wait for the process to terminate before clearing it, or allocate an ephemeral port.
    def after_case(self, log: Logger, **kwargs: Any) -> None:
        """Take down everything this suite arranged, whatever the verdict was."""
        for process in self.arranged:
            process.kill()

lisa/microsoft/testsuites/packages/curl_test.py:654

  • Major This case claims to verify an HTTP PUT, but the fixture handles POST and PUT identically and the later assertions check only the echoed body. A POST would therefore pass; make the endpoint reject the wrong method or assert the verbose request line includes PUT.
                    "curl --silent --show-error --upload-file upload.txt "
                    "http://127.0.0.1:18080/echo"
                ),
                cwd=work_dir,
            )

lisa/microsoft/testsuites/packages/curl_test.py:213

  • Minor The new suite leaves the case-level requirement unset on all of its @TestCaseMetadata blocks. Although the current metadata class inherits the suite requirement implicitly, package suites conventionally declare the requirement on each case (for example, fips.py:32-40), and implicit inheritance prevents safe per-case constraints. Add requirement=simple_requirement(supported_os=[CBLMariner]) to each case.
    @TestCaseMetadata(
        description=(
            "Verifies the curl behaviour: Supply credentials for server\n"
            "authentication to retrieve a known protected response.\n"
            "\n"
  • Files reviewed: 2/2 changed files
  • Comments generated: 4
  • Review effort level: Lite

Comment thread lisa/microsoft/testsuites/packages/curl_test.py
Comment thread lisa/microsoft/testsuites/packages/ant_test.py
Comment thread lisa/microsoft/testsuites/packages/ant_test.py
Comment thread lisa/microsoft/testsuites/packages/curl_test.py
priority=3,
# Bounds a hang only: measured cases finish in under 20 seconds.
timeout=1800,
tags=["ai-generated"],

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using testsuite tags is enough, no need to specify it again in test case level


@TestCaseMetadata(
description=(
"Verifies the ant behaviour: JAR creation remains usable when the\n"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    "Verifies that Ant creates usable JARs with a supplied manifest and "
    "selected files, and without a manifest or matching files.\n"
    "\n"
    "Corpus obligation: pkg:ant/archive-workflows/jar-manifest\n"
    "This test was generated automatically from a behavior corpus."

"Ant creates the supplied-manifest and default-manifest JARs"
).is_equal_to(0)

first_list = node.execute("jar tf supplied.jar", cwd=root)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

first_list = node.execute(
    "jar tf supplied.jar",
    cwd=root,
    expected_exit_code=0,
    expected_exit_code_failure_message=(
        "Failed to list supplied.jar"
    ),
)

).contains("SUPPLIED-MANIFEST-MARKER")

node.tools[Rm].remove_directory(str(root / "META-INF"))
second_list = node.execute("jar tf default.jar", cwd=root)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use expected_exit_code and expected_exit_code_failure_message for second_list = node.execute("jar tf default.jar", cwd=root)

node.tools[Rm].remove_directory(str(root))

@TestCaseMetadata(
description=(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    "Verifies that Ant ZIP extraction can filter archive entries "
    "with patterns and transform output names with a mapper.\n"
    "\n"
    "Corpus obligation: pkg:ant/archive-workflows/patterned-extraction\n"
    "This test was generated automatically from a behavior corpus."

node.execute(
"ant -f build.xml make-archive",
cwd=workspace,
expected_exit_code=0,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add expected_exit_code_failure_message

) -> None:
"""Verify obligation pkg:ant/archive-workflows/patterned-extraction."""
log.info("Verifying obligation pkg:ant/archive-workflows/patterned-extraction")
workspace = node.get_pure_path("/tmp/lisa-ant-patterned-extraction")

@LiliDeng LiliDeng Sep 14, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

workspace = node.get_pure_path(
    f"/tmp/lisa-ant-patterned-extraction-{node.name}"
)

@LiliDeng

Copy link
Copy Markdown
Collaborator

Overall comments

P1 — Cleanup / workspace isolation

Please make the temporary workspace naming and cleanup consistent across all test cases. Some cases use node.name, while others use a fixed /tmp path. In addition, verify_archive_workflows_zip_selection does not clean up the workspace in a finally block. This could cause cross-test interference or leave stale artifacts when a test fails.

P2 — Avoid implementation-specific assertions

Some assertions appear to validate implementation details rather than the stated behavior. For example, checking that archived file permissions are not preserved may be more specific than the behavior being tested. Please verify that these requirements are part of the corpus obligation; otherwise, they could introduce unnecessary false failures.

P3 — Keep test scope aligned with the description

patterned-extraction describes ZIP, WAR, and JAR extraction, but the implementation only exercises ZIP. Please either narrow the description to match the current coverage or extend the test to cover the other archive formats.

P4 — Reduce unnecessary test complexity

verify_archive_workflows_zip_selection introduces a Java helper to parse ZIP metadata. This adds significant complexity as well as another compilation/runtime dependency. If the behavior can be validated through Ant or standard JAR/ZIP tooling directly, please consider simplifying the test.

P5 — Timeout

All test cases use a 30-minute timeout, while the comment indicates that the measured execution time is under 20 seconds. Please consider reducing the timeout to avoid unnecessarily long hangs when a test gets stuck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants