From 267131960ad8492b87525f0e8b0baed6527b4716 Mon Sep 17 00:00:00 2001 From: Leopere Date: Thu, 20 Mar 2025 18:56:11 -0400 Subject: [PATCH] Clean up old test-env directory and finalize test-tmp implementation --- .../extracted-with-manifest/test/testfile.txt | 1 - test-env/extracted/test/testfile.txt | 1 - test/README.md | 66 +++++++++++++++++++ 3 files changed, 66 insertions(+), 2 deletions(-) delete mode 100644 test-env/extracted-with-manifest/test/testfile.txt delete mode 100644 test-env/extracted/test/testfile.txt create mode 100644 test/README.md diff --git a/test-env/extracted-with-manifest/test/testfile.txt b/test-env/extracted-with-manifest/test/testfile.txt deleted file mode 100644 index 16b14f5..0000000 --- a/test-env/extracted-with-manifest/test/testfile.txt +++ /dev/null @@ -1 +0,0 @@ -test file diff --git a/test-env/extracted/test/testfile.txt b/test-env/extracted/test/testfile.txt deleted file mode 100644 index 16b14f5..0000000 --- a/test-env/extracted/test/testfile.txt +++ /dev/null @@ -1 +0,0 @@ -test file diff --git a/test/README.md b/test/README.md new file mode 100644 index 0000000..ba20bfb --- /dev/null +++ b/test/README.md @@ -0,0 +1,66 @@ +# Testing the Tarballer Utility + +This directory contains test scripts for validating the functionality of the Tarballer utility. + +## Test Environment + +All tests run in a Docker container with temporary files stored in the `/test-tmp` directory. This directory is: + +1. Git-ignored to prevent cluttering the repository +2. Automatically created by the Docker container +3. Cleaned up after tests complete (unless you specify otherwise) + +## Running Tests + +To run the tests, use Docker Compose from the project root: + +```bash +# Build and run all tests +docker compose up --build + +# Run only the basic test +docker compose run tarballer /bin/test.sh basic + +# Run only the tar comparison test +docker compose run tarballer /bin/test.sh tar + +# Keep temporary files after tests (for debugging) +docker compose run tarballer /bin/test.sh all 1 +``` + +## Test Types + +The test script (`test.sh`) supports several test types: + +1. `basic` - Tests basic tarball creation and extraction with various file types and symlinks +2. `tar` - Compares our utility against standard tar functionality +3. `all` - Runs all tests (default) +4. `clean` - Just cleans up temporary files + +## Test Directory Structure + +The tests create the following structure in the `/test-tmp` directory: + +- `/test-tmp/complex/` - Directory with complex nested structure for basic test +- `/test-tmp/complex-extracted/` - Where the complex test tarball is extracted +- `/test-tmp/standard-test/` - Directory with sample app structure for tar comparison +- `/test-tmp/standard-extracted/` - Where our utility's tarball is extracted +- `/test-tmp/reference-extracted/` - Where standard tar's tarball is extracted + +## Manual Testing + +If you need to manually test the tarballer utility, you can: + +1. Build the binaries: `docker compose up --build` +2. Use the binaries in `./bin/` directory: + ```bash + # Create a tarball + ./bin/tarballer-darwin -source /path/to/source -output output.tar.gz -prefix myapp + + # Extract and verify a tarball + ./bin/tarballer-darwin -extract -output output.tar.gz -extractdir /path/to/extract + ``` + +## Modifying Tests + +When modifying tests, ensure any temporary files are created within the `/test-tmp` directory structure to keep the repository clean. \ No newline at end of file