diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml new file mode 100644 index 00000000..2535f5c6 --- /dev/null +++ b/.github/workflows/codecov.yml @@ -0,0 +1,18 @@ +name: Test and coverage + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 2 + - uses: actions/setup-go@v2 + with: + go-version: '1.17' + - name: Run coverage + run: go test -race -coverprofile=coverage.txt -covermode=atomic ./... + - name: Upload coverage to Codecov + run: bash <(curl -s https://codecov.io/bash) diff --git a/internal/core/notification/notify_test.go b/internal/core/notification/notify_test.go deleted file mode 100644 index fe645031..00000000 --- a/internal/core/notification/notify_test.go +++ /dev/null @@ -1,25 +0,0 @@ -package notification - -import ( - notification "github.com/go-atomci/atomci/internal/core/notification/impl" - messages "github.com/go-atomci/atomci/internal/core/notification/types" - "testing" -) - -func TestNotifyEmail(t *testing.T) { - notification.EmailHandler().Send(messages.StepCallbackResult{ - StageName: "", - PublishName: "", - StepName: "", - Status: 1, - }) -} - -func TestNotifyDingRobot(t *testing.T) { - notification.DingRobotHandler().Send(messages.StepCallbackResult{ - StageName: "aa", - PublishName: "bb", - StepName: "cc", - Status: 0, - }) -} diff --git a/internal/core/pipelinemgr/utils_test.go b/internal/core/pipelinemgr/utils_test.go index 3dcd07d8..f0f69500 100644 --- a/internal/core/pipelinemgr/utils_test.go +++ b/internal/core/pipelinemgr/utils_test.go @@ -26,4 +26,4 @@ func TestGetStatus(t *testing.T) { t.Run("jenkins", func(t *testing.T) { assert.Nil(t, nil) }) -} +} \ No newline at end of file diff --git a/utils/utils_test.go b/utils/utils_test.go index 61b8da77..6f52fd90 100644 --- a/utils/utils_test.go +++ b/utils/utils_test.go @@ -8,7 +8,7 @@ import ( ) func TestAesCrypto(t *testing.T) { - crypted := base64.StdEncoding.EncodeToString(AesEny([]byte("Hello"))) - log.Printf("%s", crypted) - assert.NotEmpty(t, crypted) + encrypted := base64.StdEncoding.EncodeToString(AesEny([]byte("Hello"))) + log.Printf("%s", encrypted) + assert.NotEmpty(t, encrypted) } diff --git a/utils/uuid_test.go b/utils/uuid_test.go new file mode 100644 index 00000000..fed8872a --- /dev/null +++ b/utils/uuid_test.go @@ -0,0 +1,12 @@ +package utils + +import ( + "github.com/stretchr/testify/assert" + "testing" +) + +func Test_NEWUUID_SHOULD_NOT_EMPTY(t *testing.T) { + uuid := NewUUID() + + assert.NotEmpty(t, uuid) +}