<commit_before><commit_msg>Add basic health mock provider<commit_after>package health

import (
	"errors"
	"net/url"

	"github.com/cerana/cerana/acomm"
	"github.com/cerana/cerana/provider"
)

type Mock struct {
	Data MockData
}

type MockData struct {
	Uptime      bool
	File        bool
	TCPResponse bool
	HTTPStatus  bool
}

func NewMock() *Mock {
	return &Mock{
		Data: MockData{
			Uptime:      true,
			File:        true,
			TCPResponse: true,
			HTTPStatus:  true,
		},
	}
}

// RegisterTasks registers all of the Mock health task handlers with the server.
func (m *Mock) RegisterTasks(server *provider.Server) {
	server.RegisterTask("health-uptime", m.Uptime)
	server.RegisterTask("health-file", m.File)
	server.RegisterTask("health-tcp-response", m.TCPResponse)
	server.RegisterTask("health-http-status", m.HTTPStatus)
}

func (m *Mock) Uptime(req *acomm.Request) (interface{}, *url.URL, error) {
	var err error
	if !m.Data.Uptime {
		err = errors.New("uptime less than expected")
	}
	return nil, nil, err
}

func (m *Mock) File(req *acomm.Request) (interface{}, *url.URL, error) {
	var err error
	if !m.Data.File {
		err = errors.New("file does not exist")
	}
	return nil, nil, err
}

func (m *Mock) TCPResponse(req *acomm.Request) (interface{}, *url.URL, error) {
	var err error
	if !m.Data.TCPResponse {
		err = errors.New("response did not match")
	}
	return nil, nil, err
}

func (m *Mock) HTTPStatus(req *acomm.Request) (interface{}, *url.URL, error) {
	var err error
	if !m.Data.HTTPStatus {
		err = errors.New("unexpected response status code")
	}
	return nil, nil, err
}
{'fraction_non_alphanumeric': 0.13547574039067423, 'fraction_numerical': 0.0, 'mean_word_length': 3.871165644171779, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1274488', 'n_tokens_mistral': 584, 'n_tokens_neox': 572, 'n_words': 155}