Coverage for ocp_resources/utils/constants.py: 100%

15 statements  

« prev     ^ index     » next       coverage.py v7.6.10, created at 2025-02-12 18:08 +0200

1from __future__ import annotations 

2 

3from typing import Dict, List 

4from kubernetes.dynamic.exceptions import ( 

5 ForbiddenError, 

6 InternalServerError, 

7 NotFoundError, 

8 ServerTimeoutError, 

9) 

10from urllib3.exceptions import MaxRetryError, ProtocolError 

11 

12DEFAULT_CLUSTER_RETRY_EXCEPTIONS: Dict[type[Exception], List[str]] = { 

13 MaxRetryError: [], 

14 ConnectionAbortedError: [], 

15 ConnectionResetError: [], 

16 InternalServerError: [ 

17 "etcdserver: leader changed", 

18 "etcdserver: request timed out", 

19 "Internal error occurred: failed calling webhook", 

20 "rpc error:", 

21 ], 

22 ServerTimeoutError: [], 

23 ForbiddenError: ["context deadline exceeded"], 

24} 

25PROTOCOL_ERROR_EXCEPTION_DICT: Dict[type[Exception], List[str]] = {ProtocolError: []} 

26NOT_FOUND_ERROR_EXCEPTION_DICT: Dict[type[Exception], List[str]] = {NotFoundError: []} 

27 

28TIMEOUT_1SEC: int = 1 

29TIMEOUT_5SEC: int = 5 

30TIMEOUT_10SEC: int = 10 

31TIMEOUT_30SEC: int = 30 

32TIMEOUT_1MINUTE: int = 60 

33TIMEOUT_2MINUTES: int = 2 * 60 

34TIMEOUT_4MINUTES: int = 4 * 60 

35TIMEOUT_10MINUTES: int = 10 * 60