summaryrefslogtreecommitdiff
path: root/workhorse/internal/zipartifacts/errors_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'workhorse/internal/zipartifacts/errors_test.go')
-rw-r--r--workhorse/internal/zipartifacts/errors_test.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/workhorse/internal/zipartifacts/errors_test.go b/workhorse/internal/zipartifacts/errors_test.go
new file mode 100644
index 00000000000..6fce160b3bc
--- /dev/null
+++ b/workhorse/internal/zipartifacts/errors_test.go
@@ -0,0 +1,32 @@
+package zipartifacts
+
+import (
+ "errors"
+ "testing"
+
+ "github.com/stretchr/testify/require"
+)
+
+func TestExitCodeByError(t *testing.T) {
+ t.Run("when error has been recognized", func(t *testing.T) {
+ code := ExitCodeByError(ErrorCode[CodeLimitsReached])
+
+ require.Equal(t, code, CodeLimitsReached)
+ require.Greater(t, code, 10)
+ })
+
+ t.Run("when error is an unknown one", func(t *testing.T) {
+ code := ExitCodeByError(errors.New("unknown error"))
+
+ require.Equal(t, code, CodeUnknownError)
+ require.Greater(t, code, 10)
+ })
+}
+
+func TestErrorLabels(t *testing.T) {
+ for code := range ErrorCode {
+ _, ok := ErrorLabel[code]
+
+ require.True(t, ok)
+ }
+}