Compare commits
2 Commits
f2cc89736b
...
eb574f9ad7
Author | SHA1 | Date | |
---|---|---|---|
eb574f9ad7 | |||
9ed42521c8 |
@ -100,10 +100,12 @@ func (c *Container) URI() string {
|
|||||||
|
|
||||||
func (c *Container) SetURI(uri string) error {
|
func (c *Container) SetURI(uri string) error {
|
||||||
resourceUri, e := url.Parse(uri)
|
resourceUri, e := url.Parse(uri)
|
||||||
if resourceUri.Scheme == c.Type() {
|
if e == nil {
|
||||||
c.Name, e = filepath.Abs(filepath.Join(resourceUri.Hostname(), resourceUri.RequestURI()))
|
if resourceUri.Scheme == c.Type() {
|
||||||
} else {
|
c.Name, e = filepath.Abs(filepath.Join(resourceUri.Hostname(), resourceUri.RequestURI()))
|
||||||
e = fmt.Errorf("%w: %s is not a %s", ErrInvalidResourceURI, uri, c.Type())
|
} else {
|
||||||
|
e = fmt.Errorf("%w: %s is not a %s", ErrInvalidResourceURI, uri, c.Type())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ func TestReadContainer(t *testing.T) {
|
|||||||
state: present
|
state: present
|
||||||
`
|
`
|
||||||
m := &mocks.MockContainerClient{
|
m := &mocks.MockContainerClient{
|
||||||
InjectContainerList: func(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error) {
|
InjectContainerList: func(ctx context.Context, options container.ListOptions) ([]types.Container, error) {
|
||||||
return []types.Container{
|
return []types.Container{
|
||||||
{ID: "123456789abc"},
|
{ID: "123456789abc"},
|
||||||
{ID: "123456789def"},
|
{ID: "123456789def"},
|
||||||
|
@ -42,8 +42,6 @@ func (m *MockResource) Type() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *MockResource) UnmarshalJSON(data []byte) error {
|
func (m *MockResource) UnmarshalJSON(data []byte) error {
|
||||||
fmt.Printf("UnmarshalJSON %#v\n", string(data))
|
|
||||||
panic(data)
|
|
||||||
if err := json.Unmarshal(data, m); err != nil {
|
if err := json.Unmarshal(data, m); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user