Skip to content

Commit

Permalink
Feature: Support unit test in go.2 (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
a67793581 authored Sep 11, 2023
1 parent 8ee7d7d commit d027995
Show file tree
Hide file tree
Showing 3 changed files with 422 additions and 28 deletions.
38 changes: 19 additions & 19 deletions .github/workflows/kubekf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,22 +101,22 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

docker-image-tests:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}

- name: Run tests
run: make build
- name: Test docker image
run: |
docker build -t openkf:ci-build .
# docker-image-tests:
# runs-on: ubuntu-20.04
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# with:
# fetch-depth: 0
#
# - name: Set up Go
# uses: actions/setup-go@v3
# with:
# go-version: ${{ env.GO_VERSION }}
#
# - name: Run tests
# run: make build
#
# - name: Test docker image
# run: |
# docker build -t openkf:ci-build .
18 changes: 9 additions & 9 deletions server/pkg/utils/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ func TestGenUUID(t *testing.T) {
want string
}{
{
name: "测试-GenUUID",
name: "test-GenUUID",
want: "",
},
}
Expand All @@ -30,7 +30,7 @@ func TestGenUUIDWithoutHyphen(t *testing.T) {
want string
}{
{
name: "测试-GenUUIDWithoutHyphen",
name: "test-GenUUIDWithoutHyphen",
want: "",
},
}
Expand All @@ -54,7 +54,7 @@ func Test_encodeCanonical(t *testing.T) {
args args
}{
{
name: "测试-encodeCanonical",
name: "test-encodeCanonical",
args: args{
dst: buf[:],
u: uuid.Must(uuid.NewV4()),
Expand All @@ -78,7 +78,7 @@ func Test_toString(t *testing.T) {
want string
}{
{
name: "测试-toString",
name: "test-toString",
args: args{
u: uuid.Must(uuid.NewV4()),
},
Expand All @@ -105,7 +105,7 @@ func TestComparePassword(t *testing.T) {
want bool
}{
{
name: "测试-ComparePassword",
name: "test-ComparePassword",
args: args{
password: "123456",
encryptedPassword: "fa9ffa9a6017dee3be4e4063d108b69b54c4c8b3e9465a65b8d3191481655141",
Expand All @@ -132,7 +132,7 @@ func TestEncryptPassword(t *testing.T) {
want string
}{
{
name: "测试-EncryptPassword",
name: "test-EncryptPassword",
args: args{
password: "123456",
},
Expand All @@ -158,7 +158,7 @@ func TestIntToString(t *testing.T) {
want string
}{
{
name: "测试-IntToString",
name: "test-IntToString",
args: args{
i: 1,
},
Expand All @@ -184,7 +184,7 @@ func TestIsValidEmail(t *testing.T) {
want bool
}{
{
name: "测试-IsValidEmail",
name: "test-IsValidEmail",
args: args{
email: "[email protected]",
},
Expand All @@ -210,7 +210,7 @@ func TestStringToInt(t *testing.T) {
want int
}{
{
name: "测试-StringToInt",
name: "test-StringToInt",
args: args{
i: "1",
},
Expand Down
Loading

0 comments on commit d027995

Please sign in to comment.