- Add end-to-end tests for complete workflow validation - Include integration tests for API and database interactions - Add unit tests for all major components and utilities - Include performance tests for payload handling - Add CLI API integration tests - Include Podman container integration tests - Add WebSocket and queue execution tests - Include shell script tests for setup validation Provides comprehensive test coverage ensuring platform reliability and functionality across all components and interactions.
46 lines
1.1 KiB
Go
46 lines
1.1 KiB
Go
package tests
|
|
|
|
import (
|
|
"errors"
|
|
"strings"
|
|
"testing"
|
|
|
|
fetchErrors "github.com/jfraeys/fetch_ml/internal/errors"
|
|
)
|
|
|
|
func TestDataFetchErrorFormattingAndUnwrap(t *testing.T) {
|
|
underlying := errors.New("disk failure")
|
|
dfErr := &fetchErrors.DataFetchError{
|
|
Dataset: "imagenet",
|
|
JobName: "resnet",
|
|
Err: underlying,
|
|
}
|
|
|
|
msg := dfErr.Error()
|
|
if !strings.Contains(msg, "imagenet") || !strings.Contains(msg, "resnet") {
|
|
t.Fatalf("error message missing context: %s", msg)
|
|
}
|
|
|
|
if !errors.Is(dfErr, underlying) {
|
|
t.Fatalf("expected DataFetchError to unwrap to underlying error")
|
|
}
|
|
}
|
|
|
|
func TestTaskExecutionErrorFormattingAndUnwrap(t *testing.T) {
|
|
underlying := errors.New("segfault")
|
|
taskErr := &fetchErrors.TaskExecutionError{
|
|
TaskID: "1234567890",
|
|
JobName: "bert",
|
|
Phase: "execution",
|
|
Err: underlying,
|
|
}
|
|
|
|
msg := taskErr.Error()
|
|
if !strings.Contains(msg, "12345678") || !strings.Contains(msg, "bert") || !strings.Contains(msg, "execution") {
|
|
t.Fatalf("error message missing context: %s", msg)
|
|
}
|
|
|
|
if !errors.Is(taskErr, underlying) {
|
|
t.Fatalf("expected TaskExecutionError to unwrap to underlying error")
|
|
}
|
|
}
|