mirror of
https://github.com/redhat-developer/odo.git
synced 2025-10-19 03:06:19 +03:00
* [api/devstate] Add volumes to Devfile content * Add Volume related endpoints to API * Create/Delete volumes from the Volumes Tab * Update UI static files * API Devstate returns VolumeMounts * Display volume mounts in containers * [api] Add VolumeMounts to containers * [ui] Define container's volume mounts * [ui] e2e tests * Update UI static files * [ui] create volumes from container / exec command creation * Update UI static files * Update container display * Update UI static files * Regenerate UI static files
46 lines
1019 B
Go
46 lines
1019 B
Go
package devstate
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/google/go-cmp/cmp"
|
|
. "github.com/redhat-developer/odo/pkg/apiserver-gen/go"
|
|
)
|
|
|
|
func TestDevfileState_GetContent(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
state func() DevfileState
|
|
want DevfileContent
|
|
wantErr bool
|
|
}{
|
|
{
|
|
state: func() DevfileState {
|
|
return NewDevfileState()
|
|
},
|
|
want: DevfileContent{
|
|
Content: "metadata: {}\nschemaVersion: 2.2.0\n",
|
|
Commands: []Command{},
|
|
Containers: []Container{},
|
|
Images: []Image{},
|
|
Resources: []Resource{},
|
|
Volumes: []Volume{},
|
|
Events: Events{},
|
|
},
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
o := tt.state()
|
|
got, err := o.GetContent()
|
|
if (err != nil) != tt.wantErr {
|
|
t.Errorf("DevfileState.GetContent() error = %v, wantErr %v", err, tt.wantErr)
|
|
return
|
|
}
|
|
if diff := cmp.Diff(tt.want, got); diff != "" {
|
|
t.Errorf("DevfileState.GetContent() mismatch (-want +got):\n%s", diff)
|
|
}
|
|
})
|
|
}
|
|
}
|