<commit_before>import json
import pytest
import os
import base64

from typing import ClassVar, Dict, Sequence, Tuple, Union

from kat.harness import variants, Query, Runner, Test
from kat.manifests import AMBASSADOR

from abstract_tests import DEV, AmbassadorTest, HTTP
from abstract_tests import MappingTest, OptionTest, ServiceType, Node

from t_ratelimit import RateLimitTest
from t_tracing import TracingTest
from t_shadow import ShadowTest
from t_extauth import AuthenticationTest, AuthenticationTestV1, AuthenticationHTTPBufferedTest

# XXX: should test empty ambassador config

GRAPHITE_CONFIG = """
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: {0}
spec:
  replicas: 1
  template:
    metadata:
      labels:
        service: {0}
    spec:
      containers:
      - name: {0}
        image: hopsoft/graphite-statsd:latest
      restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
  labels:
    service: {0}
  name: {0}
spec:
  ports:
  - protocol: UDP
    port: 8125
    name: statsd-metrics
  - protocol: TCP
    port: 80
    name: graphite-www
  selector:
    service: {0}
"""


class TLSContextsTest(AmbassadorTest):
    """<commit_msg>Roll back statsd container to one that works for our tests.<commit_after>import json
import pytest
import os
import base64

from typing import ClassVar, Dict, Sequence, Tuple, Union

from kat.harness import variants, Query, Runner, Test
from kat.manifests import AMBASSADOR

from abstract_tests import DEV, AmbassadorTest, HTTP
from abstract_tests import MappingTest, OptionTest, ServiceType, Node

from t_ratelimit import RateLimitTest
from t_tracing import TracingTest
from t_shadow import ShadowTest
from t_extauth import AuthenticationTest, AuthenticationTestV1, AuthenticationHTTPBufferedTest

# XXX: should test empty ambassador config

GRAPHITE_CONFIG = """
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: {0}
spec:
  replicas: 1
  template:
    metadata:
      labels:
        service: {0}
    spec:
      containers:
      - name: {0}
        image: hopsoft/graphite-statsd:v0.9.15-phusion0.9.18
      restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
  labels:
    service: {0}
  name: {0}
spec:
  ports:
  - protocol: UDP
    port: 8125
    name: statsd-metrics
  - protocol: TCP
    port: 80
    name: graphite-www
  selector:
    service: {0}
"""


class TLSContextsTest(AmbassadorTest):
    """
{'fraction_non_alphanumeric': 0.07822149032523672, 'fraction_numerical': 0.018937834499794155, 'mean_word_length': 3.8118811881188117, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7472589', 'n_tokens_mistral': 797, 'n_tokens_neox': 762, 'n_words': 244}