storj/satellite/metabase/db_test.go

25 lines
544 B
Go
Raw Normal View History

// Copyright (C) 2021 Storj Labs, Inc.
// See LICENSE for copying information.
package metabase_test
import (
"testing"
"time"
"github.com/stretchr/testify/require"
"storj.io/common/testcontext"
"storj.io/storj/satellite/metabase"
"storj.io/storj/satellite/metabase/metabasetest"
)
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)
})
}