Fix 404 handling when deleting a manifest (#850)
Upstream was previously using an internal notFound error, and we were
relying on fragile string matching to detect it. This broke when we
upgraded to Docker v28.
d25e260d2e (diff-a5e122cd2318f2dc156f373804a59d30355b0c308b9e64f48e0713344fcdba33L164)
Nowadays containerd exposes a public ErrNotFound which we can use
instead.
Fixes #849.
This commit is contained in:
@@ -24,6 +24,7 @@ import (
|
||||
"go.uber.org/mock/gomock"
|
||||
|
||||
provider "github.com/pulumi/pulumi-go-provider"
|
||||
"github.com/pulumi/pulumi-go-provider/infer"
|
||||
"github.com/pulumi/pulumi-go-provider/integration"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/common/resource"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/common/util/mapper"
|
||||
@@ -235,3 +236,26 @@ func TestIndexDiff(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestIndexDelete(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Run("manifest already deleted (404)", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctrl := gomock.NewController(t)
|
||||
client := NewMockClient(ctrl)
|
||||
client.EXPECT().
|
||||
ManifestDelete(gomock.Any(), "docker.io/pulumi/test:manifest").
|
||||
Return(errNotFound{})
|
||||
|
||||
i := &Index{clientF: mockClientF(client)}
|
||||
|
||||
_, err := i.Delete(t.Context(), infer.DeleteRequest[IndexState]{
|
||||
ID: "foo",
|
||||
State: IndexState{
|
||||
IndexArgs: IndexArgs{Tag: "docker.io/pulumi/test:manifest"},
|
||||
Ref: "docker.io/pulumi/test:manifest",
|
||||
},
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user