-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Disk Manager] Fix flappy test for snapshot service #3120
base: main
Are you sure you want to change the base?
Changes from 5 commits
e9a2aea
688c6cc
332ec14
efc047e
f6eed5f
7df6970
c4641ae
7959f6f
12f3e4b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -598,7 +598,7 @@ func TestSnapshotServiceDeleteIncrementalSnapshotWhileCreating(t *testing.T) { | |
require.NotEmpty(t, createOperation) | ||
|
||
// Need to add some variance for better testing. | ||
common.WaitForRandomDuration(1*time.Second, 3*time.Second) | ||
common.WaitForRandomDuration(1*time.Millisecond, 3*time.Second) | ||
|
||
reqCtx = testcommon.GetRequestContext(t, ctx) | ||
deleteOperation, err := client.DeleteSnapshot(reqCtx, &disk_manager.DeleteSnapshotRequest{ | ||
|
@@ -612,22 +612,25 @@ func TestSnapshotServiceDeleteIncrementalSnapshotWhileCreating(t *testing.T) { | |
err = internal_client.WaitOperation(ctx, client, deleteOperation.Id) | ||
require.NoError(t, err) | ||
|
||
// In case of successful snapshot1 creation, snapshot1 should be deleted | ||
// and checkpoint should be deleted too. | ||
// Otherwise we should check incremental table. | ||
if creationErr == nil { | ||
testcommon.RequireCheckpointsDoNotExist(t, ctx, diskID) | ||
} else { | ||
// If snapshot creation ends up successfuly, there may be two cases: | ||
// Snapshot was created and then deleted, so should be no checkpoints left | ||
// or snapshot deletion ended up before creation, snapshot was not deleted, | ||
// so there should be a checkpoint. | ||
if creationErr != nil { | ||
snapshotID, _, err := testcommon.GetIncremental(ctx, &types.Disk{ | ||
ZoneId: "zone-a", | ||
DiskId: diskID, | ||
}) | ||
require.NoError(t, err) | ||
|
||
// Should wait here because checkpoint is deleted on |createOperation| | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. не понятный коммент что за |createOperation| operation? во-первых - какая-то тавтология There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Сверху есть переменная createOperation, на ошибку от которой мы и смотрим. Про тавтологию согласен |
||
// operation cancel (and exact time of this event is unknown). | ||
testcommon.WaitForCheckpointsDoNotExist(t, ctx, diskID, snapshotID1) | ||
// In case of snapshot1 creation failure base snapshot may be already | ||
// deleted from incremental table and then checkpoint should not exist | ||
// on the disk. Otherwise checkpoint should exist. | ||
// on the disk. Otherwise base snapshot checkpoint should exist. | ||
if len(snapshotID) > 0 { | ||
require.Equal(t, snapshotID, baseSnapshotID) | ||
Rattysed marked this conversation as resolved.
Show resolved
Hide resolved
|
||
testcommon.RequireCheckpoint(t, ctx, diskID, baseSnapshotID) | ||
} else { | ||
testcommon.RequireCheckpointsDoNotExist(t, ctx, diskID) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
чет я не понял комментария
ты пишешь про случае когда снапшот успешно создался
а иф проверяет то что создание с ошибой упало
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Пишу как раз чтобы объяснить, почему этот случай не проверяем. Для случая с ошибкой комментарий внутри