Skip to content

Commit

Permalink
follow-up
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Aizman <alex.aizman@gmail.com>
  • Loading branch information
alex-aizman committed Mar 31, 2023
1 parent 1c1faa0 commit d85d0ef
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
44 changes: 25 additions & 19 deletions ais/test/archive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,33 +297,39 @@ func testMobjArch(t *testing.T, bck *cluster.Bck) {
api.AbortXaction(baseParams, flt)
}

time.Sleep(5 * time.Second) // TODO: remove
api.WaitForXactionIdle(baseParams, flt)
for ii := 0; ii < 2; ii++ {
// TODO: calibrate x-archive reporting 'idle'
// (too early in presence of multiple concurrent requests)
time.Sleep(3 * time.Second)
api.WaitForXactionIdle(baseParams, flt)

tlog.Logf("List %s\n", bckTo)
msg := &apc.LsoMsg{Prefix: "test_"}
msg.AddProps(apc.GetPropsName, apc.GetPropsSize)
objList, err := api.ListObjects(baseParams, bckTo, msg, 0)
tassert.CheckFatal(t, err)
for _, en := range objList.Entries {
tlog.Logf("%s: %dB\n", en.Name, en.Size)
}
num := len(objList.Entries)
if num < numArchs && ii == 0 {
tlog.Logf("Warning: expected %d, have %d - retrying...\n", numArchs, num)
time.Sleep(7 * time.Second) // TODO: ditto
continue
}
tassert.Errorf(t, num == numArchs, "expected %d, have %d", numArchs, num)
break
}

tlog.Logf("List %s\n", bckTo)
msg := &apc.LsoMsg{Prefix: "test_"}
msg.AddProps(apc.GetPropsName, apc.GetPropsSize)
msg.SetFlag(apc.LsArchDir)
objList, err := api.ListObjects(baseParams, bckTo, msg, 0)
tassert.CheckFatal(t, err)
for _, en := range objList.Entries {
tlog.Logf("%s: %dB\n", en.Name, en.Size)
}
num := len(objList.Entries)
tassert.Errorf(t, num == numArchs, "expected %d, have %d", numArchs, num)

msg.SetFlag(apc.LsArchDir)
objList, err = api.ListObjects(baseParams, bckTo, msg, 0)
tassert.CheckFatal(t, err)
num = len(objList.Entries)
expectedNum := numArchs + numArchs*numInArch

if test.ext == cos.ExtMsgpack { // TODO -- FIXME: remove
if num != expectedNum {
tlog.Logf("expected %d, have %d\n", expectedNum, num)
}
} else {
tassert.Errorf(t, num == expectedNum, "expected %d, have %d", expectedNum, num)
}
tassert.Errorf(t, num == expectedNum, "expected %d, have %d", expectedNum, num)

var (
objName string
Expand Down
1 change: 0 additions & 1 deletion sys/sys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,5 @@ func TestProc(t *testing.T) {
"Total must be equal to sum of User and System: %+v", newStats.CPU)
tassert.Errorf(t, newStats.CPU.Total > stats.CPU.Total, "New stats must show more CPU used. Old usage %d, new one: %d", stats.CPU.Total, newStats.CPU.Total)
tassert.Errorf(t, newStats.CPU.Percent > 0.0, "Process must use some CPU. Usage: %g", stats.CPU.Percent)
tassert.Errorf(t, newStats.CPU.Percent < 100.0, "Process should use less than 100%% CPU. Usage: %g", newStats.CPU.Percent)
t.Logf("Process CPU usage: %6.2f%%", newStats.CPU.Percent)
}

0 comments on commit d85d0ef

Please sign in to comment.