Skip to content

Commit b795b6e

Browse files
committed
Adding some fixups and tests to ghcr Client
1 parent 95f90ba commit b795b6e

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

pkg/client/ghcr/ghcr.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func New(opts Options) *Client {
3737
if opts.Hostname != "" {
3838
client, err = client.WithEnterpriseURLs(fmt.Sprintf("https://%s/", opts.Hostname), fmt.Sprintf("https://%s/api/uploads/", opts.Hostname))
3939
if err != nil {
40-
panic(fmt.Errorf("setting enterprise URLs: %w", err))
40+
panic(fmt.Errorf("failed setting enterprise URLs: %w", err))
4141
}
4242
}
4343

pkg/client/ghcr/path_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ func TestIsHost(t *testing.T) {
7272
customhost: strPtr("customhostname.ghe.internal"),
7373
expIs: true,
7474
},
75+
"not-my-customhostname.ghe.internal should be false": {
76+
token: "test-token",
77+
host: "not-my-customhostname.ghe.internal",
78+
customhost: strPtr("customhostname.ghe.internal"),
79+
expIs: false,
80+
},
7581
}
7682

7783
handler := new(Client)

0 commit comments

Comments
 (0)