Skip to content

Conversation

@woblerr
Copy link
Owner

@woblerr woblerr commented Sep 12, 2025

End-to-end tests have been refactored into a unified, deterministic setup to reduce problems and simplify maintenance. The transition to using the image with Greenplum has been completed. The tests use a real Greenplum to verify the correctness of the work.

What cahnges:

  • Added single entrypoint run_test.sh with shared helpers common_functions.sh.
  • Updated per-command tests: backup-info, report-info, backup-delete, backup-clean, history-clean, history-migrate to use greenplum image.
  • Removed legacy scattered run scripts and duplicated logic.
  • Dropped pre-generated artifacts (*_report files, gpbackup_history.db); migration tests rely on YAML inputs.
  • Generated targets test-e2e_<command> and aggregate test-e2e; helpers to up/down Compose and run tests inside the Greenplum container.
  • Updated CI: e2e tests run only on pull requests targeting master.
  • Removed unused files (e.g., conf/Dockerfile.s3_plugin, old scripts, prebuilt data).
  • Minor style and small bug fixes across scripts.

woblerr added 20 commits August 17, 2025 21:32
- Replace individual test containers with single Greenplum container.
- Switch from static test data to real gpbackup-generated backups.
- Add database initialization and backup preparation scripts.
- Reorganize test structure with prepare/ and run_tests/ directories.
- Update S3 plugin path to use Greenplum built-in binary.
- Simplify Makefile targets to single backup-info test.
- Remove S3 plugin build Dockerfile (use built-in plugin).
- Update MinIO and Greenplum image versions to latest.
- Replace individual test targets with unified Makefile test generation.
- Switch from static file comparison to real Greenplum-based testing.
- Move test script from run_report-info.sh to run_tests/run_report-info.sh.
- Remove deprecated static file-based test approach.
- Add common_functions.sh with shared logging, assertions and utilities
- Standardize variable format to ${var} with proper case conventions
- Refactor all test scripts to use modular test functions
- Reduce code duplication and improve maintainability
- Unify error handling and test execution patterns
@woblerr woblerr self-assigned this Sep 12, 2025
@woblerr woblerr added documentation Improvements or additions to documentation enhancement New feature or request labels Sep 12, 2025
@woblerr woblerr requested a review from Copilot September 12, 2025 22:50
Copy link

Copilot AI left a comment

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 refactors end-to-end tests into a unified, deterministic setup using a real Greenplum database. The tests transition from scattered scripts and pre-generated artifacts to using the Greenplum image for verification of gpbackman functionality.

  • Single entrypoint script with shared helper functions for consistent test execution
  • Updated per-command tests to use the Greenplum image instead of pre-generated data
  • Removed legacy scripts and duplicated logic, transitioning to YAML-based migration tests

Reviewed Changes

Copilot reviewed 28 out of 29 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
e2e_tests/src_data/* Removed pre-generated report files that are no longer needed
e2e_tests/scripts/run_tests/* Added new unified test framework with shared functions
e2e_tests/docker-compose.yml Migrated to Greenplum-based testing infrastructure
Makefile Updated e2e test targets to use new unified approach
.github/workflows/build.yml Enabled e2e tests for pull requests targeting master

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@woblerr woblerr requested a review from Copilot September 13, 2025 19:34
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 28 out of 29 changed files in this pull request and generated 3 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

}

echo "[INFO] Check Greenplum cluster"
sleep 90
Copy link

Copilot AI Sep 13, 2025

Choose a reason for hiding this comment

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

The hardcoded 90-second sleep should be made configurable or replaced with a more intelligent wait mechanism. Consider using an environment variable or calculating based on system resources.

Suggested change
sleep 90
SLEEP_DURATION="${GP_CLUSTER_STARTUP_WAIT:-90}"
echo "[INFO] Sleeping for ${SLEEP_DURATION} seconds before checking cluster readiness"
sleep "${SLEEP_DURATION}"

Copilot uses AI. Check for mistakes.
DATA_DIR="/data/master/gpseg-1"
PLUGIN_CFG="/home/gpadmin/gpbackup_s3_plugin.yaml"

TIMESTAMP_GREP_PATTERN='^[[:space:]][0-9]{14}'
Copy link

Copilot AI Sep 13, 2025

Choose a reason for hiding this comment

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

The regex pattern uses {14} which is not valid in basic grep. Should use [0-9]\\{14\\} for POSIX compatibility or ensure extended regex is used with grep -E.

Copilot uses AI. Check for mistakes.
@woblerr woblerr requested a review from Copilot September 13, 2025 20:05
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 28 out of 29 changed files in this pull request and generated 3 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

DATA_DIR="/data/master/gpseg-1"
PLUGIN_CFG="/home/gpadmin/gpbackup_s3_plugin.yaml"

TIMESTAMP_GREP_PATTERN='^[[:space:]][0-9]{14}'
Copy link

Copilot AI Sep 13, 2025

Choose a reason for hiding this comment

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

The regex pattern uses non-standard syntax. POSIX basic regex doesn't support {14} quantifiers. Use '^[[:space:]][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]' or ensure extended regex mode is used.

Copilot uses AI. Check for mistakes.
local workdir=$(prepare_workdir test3)
cp "${SRC_DIR}/${TEST_FILE_FULL_LOCAL}" "${workdir}/"
local db="${DATA_DIR}/gpbackup_history.db"
if ${BIN_DIR}/gpbackman history-migrate --history-file "${workdir}/${TEST_FILE_FULL_LOCAL}" --history-db "${db}"; then
Copy link

Copilot AI Sep 13, 2025

Choose a reason for hiding this comment

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

Direct command execution without using the run_command helper function is inconsistent with the pattern used elsewhere in the test suite. Use run_command for consistency and proper error handling.

Suggested change
if ${BIN_DIR}/gpbackman history-migrate --history-file "${workdir}/${TEST_FILE_FULL_LOCAL}" --history-db "${db}"; then
if run_command "duplicate_into_existing_db_fail" --history-file "${workdir}/${TEST_FILE_FULL_LOCAL}" --history-db "${db}"; then

Copilot uses AI. Check for mistakes.
Comment on lines +79 to +84
if ${BIN_DIR}/gpbackman backup-delete --history-db ${DATA_DIR}/gpbackup_history.db --timestamp "${fake_timestamp}" --force; then
echo "[ERROR] Expected failure, but command succeeded"
exit 1
else
echo "[INFO] Expected failure occurred"
fi
Copy link

Copilot AI Sep 13, 2025

Choose a reason for hiding this comment

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

Direct command execution without using the run_command helper function is inconsistent with the pattern used elsewhere in the test suite. Use run_command for consistency, but suppress the automatic error exit for this negative test case.

Suggested change
if ${BIN_DIR}/gpbackman backup-delete --history-db ${DATA_DIR}/gpbackup_history.db --timestamp "${fake_timestamp}" --force; then
echo "[ERROR] Expected failure, but command succeeded"
exit 1
else
echo "[INFO] Expected failure occurred"
fi
run_command "delete_nonexistent_backup" --timestamp "${fake_timestamp}" --force || rc=$?
if [ "${rc:-0}" -eq 0 ]; then
echo "[ERROR] Expected failure, but command succeeded"
exit 1
else
echo "[INFO] Expected failure occurred"
fi
unset rc

Copilot uses AI. Check for mistakes.
@woblerr woblerr merged commit 7e354f3 into master Sep 13, 2025
6 checks passed
@woblerr woblerr deleted the refactor_e2e_tests_p2 branch September 13, 2025 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants