Skip to content

testtools intermittent failure due to timestamp change #13059

@iskunk

Description

@iskunk

Have you searched for an existing issue?

  • Yes, I tried searching and reviewed the pinned issues

Brief Summary

I am building a Debian package of KeePassXC 2.7.10 for Ubuntu Linux 24.04/noble, and observed the following test failure.

Note that when I re-ran the build, the test suite completed without issue. The problem thus appears to be that the current time is queried twice, and while this must usually occur in close enough succession to return the same value, I happened upon an occurrence of that not being the case.

Here is the relevant log excerpt:

[...]
31: PASS   : TestTools::testBackupFilePatternSubstitution(Unknown pattern)
31: PASS   : TestTools::testBackupFilePatternSubstitution(Do not replace escaped patterns (filename))
31: PASS   : TestTools::testBackupFilePatternSubstitution(Do not replace escaped patterns (time))
31: FAIL!  : TestTools::testBackupFilePatternSubstitution(Multiple patterns should be replaced) Compared values are not the same
31:    Actual   (Tools::substituteBackupFilePath(pattern, dbFilePath)): "KeePassXC 15_02_2026_04-29-33 KeePassXC"
31:    Expected (expectedSubstitution)                                : "KeePassXC 15_02_2026_04-29-32 KeePassXC"
31:    Loc: [./tests/TestTools.cpp(177)]
31: FAIL!  : TestTools::testBackupFilePatternSubstitution(Default time pattern) Compared values are not the same
31:    Actual   (Tools::substituteBackupFilePath(pattern, dbFilePath)): "15_02_2026_04-29-33"
31:    Expected (expectedSubstitution)                                : "15_02_2026_04-29-32"
31:    Loc: [./tests/TestTools.cpp(177)]
31: FAIL!  : TestTools::testBackupFilePatternSubstitution(Default time pattern (empty formatter)) Compared values are not the same
31:    Actual   (Tools::substituteBackupFilePath(pattern, dbFilePath)): "15_02_2026_04-29-33"
31:    Expected (expectedSubstitution)                                : "15_02_2026_04-29-32"
31:    Loc: [./tests/TestTools.cpp(177)]
31: FAIL!  : TestTools::testBackupFilePatternSubstitution(Custom time pattern) Compared values are not the same
31:    Actual   (Tools::substituteBackupFilePath(pattern, dbFilePath)): "15-33"
31:    Expected (expectedSubstitution)                                : "15-32"
31:    Loc: [./tests/TestTools.cpp(177)]
2026-02-15T04:29:33.0036952Z 31: FAIL!  : TestTools::testBackupFilePatternSubstitution(Time pattern twice) Compared values are not the same
31:    Actual   (Tools::substituteBackupFilePath(pattern, dbFilePath)): "26 15_02_2026_04-29-33"
31:    Expected (expectedSubstitution)                                : "26 15_02_2026_04-29-32"
31:    Loc: [./tests/TestTools.cpp(177)]
31: FAIL!  : TestTools::testBackupFilePatternSubstitution(Complex custom time pattern) Compared values are not the same
31:    Actual   (Tools::substituteBackupFilePath(pattern, dbFilePath)): "./26/KeePassXC_20260215_042933.old.kdbx"
31:    Expected (expectedSubstitution)                                : "./26/KeePassXC_20260215_042932.old.kdbx"
31:    Loc: [./tests/TestTools.cpp(177)]
31: FAIL!  : TestTools::testBackupFilePatternSubstitution(Invalid custom time pattern) Compared values are not the same
31:    Actual   (Tools::substituteBackupFilePath(pattern, dbFilePath)): "15/-33"
31:    Expected (expectedSubstitution)                                : "15/-32"
31:    Loc: [./tests/TestTools.cpp(177)]
31: FAIL!  : TestTools::testBackupFilePatternSubstitution(Recursive substitution) Compared values are not the same
31:    Actual   (Tools::substituteBackupFilePath(pattern, dbFilePath)): "15_02_2026_04-29-33"
31:    Expected (expectedSubstitution)                                : "15_02_2026_04-29-32"
31:    Loc: [./tests/TestTools.cpp(177)]
31: PASS   : TestTools::testBackupFilePatternSubstitution({DB_FILENAME} substitution)
31: PASS   : TestTools::testBackupFilePatternSubstitution({DB_FILENAME} substitution with multiple extensions)
31: PASS   : TestTools::testBackupFilePatternSubstitution(There should be no substitution loops)
[...]

The complete log may be viewed here.

Steps to Reproduce

Build and test KeePassXC; see above.

Expected Versus Actual Behavior

No response

KeePassXC Debug Information


Operating System

Linux

Linux Desktop Environment

None

Linux Windowing System

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions