Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion examples/advanced.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ prefix:

output:
format: "text"
buffer: "line"

log_level:
default_stdout: "INFO"
Expand Down
1 change: 0 additions & 1 deletion examples/basic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ prefix:

output:
format: "text"
buffer: "line"

log_level:
default_stdout: "INFO"
Expand Down
1 change: 0 additions & 1 deletion examples/minimal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ prefix:

output:
format: "text"
buffer: "line"

log_level:
default_stdout: "INFO"
Expand Down
1 change: 0 additions & 1 deletion internal/testutils/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ prefix:

output:
format: "text"
buffer: "line"

log_level:
default_stdout: "INFO"
Expand Down
1 change: 0 additions & 1 deletion pkg/apperrors/apperrors.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ var (
ErrInvalidUserFormat = errors.New("invalid user format")
ErrInvalidPIDFormat = errors.New("invalid PID format")
ErrInvalidOutputFormat = errors.New("invalid output format")
ErrInvalidBufferMode = errors.New("invalid buffer mode")
ErrInvalidStdoutLogLevel = errors.New("invalid default stdout log level")
ErrInvalidStderrLogLevel = errors.New("invalid default stderr log level")
ErrInvalidLogLevel = errors.New("invalid log level")
Expand Down
6 changes: 0 additions & 6 deletions pkg/apperrors/apperrors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ func TestConfigurationErrors(t *testing.T) {
err: ErrInvalidOutputFormat,
expected: "invalid output format",
},
{
name: "ErrInvalidBufferMode",
err: ErrInvalidBufferMode,
expected: "invalid buffer mode",
},
{
name: "ErrInvalidStdoutLogLevel",
err: ErrInvalidStdoutLogLevel,
Expand Down Expand Up @@ -245,7 +240,6 @@ func TestErrorWrapping(t *testing.T) {
ErrInvalidUserFormat,
ErrInvalidPIDFormat,
ErrInvalidOutputFormat,
ErrInvalidBufferMode,
ErrInvalidStdoutLogLevel,
ErrInvalidStderrLogLevel,
ErrInvalidLogLevel,
Expand Down
2 changes: 0 additions & 2 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ type PIDConfig struct {
// OutputConfig contains output formatting configuration.
type OutputConfig struct {
Format string `yaml:"format"`
Buffer string `yaml:"buffer"`
}

// LogLevelConfig contains log level detection configuration.
Expand Down Expand Up @@ -133,7 +132,6 @@ func getDefaultConfig() *Config {
},
Output: OutputConfig{
Format: "text",
Buffer: "line",
},
LogLevel: LogLevelConfig{
DefaultStdout: "INFO",
Expand Down
3 changes: 0 additions & 3 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ func TestLoadConfig_DefaultConfig(t *testing.T) {
assert.True(t, cfg.Prefix.PID.Enabled)
assert.Equal(t, "decimal", cfg.Prefix.PID.Format)
assert.Equal(t, "text", cfg.Output.Format)
assert.Equal(t, "line", cfg.Output.Buffer)
assert.Equal(t, "INFO", cfg.LogLevel.DefaultStdout)
assert.Equal(t, "ERROR", cfg.LogLevel.DefaultStderr)
assert.True(t, cfg.LogLevel.Detection.Enabled)
Expand All @@ -57,7 +56,6 @@ func TestLoadConfig_WithValidConfigFile(t *testing.T) {
assert.True(t, cfg.Prefix.PID.Enabled)
assert.Equal(t, "decimal", cfg.Prefix.PID.Format)
assert.Equal(t, "text", cfg.Output.Format)
assert.Equal(t, "line", cfg.Output.Buffer)
assert.Equal(t, "INFO", cfg.LogLevel.DefaultStdout)
assert.Equal(t, "ERROR", cfg.LogLevel.DefaultStderr)
assert.True(t, cfg.LogLevel.Detection.Enabled)
Expand Down Expand Up @@ -416,7 +414,6 @@ func TestGetDefaultConfig(t *testing.T) {
assert.True(t, cfg.Prefix.PID.Enabled)
assert.Equal(t, "decimal", cfg.Prefix.PID.Format)
assert.Equal(t, "text", cfg.Output.Format)
assert.Equal(t, "line", cfg.Output.Buffer)
assert.Equal(t, "INFO", cfg.LogLevel.DefaultStdout)
assert.Equal(t, "ERROR", cfg.LogLevel.DefaultStderr)
assert.True(t, cfg.LogLevel.Detection.Enabled)
Expand Down
7 changes: 0 additions & 7 deletions pkg/config/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,6 @@ func (c *Config) validateOutput() error {
apperrors.ErrInvalidOutputFormat, c.Output.Format, strings.Join(validFormats, ", "))
}

validBuffers := []string{"line", "none", "full"}

if !slices.Contains(validBuffers, c.Output.Buffer) {
return fmt.Errorf("%w '%s', valid modes: %s",
apperrors.ErrInvalidBufferMode, c.Output.Buffer, strings.Join(validBuffers, ", "))
}

return nil
}

Expand Down
67 changes: 3 additions & 64 deletions pkg/config/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,46 +268,27 @@ func TestConfig_ValidateOutput(t *testing.T) {
tests := []struct {
name string
format string
buffer string
expectError bool
expectedErr error
}{
{
name: "valid text format with line buffer",
name: "valid text format",
format: "text",
buffer: "line",
},
{
name: "valid json format with none buffer",
name: "valid json format",
format: "json",
buffer: "none",
},
{
name: "valid structured format with full buffer",
name: "valid structured format",
format: "structured",
buffer: "full",
},
{
name: "invalid format",
format: "invalid",
buffer: "line",
expectError: true,
expectedErr: apperrors.ErrInvalidOutputFormat,
},
{
name: "invalid buffer",
format: "text",
buffer: "invalid",
expectError: true,
expectedErr: apperrors.ErrInvalidBufferMode,
},
{
name: "both invalid",
format: "invalid",
buffer: "invalid",
expectError: true,
expectedErr: apperrors.ErrInvalidOutputFormat, // First error encountered
},
}

for _, tt := range tests {
Expand All @@ -316,7 +297,6 @@ func TestConfig_ValidateOutput(t *testing.T) {

cfg := getDefaultConfig()
cfg.Output.Format = tt.format
cfg.Output.Buffer = tt.buffer

err := cfg.Validate()

Expand Down Expand Up @@ -535,7 +515,6 @@ func TestConfig_ValidateIntegration(t *testing.T) {
},
Output: OutputConfig{
Format: "invalid", // Invalid: not text/json/structured
Buffer: "invalid", // Invalid: not line/none/full
},
LogLevel: LogLevelConfig{
DefaultStdout: "INVALID", // Invalid: not a valid level
Expand Down Expand Up @@ -968,46 +947,6 @@ func TestConfig_ValidateColors_CaseInsensitivity(t *testing.T) {
}
}

// TestConfig_ValidateBufferMode_AllModes tests all valid and invalid buffer modes.
func TestConfig_ValidateBufferMode_AllModes(t *testing.T) {
t.Parallel()

tests := []struct {
name string
bufferMode string
expectError bool
}{
// Valid modes
{name: "valid line", bufferMode: "line", expectError: false},
{name: "valid none", bufferMode: "none", expectError: false},
{name: "valid full", bufferMode: "full", expectError: false},
// Invalid modes
{name: "invalid auto", bufferMode: "auto", expectError: true},
{name: "invalid block", bufferMode: "block", expectError: true},
{name: "invalid empty", bufferMode: "", expectError: true},
{name: "invalid mixed case", bufferMode: "Line", expectError: true},
{name: "invalid uppercase", bufferMode: "LINE", expectError: true},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()

cfg := getDefaultConfig()
cfg.Output.Buffer = tt.bufferMode

err := cfg.Validate()

if tt.expectError {
assert.Error(t, err)
assert.ErrorIs(t, err, apperrors.ErrInvalidBufferMode)
} else {
assert.NoError(t, err)
}
})
}
}

// TestConfig_ValidateOutputFormat_AllFormats tests all valid and invalid output formats.
func TestConfig_ValidateOutputFormat_AllFormats(t *testing.T) {
t.Parallel()
Expand Down
Loading