Files
aptly/context/queue_test.go
T
Nick Bozhenko ff66310b73 Major test suite improvements and API enhancements
Test Coverage Improvements:
- Increased API test coverage from 43.2% to 46.3%
- Added comprehensive tests for database operations, metrics, and middleware
- Enhanced existing test suites with additional edge cases and error scenarios
- Removed redundant cmd/*_test.go files (already covered by system tests)

API Enhancements:
- Added metadata update capability to PUT /api/publish endpoint
- Now supports updating Origin, Label, Suite, Codename, NotAutomatic, and ButAutomaticUpgrades fields
- Metadata changes are applied during the publish operation

Infrastructure Updates:
- Fixed etcd batch write panic with proper retry logic
- Enhanced S3 upload with better concurrent operation handling
- Improved task management with better error handling and race condition prevention
- Updated etcd install script to support both x86_64 and arm64 architectures

Code Quality:
- Fixed go vet issues and code formatting problems
- Enhanced error messages and logging throughout the codebase
- Improved resource cleanup in test suites
- Better handling of nil values and edge cases

Build System:
- Updated Makefile with improved dependency management
- Enhanced .golangci.yml configuration for better linting
- Added VERSION file management
- Updated .gitignore for better coverage tracking

Documentation:
- Integrated macOS testing guide into CONTRIBUTING.md
- Added platform-specific setup instructions
- Improved test running documentation with multiple options
2025-07-18 18:39:03 -04:00

46 lines
1.4 KiB
Go

package context
import (
"testing"
"github.com/aptly-dev/aptly/utils"
)
func TestQueueConfigurationParsing(t *testing.T) {
// Test default configuration
config := utils.ConfigStructure{
DatabaseBackend: utils.DBConfig{
Type: "etcd",
URL: "localhost:2379",
},
}
// Verify defaults are applied
if config.DatabaseBackend.WriteQueue.Enabled {
t.Error("Expected write queue to be disabled by default")
}
// Test with explicit configuration
config.DatabaseBackend.WriteQueue = utils.WriteQConfig{
Enabled: true,
QueueSize: 500,
MaxWritesPerSec: 50,
BatchMaxSize: 25,
BatchMaxWaitMs: 20,
}
if !config.DatabaseBackend.WriteQueue.Enabled {
t.Error("Expected write queue to be enabled")
}
if config.DatabaseBackend.WriteQueue.QueueSize != 500 {
t.Errorf("Expected queue size 500, got %d", config.DatabaseBackend.WriteQueue.QueueSize)
}
if config.DatabaseBackend.WriteQueue.MaxWritesPerSec != 50 {
t.Errorf("Expected max writes per sec 50, got %d", config.DatabaseBackend.WriteQueue.MaxWritesPerSec)
}
if config.DatabaseBackend.WriteQueue.BatchMaxSize != 25 {
t.Errorf("Expected batch max size 25, got %d", config.DatabaseBackend.WriteQueue.BatchMaxSize)
}
if config.DatabaseBackend.WriteQueue.BatchMaxWaitMs != 20 {
t.Errorf("Expected batch max wait 20ms, got %d", config.DatabaseBackend.WriteQueue.BatchMaxWaitMs)
}
}