add tag deletion event
whenever a tag is deleted an event is sent out via the regular notification channels Signed-off-by: Manish Tomar <manish.tomar@docker.com>
This commit is contained in:
parent
f0cc927784
commit
0d8f4ac7b8
4 changed files with 66 additions and 7 deletions
|
@ -50,12 +50,12 @@ func TestListener(t *testing.T) {
|
|||
"layer:push": 2,
|
||||
"layer:pull": 2,
|
||||
"layer:delete": 2,
|
||||
"tag:delete": 1,
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(tl.ops, expectedOps) {
|
||||
t.Fatalf("counts do not match:\n%v\n !=\n%v", tl.ops, expectedOps)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
type testListener struct {
|
||||
|
@ -64,7 +64,6 @@ type testListener struct {
|
|||
|
||||
func (tl *testListener) ManifestPushed(repo reference.Named, m distribution.Manifest, options ...distribution.ManifestServiceOption) error {
|
||||
tl.ops["manifest:push"]++
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -98,6 +97,11 @@ func (tl *testListener) BlobDeleted(repo reference.Named, d digest.Digest) error
|
|||
return nil
|
||||
}
|
||||
|
||||
func (tl *testListener) TagDeleted(repo reference.Named, tag string) error {
|
||||
tl.ops["tag:delete"]++
|
||||
return nil
|
||||
}
|
||||
|
||||
// checkExerciseRegistry takes the registry through all of its operations,
|
||||
// carrying out generic checks.
|
||||
func checkExerciseRepository(t *testing.T, repository distribution.Repository) {
|
||||
|
@ -200,6 +204,10 @@ func checkExerciseRepository(t *testing.T, repository distribution.Repository) {
|
|||
if err != nil {
|
||||
t.Fatalf("unexpected error deleting blob: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
err = repository.Tags(ctx).Untag(ctx, m.Tag)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error deleting tag: %v", err)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue