Skip to content

Conversation

@claymore666
Copy link

@claymore666 claymore666 commented Oct 3, 2025

Fixes #22

Summary

Implements a Docker-based whale tag mockup that allows developers to test ceti whaletag commands locally without physical hardware. This enables faster development iteration and automated testing of whale tag data download workflows.

Features

  • Alpine Linux container (~52 MB) with SSH server and realistic test data
  • Bridge network mode (default) - works out of the box
  • Macvlan mode (advanced) - for LAN discovery testing
  • Automated pytest integration with custom marker to exclude tests by default
  • Realistic whale tag data structure (~510MB) based on whale-tag-embedded source code:
    • Audio files with epoch_ms naming (FLAC/raw)
    • Single and multi-file CSV datasets with counters (battery, IMU, ECG, GPS, etc.)
    • Timestamped metadata files (config.txt, tag_info.yaml)
    • 800k line syslog generated with Python for speed
    • False positives (swap/, lost+found/) for download filtering tests
  • Backup/restore system for quick recovery after cleanup tests
    • Auto-backup on first startup (~206MB compressed)
    • Auto-restore from backup after ceti whaletag -ct in ~10 seconds
    • Enables rapid testing iterations without regenerating data

Usage

make whaletag-up
CONTAINER_IP=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' wt-b827eb123456)
ceti whaletag -t $CONTAINER_IP
make whaletag-down

Testing

All 17 whale tag integration tests pass:

  • SSH connection and server
  • Hostname validation
  • Realistic data structure (audio, CSV, metadata, logs)
  • SFTP download (files and directories)
  • File ownership and permissions
  • Sudo access (for cleanup command)
  • False positives detection
  • Multi-file datasets with counters
  • Backup/restore workflow

Run with: make test-whaletag

Documentation

See docs/TESTING.md for complete documentation.

Implements a Docker-based whale tag simulator that allows developers to test
`ceti whaletag` commands locally without physical hardware. This enables faster
development iteration and automated testing of whale tag data download workflows.

Features:
- Alpine Linux container (~12 MB) with SSH server and test data
- Bridge network mode (default) - works out of the box
- Macvlan mode (advanced) - for LAN discovery testing
- Automated pytest integration with custom marker to exclude tests by default
- Sample test files (audio .raw/.flac, sensors CSV) mimicking real whale tag data

Changes:
- Add Dockerfile.whaletag: Alpine-based image with openssh-server and dhcpcd
- Add docker-compose.whaletag.yml: Container orchestration with network mode support
- Add scripts/init-whaletag.sh: Container initialization (user setup, test data, SSH)
- Add .env.whaletag: Configuration file with three network mode options
- Add tests/test_whaletag_integration.py: 6 integration tests for SSH, SFTP, hostname
- Add pytest.ini: Configure @pytest.mark.whaletag marker to exclude tests by default
- Update Makefile: Add whaletag-up, whaletag-down, whaletag-clean, test-whaletag targets
- Update README.md: Add whale tag simulator quick start guide
- Add docs/TESTING.md: Comprehensive testing documentation

Usage:
  make whaletag-up
  CONTAINER_IP=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' wt-b827eb123456)
  ceti whaletag -t $CONTAINER_IP
  make whaletag-down

Testing:
  make test-whaletag  # Automated tests
  pytest -m whaletag  # Run whale tag tests only
  pytest              # Default - excludes whale tag tests

Network modes:
- Bridge (default): Container gets Docker IP, accessible from host
- Host: Container shares host network (may conflict with SSH port 22)
- Macvlan (advanced): Container gets real LAN IP via DHCP, discoverable by other machines

Limitations:
- Network discovery (ceti whaletag -l) only works in macvlan mode
- Bridge mode requires direct connection via IP (ceti whaletag -t <IP>)
- Macvlan mode requires manual network interface configuration

Related issue: Enables local development and CI/CD testing without physical whale tags
@claymore666 claymore666 changed the title Add whale tag simulator for local testing Add whale tag mockup for local testing Oct 4, 2025
@claymore666 claymore666 marked this pull request as draft October 4, 2025 19:35
Enhances whale tag Docker mockup to generate realistic test data matching
whale-tag-embedded source code structure for accurate testing.

Changes:
- Generate realistic data structure based on whale-tag-embedded source:
  - Audio: epoch_ms naming (FLAC/raw)
  - CSV: Single + multi-file datasets with counters
  - Metadata: timestamped config/tag_info files
  - Logs: 800k line syslog
  - False positives: swap/, lost+found/
- Add backup/restore system for quick recovery after cleanup tests
- Add Python syslog generator for fast data creation
- Add sudo support for cleanup command (ceti whaletag -ct)
- Expand tests from 6 to 17 (SFTP, permissions, backup/restore)

Total mockup: ~510MB, Image: ~52MB
@claymore666 claymore666 marked this pull request as ready for review October 4, 2025 20:55
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.

Getting started as a hobby developer

1 participant