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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ test-coverage: ## Run tests with coverage
@go test -v -race -coverprofile=coverage.out ./...

clean: ## Clean build artifacts
@rm -f coverage.out junit-unit.xml test-unit.json test-e2e.json
@rm -f *coverage.out junit-unit.xml test-unit.json test-e2e.json
@go clean

fmt: ## Format code
Expand Down
21 changes: 15 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,19 +162,28 @@ if err := task.Run(ctx); err != nil {

## Testing

The module provides comprehensive mocking support:
The module provides comprehensive testing support:

### Testing Support

The module provides comprehensive testing utilities:

```go
import "github.com/ndizazzo/task-engine/mocks"
import "github.com/ndizazzo/task-engine/testing"
import "github.com/ndizazzo/task-engine/testing/mocks"

// Create mock command runner for testing
mockRunner := &mocks.MockCommandRunner{}
mockRunner.On("RunCommand", "echo", "hello").Return("hello", nil)
// Performance testing
tester := testing.NewPerformanceTester(taskManager, logger)
metrics := tester.BenchmarkTaskExecution(ctx, task, 100, 10)

// Use discard logger for tests
// Mock implementations
mockManager := mocks.NewEnhancedTaskManagerMock()
mockRunner := &mocks.MockCommandRunner{}
logger := mocks.NewDiscardLogger()
```

See [testing/README.md](testing/README.md) for comprehensive testing documentation.

## License

This project is available under the MIT License.
2 changes: 1 addition & 1 deletion actions/docker/check_container_health_action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"time"

"github.com/ndizazzo/task-engine/actions/docker"
command_mock "github.com/ndizazzo/task-engine/mocks"
command_mock "github.com/ndizazzo/task-engine/testing/mocks"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
)
Expand Down
2 changes: 1 addition & 1 deletion actions/docker/docker_compose_down_action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"

"github.com/ndizazzo/task-engine/actions/docker"
command_mock "github.com/ndizazzo/task-engine/mocks"
command_mock "github.com/ndizazzo/task-engine/testing/mocks"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
)
Expand Down
2 changes: 1 addition & 1 deletion actions/docker/docker_compose_exec_action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"testing"

"github.com/ndizazzo/task-engine/actions/docker"
command_mock "github.com/ndizazzo/task-engine/mocks"
command_mock "github.com/ndizazzo/task-engine/testing/mocks"
"github.com/stretchr/testify/suite"
)

Expand Down
16 changes: 16 additions & 0 deletions actions/docker/docker_compose_ls_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,24 @@ func (a *DockerComposeLsAction) parseStackLine(line string) *ComposeStack {
// Format: NAME STATUS CONFIG FILES
// Example: myapp running /path/to/docker-compose.yml
// Example: testapp stopped /path/to/compose.yml,/path/to/override.yml
// Quiet format: just the stack name
// Example: myapp

parts := strings.Fields(line)
if len(parts) == 0 {
return nil
}

// If quiet mode, we only have the stack name
if a.Quiet {
return &ComposeStack{
Name: parts[0],
Status: "",
ConfigFiles: "",
}
}

// Regular mode requires at least 3 fields
if len(parts) < 3 {
return nil
}
Expand Down
Loading
Loading