Skip to content

Commit

Permalink
fix: Fix OCI Registry feed update (#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
denys-octopus authored Oct 20, 2024
1 parent 1d2223a commit b9a479d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/feeds/feed_utilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ func ToFeedResource(feed IFeed) (*FeedResource, error) {
feedResource.AccessKey = s3Feed.AccessKey
feedResource.SecretKey = s3Feed.SecretKey
feedResource.UseMachineCredentials = s3Feed.UseMachineCredentials
case FeedTypeOCIRegistry:
ociFeed := feed.(*OCIRegistryFeed)
feedResource.FeedURI = ociFeed.FeedURI
case FeedTypeOctopusProject:
// nothing to copy
}
Expand Down
25 changes: 25 additions & 0 deletions pkg/feeds/feed_utilities_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -588,3 +588,28 @@ func TestOCIRegistry(t *testing.T) {
t.Fatalf("Username does not match")
}
}

func TestOCIRegistryToResource(t *testing.T) {
feed := OCIRegistryFeed{
FeedURI: "oci://registry-2.docker.io",
feed: *newFeed("Test Registry 2", FeedTypeOCIRegistry),
}

feedResource, err := ToFeedResource(&feed)

if err != nil {
t.Fatalf("Error should not have been returned. %s", err)
}

if feedResource.FeedType != FeedTypeOCIRegistry {
t.Fatalf("FeedType does not match")
}

if feedResource.Name != "Test Registry 2" {
t.Fatalf("Name does not match")
}

if feedResource.FeedURI != "oci://registry-2.docker.io" {
t.Fatalf("FeedURI does not match")
}
}

0 comments on commit b9a479d

Please sign in to comment.