Testing | laravel-health-go | Spatie       

 SPATIE  

laravel-health-go
=================

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Laravel-health-go](https://spatie.be/docs/laravel-health-go/v1)  Basic-usage  Testing

 Version   v1      

 Other versions for crawler [v1](https://spatie.be/docs/laravel-health-go/v1) 

  Testing    
- [ Introduction ](https://spatie.be/docs/laravel-health-go/v1/introduction)
- [ Requirements ](https://spatie.be/docs/laravel-health-go/v1/requirements)
- [ Installation &amp; setup ](https://spatie.be/docs/laravel-health-go/v1/installation-setup)
- [ Questions and issues ](https://spatie.be/docs/laravel-health-go/v1/questions-issues)
- [ About us ](https://spatie.be/docs/laravel-health-go/v1/about-us)
- [ Testing ](https://spatie.be/docs/laravel-health-go/v1/testing)
- [ Releasing ](https://spatie.be/docs/laravel-health-go/v1/releasing)
- [ Changelog ](https://spatie.be/docs/laravel-health-go/v1/changelog)
- [ Support us ](https://spatie.be/docs/laravel-health-go/v1/support-us)

Usage
-----

- [ Registering your first check ](https://spatie.be/docs/laravel-health-go/v1/basic-usage/registering-your-first-check)
- [ Creating custom checks ](https://spatie.be/docs/laravel-health-go/v1/basic-usage/creating-custom-checks)
- [ Manually running checks ](https://spatie.be/docs/laravel-health-go/v1/basic-usage/manually-running-checks)
- [ Conditionally running or modifying checks ](https://spatie.be/docs/laravel-health-go/v1/basic-usage/conditionally-running-or-modifying-checks)
- [ Endpoints ](https://spatie.be/docs/laravel-health-go/v1/basic-usage/endpoints)
- [ Pausing and resuming checks ](https://spatie.be/docs/laravel-health-go/v1/basic-usage/pausing-and-resuming-checks)
- [ Registering the same check multiple times ](https://spatie.be/docs/laravel-health-go/v1/basic-usage/registering-the-same-check-multiple-times)
- [ Testing ](https://spatie.be/docs/laravel-health-go/v1/basic-usage/testing)

Storing results
---------------

- [ General ](https://spatie.be/docs/laravel-health-go/v1/storing-results/general)
- [ In the database ](https://spatie.be/docs/laravel-health-go/v1/storing-results/in-the-database)
- [ In cache ](https://spatie.be/docs/laravel-health-go/v1/storing-results/in-cache)
- [ In a JSON file ](https://spatie.be/docs/laravel-health-go/v1/storing-results/in-a-json-file)
- [ Not storing results ](https://spatie.be/docs/laravel-health-go/v1/storing-results/not-storing-results)

Configuring notifications
-------------------------

- [ General ](https://spatie.be/docs/laravel-health-go/v1/configuring-notifications/general)
- [ Via mail ](https://spatie.be/docs/laravel-health-go/v1/configuring-notifications/via-mail)
- [ Via Slack ](https://spatie.be/docs/laravel-health-go/v1/configuring-notifications/via-slack)
- [ Via Microsoft Teams ](https://spatie.be/docs/laravel-health-go/v1/configuring-notifications/via-teams)
- [ Via Oh Dear ](https://spatie.be/docs/laravel-health-go/v1/configuring-notifications/via-oh-dear)

Available checks
----------------

- [ Overview ](https://spatie.be/docs/laravel-health-go/v1/available-checks/overview)
- [ Cache ](https://spatie.be/docs/laravel-health-go/v1/available-checks/cache)
- [ Debug mode ](https://spatie.be/docs/laravel-health-go/v1/available-checks/debug-mode)
- [ Environment ](https://spatie.be/docs/laravel-health-go/v1/available-checks/environment)
- [ Database connection count ](https://spatie.be/docs/laravel-health-go/v1/available-checks/db-connection-count)
- [ Database connection ](https://spatie.be/docs/laravel-health-go/v1/available-checks/db-connection)
- [ Database size ](https://spatie.be/docs/laravel-health-go/v1/available-checks/db-size-check)
- [ Database table size ](https://spatie.be/docs/laravel-health-go/v1/available-checks/db-table-size-check)
- [ CPU load ](https://spatie.be/docs/laravel-health-go/v1/available-checks/cpu-load)
- [ Used disk space ](https://spatie.be/docs/laravel-health-go/v1/available-checks/used-disk-space)
- [ Ping ](https://spatie.be/docs/laravel-health-go/v1/available-checks/ping)
- [ Redis memory usage ](https://spatie.be/docs/laravel-health-go/v1/available-checks/redis-memory-usage)
- [ Redis ](https://spatie.be/docs/laravel-health-go/v1/available-checks/redis)
- [ Flare error count ](https://spatie.be/docs/laravel-health-go/v1/available-checks/flare-error-count)
- [ Meilisearch ](https://spatie.be/docs/laravel-health-go/v1/available-checks/meilisearch)
- [ Reverb ](https://spatie.be/docs/laravel-health-go/v1/available-checks/reverb)
- [ Cached config, routes, and events ](https://spatie.be/docs/laravel-health-go/v1/available-checks/cached-config-routes-and-events)
- [ Horizon ](https://spatie.be/docs/laravel-health-go/v1/available-checks/horizon)
- [ Security advisories ](https://spatie.be/docs/laravel-health-go/v1/available-checks/security-advisories)
- [ Queue ](https://spatie.be/docs/laravel-health-go/v1/available-checks/queue)
- [ Schedule ](https://spatie.be/docs/laravel-health-go/v1/available-checks/schedule)
- [ Backups ](https://spatie.be/docs/laravel-health-go/v1/available-checks/backups)

Viewing results
---------------

- [ General ](https://spatie.be/docs/laravel-health-go/v1/viewing-results/general)
- [ On the CLI ](https://spatie.be/docs/laravel-health-go/v1/viewing-results/on-the-cli)
- [ On a webpage ](https://spatie.be/docs/laravel-health-go/v1/viewing-results/on-a-webpage)
- [ As JSON ](https://spatie.be/docs/laravel-health-go/v1/viewing-results/as-json)

Security
--------

- [ Using secret token ](https://spatie.be/docs/laravel-health-go/v1/security/using-secret-token)

 Testing
=======

You may wish to test health handling without satisfying the check itself. Replace the probe by its registration name in an isolated `laraveltest.New` application.

```
err := health.From(client.Context()).Fake("Database", health.CheckFunc(
    func(context.Context) (health.Result, error) {
        return health.Result{Status: health.Failed}, nil
    },
))
```

Handle `err`, then request the simple endpoint and assert status 503. The fake retains the registration's label, schedule, conditions and grace period. To force different scheduling, configure that registration in the test application.

Laravel's HTTP, mail, event and queue fakes apply because checks receive the application context. Use `client.Travel` to test grace periods and heartbeat ages without sleeping. Each app has its own runner and default cache.

 A good
match?
-------------

### What we do best

- All things Laravel
- Custom frontend components
- Building APIs
- AI-powered features
- Simplifying things
- Clean solutions
- Integrating services

### Not our cup of tea

- WordPress themes
- Cutting corners
- Free mockups to win a job
- "Just execute the briefing"

 In short: we'd like to be a **substantial part** of your project.

 [ Get in touch via email ](mailto:info@spatie.be?subject=A%20good%20match%21&body=Tell%20us%20as%20much%20as%20you%20can%20about%0A-%20your%20online%20project%0A-%20your%20planning%0A-%20your%20budget%0A-%20%E2%80%A6%0A%0AAnything%20that%20helps%20us%20to%20start%20straightforward%21)
