open-nomad/nomad/state/indexer/indexer_test.go
James Rasell 0cde3182eb
core: add ACL token expiry state, struct, and RPC handling. (#13718)
The ACL token state schema has been updated to utilise two new
indexes which track expiration of tokens that are configured with
an expiration TTL or time. A new state function allows listing
ACL expired tokens which will be used by internal garbage
collection.

The ACL endpoint has been modified so that all validation happens
within a single function call. This is easier to understand and
see at a glance. The ACL token validation now also includes logic
for expiry TTL and times. The ACL endpoint upsert tests have been
condensed into a single, table driven test.

There is a new token canonicalize which provides a single place
for token canonicalization, rather than logic spread in the RPC
handler.
2022-07-13 15:40:34 +02:00

16 lines
327 B
Go

package indexer
import (
"testing"
"time"
"github.com/stretchr/testify/require"
)
func Test_IndexBuilder_Time(t *testing.T) {
builder := &IndexBuilder{}
testTime := time.Date(1987, time.April, 13, 8, 3, 0, 0, time.UTC)
builder.Time(testTime)
require.Equal(t, []byte{0, 0, 0, 0, 32, 128, 155, 180}, builder.Bytes())
}