zdravko/internal/activities/healthcheck.go

46 lines
850 B
Go
Raw Normal View History

package activities
import (
"context"
2024-02-21 13:09:22 +00:00
"log/slog"
"net/http"
"code.tjo.space/mentos1386/zdravko/pkg/k6"
)
type HealtcheckParam struct {
Script string
}
type HealthcheckResult struct {
StatusCode int
}
func Healthcheck(ctx context.Context, param HealtcheckParam) (*HealthcheckResult, error) {
statusCode := http.StatusOK // FIXME
2024-02-21 13:09:22 +00:00
execution := k6.NewExecution(slog.Default(), param.Script)
err := execution.Start(ctx)
if err != nil {
return nil, err
}
return &HealthcheckResult{StatusCode: statusCode}, nil
2024-02-17 19:19:18 +00:00
}
type HealtcheckAddToHistoryParam struct {
2024-02-17 19:19:18 +00:00
Id string
Success bool
StatusCode int
}
type HealthcheckAddToHistoryResult struct {
2024-02-17 19:19:18 +00:00
}
func HealthcheckAddToHistory(ctx context.Context, param HealtcheckAddToHistoryParam) (*HealthcheckAddToHistoryResult, error) {
2024-02-17 19:19:18 +00:00
return &HealthcheckAddToHistoryResult{}, nil
}