-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add gRPC msg size, better image name parsing, update a label (#64)
- Loading branch information
1 parent
c959d24
commit 55d8704
Showing
7 changed files
with
97 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package worker | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestExtractImageNameAndTag(t *testing.T) { | ||
tests := []struct { | ||
image string | ||
wantTag string | ||
wantName string | ||
wantRegistry string | ||
}{ | ||
{ | ||
image: "nginx", | ||
wantTag: "latest", | ||
wantName: "nginx", | ||
wantRegistry: "docker.io", | ||
}, | ||
{ | ||
image: "docker.io/nginx", | ||
wantTag: "latest", | ||
wantName: "nginx", | ||
wantRegistry: "docker.io", | ||
}, | ||
{ | ||
image: "docker.io/nginx:1.25.3", | ||
wantTag: "1.25.3", | ||
wantName: "nginx", | ||
wantRegistry: "docker.io", | ||
}, | ||
{ | ||
image: "docker.io/nginx:latest", | ||
wantTag: "latest", | ||
wantName: "nginx", | ||
wantRegistry: "docker.io", | ||
}, | ||
{ | ||
image: "registry.localhost:5000/beta9-runner:py311-latest", | ||
wantTag: "py311-latest", | ||
wantName: "beta9-runner", | ||
wantRegistry: "registry.localhost:5000", | ||
}, | ||
} | ||
|
||
for _, test := range tests { | ||
t.Run(test.image, func(t *testing.T) { | ||
image, err := extractImageNameAndTag(test.image) | ||
assert.NoError(t, err) | ||
|
||
assert.Equal(t, test.wantTag, image.ImageTag) | ||
assert.Equal(t, test.wantName, image.ImageName) | ||
assert.Equal(t, test.wantRegistry, image.SourceRegistry) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters