2021-02-08 09:33:45 +00:00
|
|
|
// Copyright (C) 2021 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
package metabase_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
2021-05-07 10:05:51 +01:00
|
|
|
"time"
|
2021-02-08 09:33:45 +00:00
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
|
|
|
|
"storj.io/common/testcontext"
|
2021-04-21 13:42:57 +01:00
|
|
|
"storj.io/storj/satellite/metabase"
|
2021-04-26 10:35:44 +01:00
|
|
|
"storj.io/storj/satellite/metabase/metabasetest"
|
2021-02-08 09:33:45 +00:00
|
|
|
)
|
|
|
|
|
2021-05-07 10:05:51 +01:00
|
|
|
func TestNow(t *testing.T) {
|
|
|
|
metabasetest.Run(t, func(ctx *testcontext.Context, t *testing.T, db *metabase.DB) {
|
|
|
|
sysnow := time.Now()
|
|
|
|
now, err := db.Now(ctx)
|
|
|
|
require.NoError(t, err)
|
|
|
|
require.WithinDuration(t, sysnow, now, 5*time.Second)
|
|
|
|
})
|
|
|
|
}
|