diff --git a/go.mod b/go.mod index ff6d6419596..a4823d9559c 100644 --- a/go.mod +++ b/go.mod @@ -24,7 +24,7 @@ require ( github.com/gorilla/websocket v1.5.0 github.com/joshdk/go-junit v1.0.0 github.com/kelseyhightower/envconfig v1.4.0 - github.com/kubeshop/testkube-operator v1.10.8-0.20230615105405-95faaa73d012 + github.com/kubeshop/testkube-operator v1.10.8-0.20230621113013-570eb19fe281 github.com/minio/minio-go/v7 v7.0.47 github.com/montanaflynn/stats v0.6.6 github.com/moogar0880/problems v0.1.1 diff --git a/go.sum b/go.sum index 13e7c10f5ef..0b8b8ccffea 100644 --- a/go.sum +++ b/go.sum @@ -387,8 +387,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/kubeshop/testkube-operator v1.10.8-0.20230615105405-95faaa73d012 h1:O8nDxO4TGDm6nv8ZjEbnHaBDEPZZQiVE9tJtIN7qkic= -github.com/kubeshop/testkube-operator v1.10.8-0.20230615105405-95faaa73d012/go.mod h1:6Rs8MugOzaMcthGzobf6GBlRzbOFiK/GJiuYN6MCfEw= +github.com/kubeshop/testkube-operator v1.10.8-0.20230621113013-570eb19fe281 h1:5CBaQvzt2BPvI0PiZmdVgHr7t0pUN9fovTk9TpvXwqU= +github.com/kubeshop/testkube-operator v1.10.8-0.20230621113013-570eb19fe281/go.mod h1:6Rs8MugOzaMcthGzobf6GBlRzbOFiK/GJiuYN6MCfEw= github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= github.com/lithammer/fuzzysearch v1.1.8 h1:/HIuJnjHuXS8bKaiTMeeDlW2/AyIWk2brx1V8LFgLN4= diff --git a/internal/app/api/v1/tests.go b/internal/app/api/v1/tests.go index 48ead3108e9..0af82e79ca3 100644 --- a/internal/app/api/v1/tests.go +++ b/internal/app/api/v1/tests.go @@ -16,6 +16,7 @@ import ( testsv3 "github.com/kubeshop/testkube-operator/apis/tests/v3" "github.com/kubeshop/testkube-operator/client/tests/v3" + testsclientv3 "github.com/kubeshop/testkube-operator/client/tests/v3" "github.com/kubeshop/testkube-operator/pkg/secret" "github.com/kubeshop/testkube/pkg/api/v1/testkube" "github.com/kubeshop/testkube/pkg/crd" @@ -532,12 +533,16 @@ func (s TestkubeAPI) DeleteTestHandler() fiber.Handler { return s.Warn(c, http.StatusNotFound, fmt.Errorf("%s: client could not find test: %w", errPrefix, err)) } - return s.Error(c, http.StatusBadGateway, fmt.Errorf("%s: client could not delete test: %w", errPrefix, err)) + if _, ok := err.(*testsclientv3.DeleteDependenciesError); ok { + return s.Warn(c, http.StatusInternalServerError, fmt.Errorf("client deleted test %s but deleting test dependencies(secrets) returned errors: %w", name, err)) + } + + return s.Error(c, http.StatusInternalServerError, fmt.Errorf("%s: client could not delete test: %w", errPrefix, err)) } // delete executions for test if err = s.ExecutionResults.DeleteByTest(c.Context(), name); err != nil { - return s.Error(c, http.StatusInternalServerError, fmt.Errorf("%s: could not delete the executions of the test: %w", errPrefix, err)) + return s.Warn(c, http.StatusInternalServerError, fmt.Errorf("test %s was deleted but deleting test executions returned error: %w", name, err)) } return c.SendStatus(http.StatusNoContent)