less magic consonants in tests
This commit is contained in:
committed by
Umputun
parent
ef1dd8162b
commit
df547cc815
@@ -95,7 +95,7 @@ func TestBoltStore_Cleanup(t *testing.T) {
|
||||
err = svc.Commit(img3)
|
||||
require.NoError(t, err)
|
||||
|
||||
err = svc.Cleanup(context.Background(), time.Millisecond*10)
|
||||
err = svc.Cleanup(context.Background(), time.Millisecond*100)
|
||||
assert.NoError(t, err)
|
||||
|
||||
assertBoltImgNil(t, svc.db, imagesStagedBktName, img2)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Code generated by mockery v1.0.0. DO NOT EDIT.
|
||||
// Code generated by mockery v1.1.2. DO NOT EDIT.
|
||||
|
||||
package image
|
||||
|
||||
|
||||
@@ -127,10 +127,11 @@ func TestService_Cleanup(t *testing.T) {
|
||||
store.On("Cleanup", mock.Anything, mock.Anything).Times(10).Return(nil)
|
||||
|
||||
svc := NewService(&store, ServiceParams{EditDuration: 20 * time.Millisecond})
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond*549)
|
||||
// cancel context after 2.1 cleanup TTLs
|
||||
ctx, cancel := context.WithTimeout(context.Background(), svc.EditDuration / 100 * 25 * 21)
|
||||
defer cancel()
|
||||
svc.Cleanup(ctx)
|
||||
store.AssertNumberOfCalls(t, "Cleanup", 10)
|
||||
store.AssertNumberOfCalls(t, "Cleanup", 2)
|
||||
}
|
||||
|
||||
func TestService_Submit(t *testing.T) {
|
||||
|
||||
@@ -1345,7 +1345,7 @@ func TestService_submitImages(t *testing.T) {
|
||||
imgSvc := image.NewService(&mockStore,
|
||||
image.ServiceParams{
|
||||
EditDuration: 50 * time.Millisecond,
|
||||
ImageAPI: "/",
|
||||
ImageAPI: "/images/dev/",
|
||||
ProxyAPI: "/non_existent",
|
||||
})
|
||||
defer imgSvc.Close(context.TODO())
|
||||
@@ -1367,7 +1367,7 @@ func TestService_submitImages(t *testing.T) {
|
||||
assert.NoError(t, err)
|
||||
|
||||
b.submitImages(c)
|
||||
time.Sleep(250 * time.Millisecond)
|
||||
time.Sleep(b.EditDuration + 100 * time.Millisecond)
|
||||
mockStore.AssertNumberOfCalls(t, "Commit", 2)
|
||||
}
|
||||
|
||||
@@ -1408,7 +1408,7 @@ func TestService_ResubmitStagingImages(t *testing.T) {
|
||||
mockStore.On("Commit", "dev_user/bqf122eq9r8ad657n3ng").Once().Return(nil)
|
||||
mockStore.On("Commit", "dev_user/bqf321eq9r8ad657n3ng").Once().Return(nil)
|
||||
mockStore.On("Commit", "cached_images/12318fbd4c55e9d177b8b5ae197bc89c5afd8e07-a41fcb00643f28d700504256ec81cbf2e1aac53e").Once().Return(nil)
|
||||
time.Sleep(time.Millisecond * 100)
|
||||
time.Sleep(b.EditDuration + time.Millisecond * 100)
|
||||
|
||||
mockStore.AssertNumberOfCalls(t, "Info", 1)
|
||||
mockStore.AssertNumberOfCalls(t, "Commit", 3)
|
||||
|
||||
Reference in New Issue
Block a user