Compare commits
No commits in common. "eb574f9ad7e834f18d372b740d3f0e4bee8fcb8c" and "f2cc89736b5fe0e4e2ceb9d764fcd538fc6d3d43" have entirely different histories.
eb574f9ad7
...
f2cc89736b
@ -100,13 +100,11 @@ 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 e == nil {
|
|
||||||
if resourceUri.Scheme == c.Type() {
|
if resourceUri.Scheme == c.Type() {
|
||||||
c.Name, e = filepath.Abs(filepath.Join(resourceUri.Hostname(), resourceUri.RequestURI()))
|
c.Name, e = filepath.Abs(filepath.Join(resourceUri.Hostname(), resourceUri.RequestURI()))
|
||||||
} else {
|
} else {
|
||||||
e = fmt.Errorf("%w: %s is not a %s", ErrInvalidResourceURI, uri, c.Type())
|
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 container.ListOptions) ([]types.Container, error) {
|
InjectContainerList: func(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error) {
|
||||||
return []types.Container{
|
return []types.Container{
|
||||||
{ID: "123456789abc"},
|
{ID: "123456789abc"},
|
||||||
{ID: "123456789def"},
|
{ID: "123456789def"},
|
||||||
|
@ -42,6 +42,8 @@ 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