Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add and remove service info from devfile #4465

Merged
merged 17 commits into from
Apr 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ require (
github.com/Netflix/go-expect v0.0.0-20200312175327-da48e75238e2
github.com/blang/semver v3.5.1+incompatible
github.com/containerd/containerd v1.3.3 // indirect
github.com/devfile/api/v2 v2.0.0-20210211160219-33a78aec06af
github.com/devfile/library v0.0.0-20210216162950-3066a892876c
github.com/devfile/api/v2 v2.0.0-20210304212617-bfc3f501616b
github.com/devfile/library v1.0.0-alpha.2.0.20210323153322-3d708859f0b5
github.com/docker/docker v17.12.0-ce-rc1.0.20200309214505-aa6a9891b09c+incompatible
github.com/docker/go-connections v0.4.1-0.20200120150455-7dc0a2d6ddce
github.com/fatih/color v1.7.0
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,10 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/daviddengcn/go-colortext v0.0.0-20160507010035-511bcaf42ccd/go.mod h1:dv4zxwHi5C/8AeI+4gX4dCWOIvNi7I6JCSX0HvlKPgE=
github.com/deislabs/oras v0.7.0/go.mod h1:sqMKPG3tMyIX9xwXUBRLhZ24o+uT4y6jgBD2RzUTKDM=
github.com/denisenkom/go-mssqldb v0.0.0-20190515213511-eb9f6a1743f3/go.mod h1:zAg7JM8CkOJ43xKXIj7eRO9kmWm/TW578qo+oDO6tuM=
github.com/devfile/api/v2 v2.0.0-20210211160219-33a78aec06af h1:egbFAAS/CWJMAqa4zIm8Cik3+iCqTAfLPfCj6PLEG5Y=
github.com/devfile/api/v2 v2.0.0-20210211160219-33a78aec06af/go.mod h1:Cot4snybn3qhIh48oIFi9McocnIx7zY5fFbjfrIpPvg=
github.com/devfile/library v0.0.0-20210216162950-3066a892876c h1:NL9EpuPuFVxCqE00Bh1Uw3YsEqoMdwq4vx0OXSZRVnU=
github.com/devfile/library v0.0.0-20210216162950-3066a892876c/go.mod h1:aGJSpcGrRiYwsQQJMQH1ChHuOptUf49n+j0RDBYyTIQ=
github.com/devfile/api/v2 v2.0.0-20210304212617-bfc3f501616b h1:r6Z2rXRA60eQQTdh1cJBBrj3vp9/c1rNbX42kyw2WpA=
github.com/devfile/api/v2 v2.0.0-20210304212617-bfc3f501616b/go.mod h1:Cot4snybn3qhIh48oIFi9McocnIx7zY5fFbjfrIpPvg=
github.com/devfile/library v1.0.0-alpha.2.0.20210323153322-3d708859f0b5 h1:cxv4Cs86FcWhpKFXITuxwH0qI1Ik9U34HVM+F8x+ncU=
github.com/devfile/library v1.0.0-alpha.2.0.20210323153322-3d708859f0b5/go.mod h1:6WF7h4BVqUyAULCa3bCjHgFueeOPc2qIipVmtDbWkNY=
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
Expand Down
65 changes: 44 additions & 21 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import (
"reflect"
"testing"

"github.com/devfile/library/pkg/devfile/parser/data"

devfilev1 "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
"github.com/devfile/library/pkg/devfile/parser"
devfileCtx "github.com/devfile/library/pkg/devfile/parser/context"
"github.com/devfile/library/pkg/testingutil"
devfilefs "github.com/devfile/library/pkg/testingutil/filesystem"
"github.com/kylelemons/godebug/pretty"
odoTestingUtil "github.com/openshift/odo/pkg/testingutil"
Expand Down Expand Up @@ -525,18 +526,12 @@ func TestSetDevfileConfiguration(t *testing.T) {
currentDevfile: odoTestingUtil.GetTestDevfileObj(fs),
wantDevFile: parser.DevfileObj{
Ctx: devfileCtx.FakeContext(fs, parser.OutputDevfileYamlPath),
Data: &testingutil.TestDevfileData{
Commands: []devfilev1.Command{
{
Id: "devbuild",
CommandUnion: devfilev1.CommandUnion{
Exec: &devfilev1.ExecCommand{
WorkingDir: "/projects/nodejs-starter",
},
},
},
},
Components: []devfilev1.Component{
Data: func() data.DevfileData {
dharmit marked this conversation as resolved.
Show resolved Hide resolved
devfileData, err := data.NewDevfileData(string(data.APIVersion200))
if err != nil {
t.Error(err)
}
err = devfileData.AddComponents([]devfilev1.Component{
{
Name: "runtime",
ComponentUnion: devfilev1.ComponentUnion{
Expand Down Expand Up @@ -565,8 +560,25 @@ func TestSetDevfileConfiguration(t *testing.T) {
},
},
},
},
},
})
if err != nil {
t.Error(err)
}
err = devfileData.AddCommands([]devfilev1.Command{
{
Id: "devbuild",
CommandUnion: devfilev1.CommandUnion{
Exec: &devfilev1.ExecCommand{
WorkingDir: "/projects/nodejs-starter",
},
},
},
})
if err != nil {
t.Error(err)
}
return devfileData
}(),
},
},
{
Expand All @@ -577,8 +589,12 @@ func TestSetDevfileConfiguration(t *testing.T) {
currentDevfile: odoTestingUtil.GetTestDevfileObj(fs),
wantDevFile: parser.DevfileObj{
Ctx: devfileCtx.FakeContext(fs, parser.OutputDevfileYamlPath),
Data: &testingutil.TestDevfileData{
Commands: []devfilev1.Command{
Data: func() data.DevfileData {
devfileData, err := data.NewDevfileData(string(data.APIVersion200))
if err != nil {
t.Error(err)
}
err = devfileData.AddCommands([]devfilev1.Command{
{
Id: "devbuild",
CommandUnion: devfilev1.CommandUnion{
Expand All @@ -587,8 +603,11 @@ func TestSetDevfileConfiguration(t *testing.T) {
},
},
},
},
Components: []devfilev1.Component{
})
if err != nil {
t.Error(err)
}
err = devfileData.AddComponents([]devfilev1.Component{
{
Name: "runtime",
ComponentUnion: devfilev1.ComponentUnion{
Expand Down Expand Up @@ -635,8 +654,12 @@ func TestSetDevfileConfiguration(t *testing.T) {
},
},
},
},
},
})
if err != nil {
t.Error(err)
}
return devfileData
}(),
},
},
{
Expand Down
Loading