Skip to content

Commit

Permalink
added a unit test for clone()
Browse files Browse the repository at this point in the history
Signed-off-by: Kyle M. Tarplee <[email protected]>
  • Loading branch information
ktarplee committed Sep 21, 2023
1 parent 3f0e8fc commit 71005aa
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions registry/remote/repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7447,3 +7447,24 @@ func TestRepository_do(t *testing.T) {
t.Errorf("Repository.do() = %v, want %v", gotWarnings, wantWarnings)
}
}

func TestRepository_clone(t *testing.T) {
repo, err := NewRepository("localhost:1234/repo/image")
if err != nil {
t.Fatalf("invalid repository: %v", err)
}

crepo := repo.clone()

if repo.Reference != crepo.Reference {
t.Fatal("references should be the same")
}

if !reflect.DeepEqual(&repo.referrersPingLock, &crepo.referrersPingLock) {
t.Fatal("referrersPingLock should be copied")
}

if !reflect.DeepEqual(&repo.referrersMergePool, &crepo.referrersMergePool) {
t.Fatal("referrersMergePool should be copied")
}
}

0 comments on commit 71005aa

Please sign in to comment.