Files
threshold/internal/scheduler/job/run_test.go
T
Louis Ruch feb5d7385d Louis job scheduler (#1197)
* Adds job repo
* Adds scheduler
* Adds plugin table which is a place holder for future expansion of the scheduler. Currently all jobs that are created are linked to the pi_system plugin which are jobs that are held in a local registeredJobs map populated at controller startup.
2021-05-06 14:54:10 -07:00

49 lines
998 B
Go

package job
import (
"testing"
"github.com/hashicorp/boundary/internal/scheduler/job/store"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestRun_SetTableName(t *testing.T) {
t.Parallel()
defaultTableName := "job_run"
tests := []struct {
name string
initialName string
setNameTo string
want string
}{
{
name: "new-name",
initialName: "",
setNameTo: "new-name",
want: "new-name",
},
{
name: "reset to default",
initialName: "initial",
setNameTo: "",
want: defaultTableName,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
assert, require := assert.New(t), require.New(t)
def := &Run{
JobRun: &store.JobRun{},
}
require.Equal(defaultTableName, def.TableName())
s := &Run{
JobRun: &store.JobRun{},
tableName: tt.initialName,
}
s.SetTableName(tt.setNameTo)
assert.Equal(tt.want, s.TableName())
})
}
}