Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Commit

Permalink
Add tests for initcontainer resources
Browse files Browse the repository at this point in the history
  • Loading branch information
Pete Brown committed Jan 25, 2019
1 parent 3ea341e commit 6717f56
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions elasticsearch/tests/elasticsearch_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def test_overriding_the_image_and_tag():
def test_use_discovery_hosts_if_not_master():
config = '''
masterService: "hostservice"
roles:
roles:
master: "false"
'''
r = helm_template(config)
Expand All @@ -207,7 +207,7 @@ def test_use_discovery_hosts_if_not_master():
def test_set_initial_master_nodes_when_using_v_7():
config = '''
esMajorVersion: 7
roles:
roles:
master: "true"
'''
r = helm_template(config)
Expand All @@ -225,7 +225,7 @@ def test_set_initial_master_nodes_when_using_v_7():
def test_dont_set_initial_master_nodes_if_not_master_when_using_es_version_7():
config = '''
esMajorVersion: 7
roles:
roles:
master: "false"
'''
r = helm_template(config)
Expand All @@ -247,7 +247,7 @@ def test_enabling_machine_learning_role():

def test_adding_extra_env_vars():
config = '''
extraEnvs:
extraEnvs:
- name: hello
value: world
'''
Expand Down Expand Up @@ -324,6 +324,29 @@ def test_adding_a_node_selector():
r = helm_template(config)
assert r['statefulset'][uname]['spec']['template']['spec']['nodeSelector']['disktype'] == 'ssd'

def test_adding_resources_to_initcontainer():
config = '''
initResources:
limits:
cpu: "25m"
memory: "128Mi"
requests:
cpu: "25m"
memory: "128Mi"
'''
r = helm_template(config)
i = r['statefulset'][uname]['spec']['template']['spec']['initContainers'][0]

assert i['resources'] == {
'requests': {
'cpu': '25m',
'memory': '128Mi'
},
'limits': {
'cpu': '25m',
'memory': '128Mi'
}
}

def test_adding_an_ingress_rule():
config = '''
Expand Down Expand Up @@ -389,5 +412,3 @@ def test_adding_in_es_config():
assert {'mountPath': '/usr/share/elasticsearch/config/log4j2.properties', 'name': 'esconfig', 'subPath': 'log4j2.properties'} in s['containers'][0]['volumeMounts']

assert 'configchecksum' in r['statefulset'][uname]['spec']['template']['metadata']['annotations']


0 comments on commit 6717f56

Please sign in to comment.