README
ยถ
Gitter
A simple utility for testing git server stability by repeatedly cloning repositories.
Overview
Gitter helps you test the reliability and performance of git servers by continuously cloning repositories while tracking:
- Success/failure rates with real-time counters
- System resources including goroutines and memory usage (current and peak values)
- Error history with timestamps for troubleshooting
- Runtime duration
Perfect for monitoring status of git server during changes & upgrades.
Features
- ๐ Continuous Git Cloning - Repeatedly clone repositories at configurable intervals
- ๐ Real-time Monitoring - Live display of success/failure counts and system metrics
- ๐ Resource Tracking - Monitor memory usage and goroutines with peak value tracking
- ๐จ Error Analysis - Track recent errors with timestamps for troubleshooting
- โฑ๏ธ Duration Tracking - See how long the stability test has been running
- ๐จ Configurable UI - Adjustable terminal width for different screen sizes
- ๐ฎ Demo Mode - Simulate git operations for testing and demonstration (use
--demoflag) - ๐ Logging - Errors are logged to files for later analysis (real mode only, not in demo)
Installation
Prerequisites
- Go 1.19 or later
- Git (for actual repository cloning)
Install Directly
# Install latest version
go install github.com/kloudyuk/gitter@latest
# Install specific tagged version (when available)
go install github.com/kloudyuk/gitter@v0.3.1
Build from Source
git clone https://github.com/kloudyuk/gitter.git
cd gitter
make build
Check Version
gitter version
Usage
Basic Git Server Testing
Test cloning a git repository with default settings (2-second intervals, 10-second timeout):
gitter clone https://github.com/user/repository.git
Custom Configuration
# Test with faster intervals and custom timeout
gitter clone https://github.com/user/repo.git --interval 500ms --timeout 30s
# Adjust display width for your terminal
gitter clone https://github.com/user/repo.git --width 150
Demo Mode
Run a simulation without actually cloning repositories (perfect for testing the tool itself):
# Basic demo mode
gitter clone --demo
# Fast demo with custom settings
gitter clone --demo --interval 500ms --width 100
Command Line Options
Clone Command
gitter clone <URL> [flags]
Flags:
-i, --interval duration- Interval between clones (default: 2s, must be positive)-t, --timeout duration- Git clone timeout (default: 10s, must be positive)-w, --width int- Terminal width for display (default: 100, range: 50-300)-e, --error-history int- Number of recent errors to display (default: 5, must be positive)-d, --demo- Run in demo mode with simulated git operations
Note: When using --demo flag, the URL argument becomes optional as the command will use a simulated repository.
Input Validation
Gitter validates input parameters to ensure reliable operation:
- Interval: Must be positive (e.g.,
500ms,2s,1m) - Timeout: Must be positive (e.g.,
10s,30s,2m) - Width: Must be between 50 and 300 characters
- Error History: Must be positive (e.g.,
3,10,20)
Invalid inputs will show helpful error messages:
$ gitter clone --demo --width 30
ERROR: width must be between 50 and 300, got 30
$ gitter clone --demo --error-history 0
ERROR: error-history must be positive, got 0
Display Interface
The live interface shows:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Gitter โ
โ Config โ
โ Repo : https://github.com/user/repo.git โ
โ Interval : 2s โ
โ Timeout : 10s โ
โ Error History: 5 โ
โ โ
โ Stats โ
โ Duration : 1m30s โ
โ Go Routines : 5 (max: 8) โ
โ Memory : 1024 KB (max: 2048 KB) โ
โ โ
โ Recent Errors โ
โ 10s ago: connection timeout โ
โ 45s ago: remote hung up unexpectedly โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โฃฝ Succeeded: 42 โ
โ โฃฝ Failed: 3 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Key Features Displayed
- Config Section: Shows repository URL, interval, timeout, and error history settings
- Stats Section: Runtime duration, current/max goroutines, current/max memory usage
- Recent Errors: Recent errors with timestamps (configurable history length)
- Results: Real-time success/failure counters with animated spinners
Development
Complete CI Pipeline
# Run full CI pipeline: clean, lint, test with coverage, and build
make all
Building
# Build with automatic version detection
make build
# Build with specific version
VERSION=v1.2.3 make build
Testing
# Run tests
make test
# Run tests with coverage
make cover
Linting
make lint
How It Works
- Repository Cloning: Uses go-git for efficient in-memory cloning
- Concurrency: Each clone operation runs in a separate goroutine with proper timeout handling
- Resource Monitoring: Tracks system metrics every second using Go's runtime package
- Error Tracking: Maintains a rolling buffer of recent errors with timestamps
- UI Updates: Real-time terminal interface using Bubble Tea
Output Files
gitter.log- Error log for real clone operations (demo mode creates no log files)coverage.html- Test coverage report (when runningmake cover)
Configuration
Gitter uses golangci-lint for code quality. The tool runs with default linting rules to maintain code standards.
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests and linting (
make test lint) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Bubble Tea - For the excellent TUI framework
- go-git - For pure Go git implementation
- Cobra - For CLI framework
- Lipgloss - For terminal styling
Happy Git Testing! ๐
Documentation
ยถ
There is no documentation for this package.