Skip to content

Commit

Permalink
tests refactoring
Browse files Browse the repository at this point in the history
fixes

tests refactoring

linting

test

Signed-off-by: Paige Patton <[email protected]>
  • Loading branch information
tsebastiani authored and paigerube14 committed Dec 11, 2024
1 parent 34bb1ed commit a6bc97a
Show file tree
Hide file tree
Showing 16 changed files with 1,577 additions and 1,506 deletions.
16 changes: 3 additions & 13 deletions src/krkn_lib/k8s/krkn_kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,27 +150,17 @@ def __initialize_clients(self, kubeconfig_path: str = None):

client_config = client.Configuration().get_default_copy()
http_proxy = os.getenv("http_proxy", None)
if http_proxy is not None:
if http_proxy is not None:
os.environ["HTTP_PROXY"] = http_proxy
client_config.proxy = http_proxy
proxy_auth = urlparse(http_proxy)
auth_string = proxy_auth.username + ":" + proxy_auth.password
client_config.proxy_headers = urllib3.util.make_headers(
proxy_basic_auth=auth_string
)
# if http_proxy and "@" in http_proxy:

# # client_config.username = proxy_auth.username
# # client_config.password = proxy_auth.password
#

print('set default')
# config.load_kube_config(
# kubeconfig_path
# )

client.Configuration.set_default(client_config)
print('load config')


self.api_client = client.ApiClient(client_config)

self.cli = client.CoreV1Api(self.api_client)
Expand Down
12 changes: 6 additions & 6 deletions src/krkn_lib/models/elastic/models.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import datetime

from elasticsearch_dsl import (
Keyword,
Text,
Date,
Document,
Float,
Long,
Nested,
InnerDoc,
Integer,
Keyword,
Long,
Nested,
Text,
)
import datetime

from krkn_lib.models.telemetry import ChaosRunTelemetry

Expand Down Expand Up @@ -195,4 +196,3 @@ def __init__(
self.cloud_type = chaos_run_telemetry.cloud_type
self.cluster_version = chaos_run_telemetry.cluster_version
self.run_uuid = chaos_run_telemetry.run_uuid

5 changes: 4 additions & 1 deletion src/krkn_lib/models/telemetry/models.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
from __future__ import annotations

import base64
import json
import yaml
from dataclasses import dataclass
from datetime import datetime, timezone

import yaml

from krkn_lib.models.k8s import PodsStatus

relevant_event_reasons: frozenset[str] = frozenset(
Expand Down
1 change: 1 addition & 0 deletions src/krkn_lib/telemetry/ocp/krkn_telemetry_openshift.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
import threading
from queue import Queue

from krkn_lib.models.telemetry import ChaosRunTelemetry
from krkn_lib.ocp import KrknOpenshift
from krkn_lib.telemetry.k8s import KrknTelemetryKubernetes
Expand Down
6 changes: 1 addition & 5 deletions src/krkn_lib/tests/test_krkn_elastic.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import datetime
import time

import uuid

from krkn_lib.elastic.krkn_elastic import KrknElastic
from krkn_lib.models.elastic.models import (
ElasticAlert,
ElasticMetric,
)
from krkn_lib.models.elastic.models import ElasticAlert, ElasticMetric
from krkn_lib.models.telemetry import ChaosRunTelemetry
from krkn_lib.tests import BaseTest
from krkn_lib.utils import SafeLogger
Expand Down
Loading

0 comments on commit a6bc97a

Please sign in to comment.