Skip to content

add unit test coverage for ComputingUnitManagingServiceException #6325

Description

@mengw15

Task Summary

computing-unit-managing-service/src/main/scala/org/apache/texera/service/util/ComputingUnitManagingServiceException.scala (0% coverage) defines a sealed exception hierarchy plus fromKubernetes, which classifies a KubernetesClientException into a typed exception. Pure logic, no DB — a plain AnyFlatSpec covers it.

Behavior to cover

  • InsufficientComputingResource("CPU").getMessage == "Insufficient CPU available in the server. Please decrease the requested amount or try again later."
  • InsufficientComputingUnitQuota(3).getMessage == "You may only have 3 computing-unit(s) running at the same time"
  • InternalError().getMessage == the default "The server encountered an internal error while processing your request. Please try again later."
  • fromKubernetes — message contains "exceeded quota" and "cpu" -> InsufficientComputingResource("CPU"); "memory" -> ("memory"); "gpu" -> ("GPU")
  • fromKubernetes"exceeded quota" but none of cpu/memory/gpu -> InternalError(e.getMessage)
  • fromKubernetes — message without "exceeded quota" -> InternalError(e.getMessage)
  • fromKubernetesnull message -> InternalError (the Option(e.getMessage).getOrElse("") path)
  • Case-insensitivity: "Exceeded Quota: CPU limit" classifies as CPU (message is lower-cased before matching)

Task Type

  • Refactor / Cleanup
  • DevOps / Deployment / CI
  • Testing / QA
  • Documentation
  • Performance
  • Other

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Fields

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions