~hloeung/ubuntu-repository-cache/metadata-age-metric

« back to all changes in this revision

Viewing changes to tests/unit/test_health_check.py

  • Committer: mergebot at canonical
  • Author(s): "Haw Loeung"
  • Date: 2021-03-08 21:04:02 UTC
  • mfrom: (325.1.7 ubuntu-repository-cache-charm)
  • Revision ID: mergebot@juju-139df4-prod-is-toolbox-0.canonical.com-20210308210402-8yvanxkb8yvrlafk
Make health-check script/endpoint more resilient

u-r-c units are usually deployed in public clouds with the sync-host
set to the main Ubuntu archive servers. We can't control the network
connectivity/conditions so update health-check script to retry up to 3
times on failures.

Reviewed-on: https://code.launchpad.net/~hloeung/ubuntu-repository-cache/health-check-retries-on-failure/+merge/399257
Reviewed-by: Benjamin Allot <benjamin.allot@canonical.com>
Reviewed-by: Barry Price <barry.price@canonical.com>

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
        os.mknod(disabled_flag)
64
64
        os.utime(disabled_flag, times=(1613518897.123, 1613518897.123))
65
65
        health_check.main(disabled_flag)
66
 
        log_info.assert_called_with('DISABLED since 1613518897.123')
 
66
        log_info.assert_called_with('DISABLED since %.3f', 1613518897.123)
67
67
        send_to_influx.assert_called_with('ubuntu_repository_cache_health,status=DISABLED value=5.03')
68
68
 
69
69
    @mock.patch('files.health_check.send_to_influx')