cephfs admin: fix reversed args in greater-or-equal assertion

Now that the new year has arrived this test assertion has started to
fail. This is because, although I anticipated the year would eventually
change and used GreaterOrEqual, the argument order is wrong. My excuse
is that I find the argument order in testify's Equal function confusing,
it causes me to assume other functions in testify are also confusing
(even when it's the "normal" order) and/or I copy and pasted from an
Equal line and didn't change the args (both are true!).

Instead of allowing any old year, we assume that the clocks where the
test are run are in sync enough that the current year is correct for
the assertion (thanks for the suggestion Sven).
Happy new year, go-ceph!

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2021-01-02 09:32:17 -05:00 committed by mergify[bot]
parent da34b0aec5
commit 6900146fc4
1 changed files with 2 additions and 2 deletions

View File

@ -412,7 +412,7 @@ func TestSubVolumeInfo(t *testing.T) {
assert.Equal(t, 0, vinfo.Uid)
assert.Equal(t, 20*gibiByte, vinfo.BytesQuota)
assert.Equal(t, 040750, vinfo.Mode)
assert.GreaterOrEqual(t, 2020, vinfo.Ctime.Year())
assert.Equal(t, time.Now().Year(), vinfo.Ctime.Year())
}
func TestSubVolumeSnapshots(t *testing.T) {
@ -567,7 +567,7 @@ func TestSubVolumeSnapshotInfo(t *testing.T) {
assert.NotNil(t, sinfo)
assert.EqualValues(t, 0, sinfo.Size)
assert.Equal(t, "cephfs_data", sinfo.DataPool)
assert.GreaterOrEqual(t, 2020, sinfo.CreatedAt.Year())
assert.Equal(t, time.Now().Year(), sinfo.CreatedAt.Year())
sinfo, err = fsa.SubVolumeSnapshotInfo(volume, group, subname, snapname2)
assert.Error(t, err)