cmd_snapshot_test.go TestSnapSnaphotsTest is unreliable

Bug #1832161 reported by James Henstridge
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
snapd
Fix Released
High
Paweł Stołowski

Bug Description

I experienced a failure in the TestSnapSnaphotsTest test during a CI run for one of my branches. The log is here:

https://api.travis-ci.org/v3/job/543539841/log.txt

... and the relevant excerpt is:

FAIL: cmd_snapshot_test.go:67: SnapSuite.TestSnapSnaphotsTest

    Test: restore x
    Test: saved --id=x
    Test: saved --id=3
    cmd_snapshot_test.go:85:
        c.Check(s.Stdout(), Matches, test.stdout)
    ... value string = "" +
    ... "Set Snap Age Version Rev Size Notes\n" +
    ... "3 htop 83d10h 2 1168 1B auto\n"
    ... regex string = "" +
    ... "Set Snap Age Version Rev Size Notes\n" +
    ... "3 htop .* 2 1168 1B auto\n"

    Test: saved
    cmd_snapshot_test.go:85:
        c.Check(s.Stdout(), Matches, test.stdout)
    ... value string = "" +
    ... "Set Snap Age Version Rev Size Notes\n" +
    ... "1 htop 83d10h 2 1168 1B -\n"
    ... regex string = "" +
    ... "Set Snap Age Version Rev Size Notes\n" +
    ... "1 htop .* 2 1168 1B -\n"

    Test: forget x
    Test: check-snapshot x
    Test: restore 1
    Test: forget 2
    Test: forget 2 snap1 snap2
    Test: check-snapshot 4
    Test: check-snapshot 4 snap1 snap2

In short, the column widths in the output are dependent on the data, but the regular expression it matches against expects one particular width.

In this case, the initial independent run of the unit tests (https://api.travis-ci.org/v3/job/543539838/log.txt) succeeded, probably due to the age string being one character shorter that time around.

When I reran the CI for my branch, the failure went away.

Changed in snapd:
assignee: nobody → Paweł Stołowski (stolowski)
Changed in snapd:
status: New → Confirmed
importance: Undecided → High
Revision history for this message
Paweł Stołowski (stolowski) wrote :
Changed in snapd:
status: Confirmed → Fix Committed
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

I believe this fix has been released already.

Changed in snapd:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.