• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Tatsh / ipv6-config-update / 16822239827

08 Aug 2025 04:54AM UTC coverage: 91.549% (+55.6%) from 35.938%
16822239827

push

github

Tatsh
project: re-arrange for testing

54 of 60 new or added lines in 7 files covered. (90.0%)

65 of 71 relevant lines covered (91.55%)

2.89 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

83.78
/src/updater.cpp
1
#include "updater.h"
2

3
#include "constants.h"
4
#include "ipwatchdebug.h"
5

6
namespace Updater {
7

8
bool Updater::run() {
3✔
9
    if (!m_cidr.isValid()) {
3✔
10
        qCCritical(LOG_IPV6_CONFIG_UPDATE)
2✔
11
            << QCoreApplication::translate("", "Invalid CIDR: %1").arg(m_cidr.string());
1✔
12
        m_sdUtil.notify(0, "STATUS=Could not get current CIDR.\nERRNO=22");
1✔
13
        return false;
1✔
14
    }
15
    qCDebug(LOG_IPV6_CONFIG_UPDATE)
2✔
NEW
16
        << QCoreApplication::translate("", "Generated CIDR: %1").arg(m_cidr.string());
×
17
    QRegularExpression re(cidrRe.arg(m_cidr.string().left(2)).arg(m_prefixLength));
2✔
18
    qCDebug(LOG_IPV6_CONFIG_UPDATE)
2✔
NEW
19
        << QCoreApplication::translate("", "Regular expression: %1").arg(re.pattern());
×
20
    auto needsRestarts = false;
2✔
21
    for (const auto &fileName : m_files) {
5✔
22
        qCDebug(LOG_IPV6_CONFIG_UPDATE)
3✔
NEW
23
            << QCoreApplication::translate("", "Reading %1.").arg(fileName);
×
24
        const auto originalContent = m_fileManager.readContent(fileName);
3✔
25
        auto newContent = QString(originalContent).replace(re, m_cidr.string());
3✔
26
        if (originalContent == newContent) {
3✔
27
            qCDebug(LOG_IPV6_CONFIG_UPDATE)
2✔
NEW
28
                << QCoreApplication::translate("", "No changes needed for %1.").arg(fileName);
×
29
            continue;
2✔
30
        }
2✔
31
        m_sdUtil.notifyStatus(QStringLiteral("Updating config file."));
2✔
32
        m_fileManager.replaceFile(fileName, newContent);
1✔
33
        needsRestarts = true;
1✔
34
    }
5✔
35
    if (needsRestarts) {
2✔
36
        m_sdUtil.notifyStatus(QStringLiteral("Restarting units."));
2✔
37
        for (const auto &serviceName : m_units) {
2✔
38
            qCDebug(LOG_IPV6_CONFIG_UPDATE)
1✔
NEW
39
                << QCoreApplication::translate("", "Restarting %1.").arg(serviceName);
×
40
            m_sdUtil.restartUnit(serviceName, unitModeReplace);
1✔
41
        }
42
    } else {
43
        m_sdUtil.notifyStatus(QStringLiteral("No unit restarts needed."));
2✔
44
        qCDebug(LOG_IPV6_CONFIG_UPDATE)
1✔
NEW
45
            << QCoreApplication::translate("", "No unit restarts needed.");
×
46
    }
47
    return true;
2✔
48
}
2✔
49

50
} // namespace Updater
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc