Skip to content

Test script for GPG agent functionality#78

Open
HarithaIBM wants to merge 2 commits into
zopencommunity:mainfrom
HarithaIBM:main
Open

Test script for GPG agent functionality#78
HarithaIBM wants to merge 2 commits into
zopencommunity:mainfrom
HarithaIBM:main

Conversation

@HarithaIBM
Copy link
Copy Markdown
Member

No description provided.

@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented May 6, 2026

🤖 Augment PR Summary

Summary: Adds a dedicated test script to validate GPG agent startup and cleanup behavior in the metaport test suite.

Changes:

  • Introduces tests/zopen_check_gpg_agent to run agent lifecycle checks using the harness-provided WORKDIR/INCLUDEDIR
  • Bootstraps (and optionally reuses) a temporary zopen environment so GPG tooling is available
  • Locates zopen-install and extracts startGPGAgent/gpgCleanup for direct invocation

Technical Notes: Creates an isolated GNUPGHOME with strict permissions, asserts key env vars, and verifies cleanup removes temporary artifacts.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

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

Review completed. 4 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

verbose=true

# Locate zopen-install script to extract functions
if [ -f "${MYDIR}/../meta/bin/zopen-install" ]; then
Copy link
Copy Markdown

@augmentcode augmentcode Bot May 6, 2026

Choose a reason for hiding this comment

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

MYDIR is never set in this script (and tests/include/common.sh doesn’t define it), so this first lookup will effectively check /meta/bin/zopen-install and likely never match. Also the /home/haritha/... fallback is machine-specific and can make this test non-portable in CI.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

fi

echo "Extracting functions from ${ZOPEN_INSTALL_SCRIPT}"
EXTRACTED_FUNCTIONS=$(sed -n '/^startGPGAgent() {/,/^}/p; /^gpgCleanup() {/,/^}/p' "${ZOPEN_INSTALL_SCRIPT}")
Copy link
Copy Markdown

@augmentcode augmentcode Bot May 6, 2026

Choose a reason for hiding this comment

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

This sed range extraction is brittle: it stops at the first line beginning with }, so any brace blocks inside startGPGAgent/gpgCleanup (or a different formatting of the closing brace) could truncate the function and make the test fail for reasons unrelated to behavior.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

fi

# Check if agent is running for this GNUPGHOME
if ! gpgconf --list-dirs agent-socket >/dev/null 2>&1; then
Copy link
Copy Markdown

@augmentcode augmentcode Bot May 6, 2026

Choose a reason for hiding this comment

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

gpgconf --list-dirs agent-socket typically succeeds even when the agent isn’t running (it just prints the configured socket path), so this check may not actually validate that startGPGAgent started anything.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

PUBLIC_KEY_FILE="$zopen_tmp_dir/pub.asc"
touch "$SIGNATURE_FILE" "$PUBLIC_KEY_FILE"

gpgCleanup
Copy link
Copy Markdown

@augmentcode augmentcode Bot May 6, 2026

Choose a reason for hiding this comment

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

Because the script runs with set -e, any non-zero return inside gpgCleanup can terminate the whole test immediately and bypass the assertions below, which can make failures harder to diagnose.

Severity: low

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

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.

1 participant