Skip to content

[ARK Drop] Enhancements and TUI (#106) (#108) #120

[ARK Drop] Enhancements and TUI (#106) (#108)

[ARK Drop] Enhancements and TUI (#106) (#108) #120

name: ARK Drop Integration Tests
on:
push:
paths:
- "drop-core/entities/**"
- "drop-core/exchanges/**"
- "drop-core/cli/**"
- "drop-core/tui/**"
- "drop-core/main/**"
- ".github/workflows/arkdrop-integration-test.yml"
workflow_dispatch:
jobs:
test-file-scenarios:
name: File Transfer Scenarios
runs-on: ubuntu-latest
strategy:
matrix:
scenario:
- name: small-text
files: "small.txt"
size: "1K"
type: "text"
- name: large-binary
files: "large.bin"
size: "100M"
type: "binary"
- name: multiple-mixed
files: "doc.pdf image.jpg data.csv"
size: "mixed"
type: "mixed"
- name: unicode-names
files: "文件.txt файл.doc αρχείο.pdf"
size: "1K"
type: "unicode"
steps:
- uses: actions/checkout@v4
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Cache cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Extract github.run_id version
id: extract_version
run: |
RUN_ID="$GITHUB_RUN_ID"
VERSION=$(echo "$RUN_ID" | sed -r 's/([0-9]{1,3})([0-9]{1,3})?([0-9]{1,3})?/\1.\2.\3/' | sed 's/\.$//' | sed 's/\.\./\./g')
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Build ARK Drop
run: |
cargo build -p arkdrop --release
# Verify binary was created
if [ ! -f "target/release/arkdrop" ]; then
echo "❌ Binary not found at target/release/arkdrop"
ls -la target/release/
exit 1
fi
echo "✅ Binary built successfully at target/release/arkdrop (v${{ steps.extract_version.outputs.version }})"
- name: Generate test files for ${{ matrix.scenario.name }}
run: |
mkdir -p test-files-${{ matrix.scenario.name }}
case "${{ matrix.scenario.type }}" in
text)
for file in ${{ matrix.scenario.files }}; do
head -c ${{ matrix.scenario.size }} /dev/urandom | base64 > "test-files-${{ matrix.scenario.name }}/$file"
done
;;
binary)
for file in ${{ matrix.scenario.files }}; do
dd if=/dev/urandom of="test-files-${{ matrix.scenario.name }}/$file" bs=${{ matrix.scenario.size }} count=1
done
;;
mixed)
echo "PDF content" > "test-files-${{ matrix.scenario.name }}/doc.pdf"
echo "JPG content" > "test-files-${{ matrix.scenario.name }}/image.jpg"
echo "CSV,data,here" > "test-files-${{ matrix.scenario.name }}/data.csv"
;;
unicode)
for file in ${{ matrix.scenario.files }}; do
echo "Unicode test content" > "test-files-${{ matrix.scenario.name }}/$file"
done
;;
esac
- name: Test ARK Drop functionality - ${{ matrix.scenario.name }}
timeout-minutes: 15
run: |
# Verify binary exists
if [ ! -f "target/release/arkdrop" ]; then
echo "❌ Binary not found at target/release/arkdrop"
ls -la target/release/
exit 1
fi
# Test ARK Drop commands and file validation (help commands only - non-blocking)
./target/release/arkdrop --help
./target/release/arkdrop send --help
./target/release/arkdrop receive --help
# Validate that files exist (without running the actual send command)
echo "📋 Validating test files for scenario ${{ matrix.scenario.name }}:"
for file in ${{ matrix.scenario.files }}; do
file_path="test-files-${{ matrix.scenario.name }}/$file"
if [ -f "$file_path" ]; then
echo " ✅ $file_path exists"
else
echo " ❌ $file_path missing"
exit 1
fi
done
echo "✅ ARK Drop help commands work and files validated for ${{ matrix.scenario.name }}"
# Test error handling and edge cases
test-error-handling:
name: Error Handling Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Extract github.run_id version
id: extract_version
run: |
# Split github.run_id into groups of 3 digits
RUN_ID="$GITHUB_RUN_ID"
VERSION=$(echo "$RUN_ID" | sed -r 's/([0-9]{1,3})([0-9]{1,3})?([0-9]{1,3})?/\1.\2.\3/' | sed 's/\.$//' | sed 's/\.\./\./g')
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Build ARK Drop
run: |
cargo build -p arkdrop --release
# Verify binary was created
if [ ! -f "target/release/arkdrop" ]; then
echo "❌ Binary not found at target/release/arkdrop"
ls -la target/release/
exit 1
fi
echo "✅ Binary built successfully at target/release/arkdrop (v${{ steps.extract_version.outputs.version }})"
- name: Test missing file error
run: |
# Verify binary exists first
if [ ! -f "target/release/arkdrop" ]; then
echo "❌ Binary not found at target/release/arkdrop"
ls -la target/release/
exit 1
fi
# Test missing file validation (this should fail early before any network operations)
if ./target/release/arkdrop send --name "Test" nonexistent.txt 2>&1 | grep -qi "File does not exist\|not found\|does not exist"; then
echo "✅ Missing file error handled correctly"
else
echo "❌ Missing file error not handled properly"
exit 1
fi
- name: Test command structure
run: |
# Create a test file
echo "test" > test.txt
# Test command help (non-blocking help command)
./target/release/arkdrop send --help | grep -q "Send files"
echo "✅ ARK Drop shows proper usage information"
- name: Test output directory handling
run: |
# Test config commands for directory management (these are local operations, no network)
./target/release/arkdrop config show
# Test setting receive directory
mkdir -p /tmp/test-output
./target/release/arkdrop config set-output /tmp/test-output
# Verify it was set
if ./target/release/arkdrop config show | grep -q "/tmp/test-output"; then
echo "✅ Directory configuration working"
else
echo "❌ Directory configuration not working"
exit 1
fi
# Clear the directory
./target/release/arkdrop config clear-output
# Cleanup
rm -rf /tmp/test-output
- name: Test ARK Drop signal handling
timeout-minutes: 2
run: |
# Test that ARK Drop responds to basic commands (non-blocking)
echo "Testing ARK Drop responsiveness..."
# Test version and help commands (these don't block)
./target/release/arkdrop --version
./target/release/arkdrop --help | head -10
echo "✅ ARK Drop signal handling test completed"
# Test concurrent transfers
test-concurrent-transfers:
name: Concurrent Transfer Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Extract github.run_id version
id: extract_version
run: |
# Split github.run_id into groups of 3 digits
RUN_ID="$GITHUB_RUN_ID"
VERSION=$(echo "$RUN_ID" | sed -r 's/([0-9]{1,3})([0-9]{1,3})?([0-9]{1,3})?/\1.\2.\3/' | sed 's/\.$//' | sed 's/\.\./\./g')
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Build ARK Drop
run: |
cargo build -p arkdrop --release
# Verify binary was created
if [ ! -f "target/release/arkdrop" ]; then
echo "❌ Binary not found at target/release/arkdrop"
ls -la target/release/
exit 1
fi
echo "✅ Binary built successfully at target/release/arkdrop (v${{ steps.extract_version.outputs.version }})"
- name: Test ARK Drop with multiple file scenarios
timeout-minutes: 5
run: |
# Verify binary exists
if [ ! -f "target/release/arkdrop" ]; then
echo "❌ Binary not found at target/release/arkdrop"
ls -la target/release/
exit 1
fi
# Create test files for different scenarios
for i in {1..3}; do
mkdir -p scenario-$i
echo "Content for scenario $i" > scenario-$i/file$i.txt
dd if=/dev/urandom of=scenario-$i/data$i.bin bs=1K count=10 2>/dev/null
done
# Test that ARK Drop can detect files without starting transfer (validate files exist)
for i in {1..3}; do
echo "Testing scenario $i file detection..."
# Validate files exist without running the blocking send command
if [ -f "scenario-$i/file$i.txt" ] && [ -f "scenario-$i/data$i.bin" ]; then
echo "✅ Scenario $i files exist and ready for transfer"
else
echo "❌ Scenario $i files missing"
exit 1
fi
done
echo "✅ Multiple file scenario tests completed"
# Performance benchmarks
performance-benchmark:
name: Performance Benchmarks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Build ARK Drop
run: |
cargo build -p arkdrop --release
echo "✅ Binary built successfully at target/release/arkdrop"
- name: Run ARK Drop performance checks
run: |
# Create benchmark results file
echo "# ARK Drop Performance Benchmarks" > benchmark-results.md
echo "" >> benchmark-results.md
echo "| Test | Result |" >> benchmark-results.md
echo "|------|--------|" >> benchmark-results.md
# Test ARK Drop startup time (help command is non-blocking)
START_TIME=$(date +%s.%N)
./target/release/arkdrop --help > /dev/null
END_TIME=$(date +%s.%N)
STARTUP_TIME=$(echo "$END_TIME - $START_TIME" | bc -l)
echo "| ARK Drop Startup | ${STARTUP_TIME}s |" >> benchmark-results.md
# Test file existence validation performance (no network operations)
for size in 1M 10M; do
dd if=/dev/urandom of=benchmark-$size.bin bs=$size count=1 2>/dev/null
START_TIME=$(date +%s.%N)
# Test that ARK Drop can validate file exists (early validation, no network)
if [ -f "benchmark-$size.bin" ]; then
FILE_SIZE=$(stat -c%s "benchmark-$size.bin" 2>/dev/null || stat -f%z "benchmark-$size.bin" 2>/dev/null)
echo "File validation: $size file exists (${FILE_SIZE} bytes)"
fi
END_TIME=$(date +%s.%N)
DURATION=$(echo "$END_TIME - $START_TIME" | bc -l)
echo "| File Validation $size | ${DURATION}s |" >> benchmark-results.md
done
cat benchmark-results.md
- name: Upload benchmark results
uses: actions/upload-artifact@v4
with:
name: benchmark-results
path: benchmark-results.md
retention-days: 30
# Memory and resource usage tests
test-resource-usage:
name: Resource Usage Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install monitoring tools
run: |
sudo apt-get update
sudo apt-get install -y sysstat valgrind time
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Extract github.run_id version
id: extract_version
run: |
# Split github.run_id into groups of 3 digits
RUN_ID="$GITHUB_RUN_ID"
VERSION=$(echo "$RUN_ID" | sed -r 's/([0-9]{1,3})([0-9]{1,3})?([0-9]{1,3})?/\1.\2.\3/' | sed 's/\.$//' | sed 's/\.\./\./g')
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Build ARK Drop
run: |
cargo build -p arkdrop --release
# Verify binary was created
if [ ! -f "target/release/arkdrop" ]; then
echo "❌ Binary not found at target/release/arkdrop"
ls -la target/release/
exit 1
fi
echo "✅ Binary built successfully at target/release/arkdrop (v${{ steps.extract_version.outputs.version }})"
- name: Monitor resource usage during transfer
timeout-minutes: 10
run: |
# Verify binary exists
if [ ! -f "target/release/arkdrop" ]; then
echo "❌ Binary not found at target/release/arkdrop"
ls -la target/release/
exit 1
fi
# Create large test file
dd if=/dev/urandom of=resource-test.bin bs=1M count=200
# Start resource monitoring
sar -u -r 1 > resource-usage.log 2>&1 &
SAR_PID=$!
# Monitor basic resource usage for ARK Drop commands (non-blocking operations only)
echo "=== Resource Usage Test ==="
# Test help command resource usage (non-blocking)
/usr/bin/time -v ./target/release/arkdrop --help > /dev/null 2> help-memory.log
# Test config command resource usage (non-blocking local operation)
/usr/bin/time -v ./target/release/arkdrop config show > /dev/null 2> config-memory.log || true
# Stop monitoring
kill $SAR_PID || true
# Extract and display resource usage
echo "=== Help Command Memory Usage ==="
grep "Maximum resident" help-memory.log || echo "Memory stats not available"
echo "=== Config Command Memory Usage ==="
grep "Maximum resident" config-memory.log || echo "Memory stats not available"
# Check for reasonable memory usage
HELP_MEM=$(grep "Maximum resident" help-memory.log | awk '{print $6}' || echo "0")
if [ "$HELP_MEM" -lt "100000" ]; then # Less than 100MB for help
echo "✅ ARK Drop memory usage within acceptable limits"
else
echo "⚠️ High ARK Drop memory usage detected: ${HELP_MEM}KB"
fi