Add the Read/List service functions (#2123)

This commit is contained in:
Todd authored and GitHub committed 2022-06-03 11:19:04 -07:00
1 parent 5c76017dd6
commit abbfe45419
9 files changed
+747 -108

No files matched your search

+10 -1
View File
@@ -14,7 +14,12 @@ import (
func TestTestWorker(t *testing.T) {
conn, _ := db.TestSetup(t, "postgres")
wrapper := db.TestWrapper(t)
tWorker := TestWorker(t, conn, wrapper)
const (
name = "test name"
description = "test description"
address = "test address"
)
tWorker := TestWorker(t, conn, wrapper, WithName(name), WithDescription(description), WithAddress(address))
assert.NotNil(t, tWorker)
assert.True(t, strings.HasPrefix(tWorker.GetPublicId(), WorkerPrefix))
@@ -23,4 +28,8 @@ func TestTestWorker(t *testing.T) {
rw := db.New(conn)
require.NoError(t, rw.LookupById(context.Background(), lkpWorker))
assert.NotNil(t, lkpWorker)
assert.NotNil(t, lkpWorker.GetLastStatusTime())
assert.Equal(t, name, lkpWorker.GetName())
assert.Equal(t, description, lkpWorker.GetDescription())
assert.Equal(t, address, lkpWorker.GetAddress())
}