2026-01-27 09:06:40 -05:00
|
|
|
// SPDX-FileCopyrightText: 2025 Icinga GmbH <https://icinga.com>
|
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2025-04-25 10:09:54 -04:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2026-02-23 03:06:26 -05:00
|
|
|
#include "icinga/host.hpp"
|
2025-04-25 10:09:54 -04:00
|
|
|
#include <ctime>
|
2026-02-23 03:06:26 -05:00
|
|
|
#include <functional>
|
2025-04-25 10:09:54 -04:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
|
|
tm make_tm(std::string s);
|
2025-04-24 11:05:31 -04:00
|
|
|
|
|
|
|
|
struct GlobalTimezoneFixture
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Timezone used for testing DST changes.
|
|
|
|
|
*
|
|
|
|
|
* DST changes in America/Los_Angeles:
|
|
|
|
|
* 2021-03-14: 01:59:59 PST (UTC-8) -> 03:00:00 PDT (UTC-7)
|
|
|
|
|
* 2021-11-07: 01:59:59 PDT (UTC-7) -> 01:00:00 PST (UTC-8)
|
|
|
|
|
*/
|
|
|
|
|
static const char *TestTimezoneWithDST;
|
|
|
|
|
|
|
|
|
|
GlobalTimezoneFixture(const char *fixed_tz = "");
|
|
|
|
|
~GlobalTimezoneFixture();
|
|
|
|
|
|
|
|
|
|
char *tz;
|
|
|
|
|
};
|
2026-02-23 03:06:26 -05:00
|
|
|
|
2026-02-02 07:42:11 -05:00
|
|
|
std::string GetRandomString(std::string prefix, std::size_t length);
|
|
|
|
|
|
2026-02-23 03:06:26 -05:00
|
|
|
void ReceiveCheckResults(
|
|
|
|
|
const icinga::Checkable::Ptr& host,
|
|
|
|
|
std::size_t num,
|
|
|
|
|
icinga::ServiceState state,
|
|
|
|
|
const std::function<void(const icinga::CheckResult::Ptr&)>& fn = {}
|
|
|
|
|
);
|