mirror of
https://github.com/mentos1386/zdravko.git
synced 2024-11-26 17:27:59 +00:00
45 lines
848 B
Go
45 lines
848 B
Go
package activities
|
|
|
|
import (
|
|
"context"
|
|
"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
|
|
|
|
execution := k6.NewExecution(slog.Default(), param.Script)
|
|
|
|
err := execution.Run(ctx)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &HealthcheckResult{StatusCode: statusCode}, nil
|
|
}
|
|
|
|
type HealtcheckAddToHistoryParam struct {
|
|
Id string
|
|
Success bool
|
|
StatusCode int
|
|
}
|
|
|
|
type HealthcheckAddToHistoryResult struct {
|
|
}
|
|
|
|
func HealthcheckAddToHistory(ctx context.Context, param HealtcheckAddToHistoryParam) (*HealthcheckAddToHistoryResult, error) {
|
|
|
|
return &HealthcheckAddToHistoryResult{}, nil
|
|
}
|