zdravko/internal/activities/healthcheck.go

47 lines
890 B
Go
Raw Normal View History

package activities
import (
"context"
"net/http"
"code.tjo.space/mentos1386/zdravko/pkg/k6"
"go.k6.io/k6/cmd/state"
)
type HealtcheckParam struct {
Script string
}
type HealthcheckResult struct {
StatusCode int
}
func Healthcheck(ctx context.Context, param HealtcheckParam) (*HealthcheckResult, error) {
statusCode := http.StatusOK // FIXME
state := state.NewGlobalState(ctx)
execution := k6.NewExecution(state, 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
}