feat(pkger): extend stack with name and description fields

pull/17377/head
Johnny Steenbergen 2020-03-20 11:12:01 -07:00 committed by Johnny Steenbergen
parent e116ecaf5e
commit aae629bffd
3 changed files with 18 additions and 8 deletions

View File

@ -25,6 +25,8 @@ type (
// If the pkg is applied, and no changes are had, then the stack is not updated.
Stack struct {
ID influxdb.ID
Name string
Desc string
URLS []url.URL
Resources []StackResource

View File

@ -15,8 +15,10 @@ type (
ID []byte `json:"id"`
OrgID []byte `json:"orgID"`
URLs []string `json:"urls,omitempty"`
Resources []entStackResource `json:"resources,omitempty"`
Name string `json:"name"`
Description string `json:"description"`
URLs []string `json:"urls,omitempty"`
Resources []entStackResource `json:"resources,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
@ -167,11 +169,13 @@ func convertStackToEnt(orgID influxdb.ID, stack Stack) (kv.Entity, error) {
}
stEnt := entStack{
ID: idBytes,
OrgID: orgIDBytes,
CreatedAt: stack.CreatedAt,
UpdatedAt: stack.UpdatedAt,
URLs: urlStrs,
ID: idBytes,
OrgID: orgIDBytes,
Name: stack.Name,
Description: stack.Desc,
CreatedAt: stack.CreatedAt,
UpdatedAt: stack.UpdatedAt,
URLs: urlStrs,
}
for _, res := range stack.Resources {
@ -192,6 +196,8 @@ func convertStackToEnt(orgID influxdb.ID, stack Stack) (kv.Entity, error) {
func convertStackEntToStack(ent *entStack) (Stack, error) {
stack := Stack{
Name: ent.Name,
Desc: ent.Description,
CRUDLog: influxdb.CRUDLog{
CreatedAt: ent.CreatedAt,
UpdatedAt: ent.UpdatedAt,

View File

@ -19,7 +19,9 @@ func TestStoreKv(t *testing.T) {
stackStub := func(id influxdb.ID) pkger.Stack {
now := time.Time{}.Add(10 * 365 * 24 * time.Hour)
return pkger.Stack{
ID: id,
ID: id,
Name: "threeve",
Desc: "desc",
CRUDLog: influxdb.CRUDLog{
CreatedAt: now,
UpdatedAt: now.Add(time.Hour),